Skip to content

Commit 718747e

Browse files
committed
Add precious scripts and config
Also adds prettier config and modifies eslint config
1 parent f72991a commit 718747e

File tree

7 files changed

+86
-2
lines changed

7 files changed

+86
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,6 @@ typings/
6262

6363
# next.js build output
6464
.next
65+
66+
# Precious install
67+
local

.precious.toml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
[commands.prettier-scripts]
2+
type = "both"
3+
cmd = [
4+
"npx",
5+
"prettier",
6+
"--parser",
7+
"typescript"
8+
]
9+
lint-flags = ["--check"]
10+
tidy-flags = ["--write"]
11+
path-args = "absolute-file"
12+
include = ["src/**/*.ts"]
13+
ok-exit-codes = 0
14+
15+
[commands.prettier-json]
16+
type = "both"
17+
cmd = [
18+
"npx",
19+
"prettier",
20+
"--parser",
21+
"json"
22+
]
23+
lint-flags = ["--check"]
24+
tidy-flags = ["--write"]
25+
path-args = "absolute-file"
26+
include = ["**/*.json"]
27+
ok-exit-codes = 0
28+
29+
[commands.eslint-scripts]
30+
type = "both"
31+
cmd = [
32+
"npx",
33+
"eslint",
34+
"--config",
35+
"eslint.config.mjs",
36+
]
37+
lint-flags = []
38+
tidy-flags = ["--fix"]
39+
path-args = "absolute-file"
40+
include = ["src/**/*.ts", "src/**/*.js", "e2e/**/*.ts", "e2e/**/*.js"]
41+
ok-exit-codes = 0
42+
43+
[commands.tsc-scripts]
44+
type = "lint"
45+
cmd = [
46+
"npx",
47+
"tsc",
48+
"--noEmit"
49+
]
50+
include = ["src/**/*.ts"]
51+
invoke = "once"
52+
path-args = "none"
53+
ok-exit-codes = 0

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/package-lock.json

bin/install-precious

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
# This is for installing precious and other 3rd party libs needed for linting
4+
# in CI
5+
6+
set -euo pipefail
7+
set -x
8+
9+
if [ -z "${1:-}" ]; then
10+
echo "💥 You need to specify where to install precious. usage: ./bin/install-precious /path/to/bin/dir"
11+
exit 1
12+
fi
13+
14+
TARGET=$1
15+
export TARGET
16+
17+
curl --silent --location \
18+
https://raw.githubusercontent.com/houseabsolute/ubi/master/bootstrap/bootstrap-ubi.sh |
19+
sh
20+
21+
./"$TARGET"/ubi --project houseabsolute/omegasort --in "$TARGET"
22+
./"$TARGET"/ubi --project houseabsolute/precious --in "$TARGET"

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export default tseslint.config(
4242
"jest.config.js",
4343
"eslint.config.mjs",
4444
"coverage",
45+
"prettier.config.mjs",
4546
],
4647
},
4748
);

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
"build:docs": "rm -rf docs && typedoc src/index.ts --out docs --exclude \"**/*.spec.ts\" --readme README.md",
5555
"deploy:docs": "gh-pages -d docs",
5656
"lint": "npx eslint . --max-warnings=0",
57-
"prettier:ts": "prettier --parser typescript --single-quote true --trailing-comma es5 --write 'src/**/*.ts'",
58-
"prettier:ci": "prettier --parser typescript --single-quote true --trailing-comma es5 --list-different 'src/**/*.ts'",
57+
"prettier:ts": "prettier --parser typescript --write 'src/**/*.ts'",
58+
"prettier:ci": "prettier --parser typescript --list-different 'src/**/*.ts'",
5959
"prettier:json": "prettier --parser json --write '**/*.json'",
6060
"test": "jest",
6161
"test:watch": "jest --watch",

prettier.config.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export default {
2+
singleQuote: true,
3+
trailingComma: "es5",
4+
};

0 commit comments

Comments
 (0)