@kitql/eslint-config 0.1.0-next.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -2
- package/cmd.js +10 -3
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
## 📖 Read the doc
|
|
7
7
|
|
|
8
|
-
[](https://kitql.dev/docs)
|
|
8
|
+
[](https://kitql.dev/docs/tools/08_eslint-config)
|
|
9
9
|
|
|
10
10
|
## Install
|
|
11
11
|
|
|
@@ -18,8 +18,10 @@ npm install @kitql/eslint-config --D
|
|
|
18
18
|
`.eslintrc.js`
|
|
19
19
|
|
|
20
20
|
```js
|
|
21
|
+
/** @type { import("eslint").Linter.FlatConfig } */
|
|
21
22
|
module.exports = {
|
|
22
|
-
extends: ['@kitql']
|
|
23
|
+
extends: ['@kitql'],
|
|
24
|
+
rules: {}
|
|
23
25
|
}
|
|
24
26
|
```
|
|
25
27
|
|
|
@@ -36,6 +38,29 @@ module.exports = {
|
|
|
36
38
|
}
|
|
37
39
|
```
|
|
38
40
|
|
|
41
|
+
### ignore things with
|
|
42
|
+
|
|
43
|
+
`.prettierignore`
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
.DS_Store
|
|
47
|
+
node_modules
|
|
48
|
+
/build
|
|
49
|
+
/.svelte-kit
|
|
50
|
+
/package
|
|
51
|
+
.env
|
|
52
|
+
.env.*
|
|
53
|
+
!.env.example
|
|
54
|
+
|
|
55
|
+
# Ignore files for PNPM, NPM and YARN
|
|
56
|
+
pnpm-lock.yaml
|
|
57
|
+
package-lock.json
|
|
58
|
+
yarn.lock
|
|
59
|
+
|
|
60
|
+
# Ignore files that are project specific
|
|
61
|
+
/db
|
|
62
|
+
```
|
|
63
|
+
|
|
39
64
|
### usage
|
|
40
65
|
|
|
41
66
|
```bash
|
package/cmd.js
CHANGED
|
@@ -7,6 +7,7 @@ import fs from 'fs'
|
|
|
7
7
|
const log = new Log('kitql-lint')
|
|
8
8
|
|
|
9
9
|
program.addOption(new Option('-f, --format', 'format'))
|
|
10
|
+
program.addOption(new Option('-g, --glob <type>', 'file/dir/glob (. by default)', '.'))
|
|
10
11
|
|
|
11
12
|
program.parse(process.argv)
|
|
12
13
|
const options_cli = program.opts()
|
|
@@ -32,6 +33,7 @@ let pathPrettierIgnore = findFileOrUp('.prettierignore')
|
|
|
32
33
|
let pathPrettierCjs = findFileOrUp('.prettierrc.cjs')
|
|
33
34
|
|
|
34
35
|
const format = options_cli.format ?? false
|
|
36
|
+
const glob = options_cli.glob ?? '.'
|
|
35
37
|
|
|
36
38
|
// First prettier
|
|
37
39
|
const cmdPrettier =
|
|
@@ -44,7 +46,7 @@ const cmdPrettier =
|
|
|
44
46
|
// format or not
|
|
45
47
|
`${format ? ' --write' : ''}` +
|
|
46
48
|
// exec
|
|
47
|
-
`
|
|
49
|
+
` ${glob}`
|
|
48
50
|
let result_prettier = spawn(cmdPrettier, {
|
|
49
51
|
shell: true,
|
|
50
52
|
cwd: process.cwd(),
|
|
@@ -55,7 +57,12 @@ let result_prettier = spawn(cmdPrettier, {
|
|
|
55
57
|
if (!format) {
|
|
56
58
|
const logPrettier = new Log('kitql-lint prettier')
|
|
57
59
|
result_prettier.stdout.on('data', data => {
|
|
58
|
-
logPrettier.error(
|
|
60
|
+
logPrettier.error(
|
|
61
|
+
data
|
|
62
|
+
.toString()
|
|
63
|
+
// rmv the last \n if any
|
|
64
|
+
.replace(/\n$/, ''),
|
|
65
|
+
)
|
|
59
66
|
})
|
|
60
67
|
}
|
|
61
68
|
|
|
@@ -68,7 +75,7 @@ result_prettier.on('close', code => {
|
|
|
68
75
|
// format or not
|
|
69
76
|
`${format ? ' --fix' : ''}` +
|
|
70
77
|
// exec
|
|
71
|
-
`
|
|
78
|
+
` ${glob}`
|
|
72
79
|
|
|
73
80
|
// log.info(cmdEsLint)
|
|
74
81
|
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"eslint",
|
|
7
7
|
"eslint-config"
|
|
8
8
|
],
|
|
9
|
-
"version": "0.1.
|
|
9
|
+
"version": "0.1.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"type": "module",
|
|
12
12
|
"repository": {
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"main": "index.cjs",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@graphql-eslint/eslint-plugin": "3.20.1",
|
|
24
|
-
"@kitql/helpers": "0.8.8
|
|
24
|
+
"@kitql/helpers": "0.8.8",
|
|
25
25
|
"@theguild/eslint-config": "^0.11.1",
|
|
26
26
|
"@theguild/prettier-config": "2.0.2",
|
|
27
27
|
"@trivago/prettier-plugin-sort-imports": "4.3.0",
|
|
28
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
29
|
-
"@typescript-eslint/parser": "6.
|
|
30
|
-
"@vue/compiler-sfc": "3.
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "6.18.1",
|
|
29
|
+
"@typescript-eslint/parser": "6.18.1",
|
|
30
|
+
"@vue/compiler-sfc": "3.4.7",
|
|
31
31
|
"commander": "^11.1.0",
|
|
32
32
|
"eslint": "8.56.0",
|
|
33
33
|
"eslint-config-prettier": "9.1.0",
|