@kitql/eslint-config 0.5.2 → 0.5.4
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/cmd.js +28 -13
- package/eslint.config.js +14 -0
- package/helper/findFileOrUp.js +2 -2
- package/package.json +14 -14
package/cmd.js
CHANGED
|
@@ -16,6 +16,8 @@ spinner.start()
|
|
|
16
16
|
|
|
17
17
|
program.addOption(new Option('-f, --format', 'format'))
|
|
18
18
|
program.addOption(new Option('-g, --glob <type>', 'file/dir/glob (. by default)', '.'))
|
|
19
|
+
program.addOption(new Option('--eslint-only', 'only run eslint', false))
|
|
20
|
+
program.addOption(new Option('--prettier-only', 'only run prettier', false))
|
|
19
21
|
program.addOption(new Option('--verbose', 'add more logs', false))
|
|
20
22
|
program.addOption(
|
|
21
23
|
new Option(
|
|
@@ -29,12 +31,14 @@ program.parse(process.argv)
|
|
|
29
31
|
const options_cli = program.opts()
|
|
30
32
|
|
|
31
33
|
const pathPrettierIgnore = findFileOrUp('.prettierignore')
|
|
32
|
-
const
|
|
34
|
+
const pathPrettierMjs = findFileOrUp('.prettierrc.mjs')
|
|
33
35
|
|
|
34
36
|
const format = options_cli.format ?? false
|
|
35
37
|
const glob = options_cli.glob ?? '.'
|
|
36
38
|
const verbose = options_cli.verbose ?? false
|
|
37
39
|
const pre = options_cli.prefix ?? 'none'
|
|
40
|
+
const eslintOnly = options_cli.eslintOnly ?? false
|
|
41
|
+
const prettierOnly = options_cli.prettierOnly ?? false
|
|
38
42
|
|
|
39
43
|
let preToUse = ''
|
|
40
44
|
if (pre === 'npm') {
|
|
@@ -98,7 +102,7 @@ async function prettierRun() {
|
|
|
98
102
|
// ignore?
|
|
99
103
|
` --ignore-path ${pathPrettierIgnore}` +
|
|
100
104
|
// config
|
|
101
|
-
` --config ${
|
|
105
|
+
` --config ${pathPrettierMjs}` +
|
|
102
106
|
// format or not
|
|
103
107
|
`${format ? ' --write' : ''}` +
|
|
104
108
|
// exec
|
|
@@ -111,21 +115,32 @@ async function prettierRun() {
|
|
|
111
115
|
return result_prettier
|
|
112
116
|
}
|
|
113
117
|
|
|
114
|
-
const
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
const took = []
|
|
119
|
+
if (!prettierOnly) {
|
|
120
|
+
const esLintStart = Date.now()
|
|
121
|
+
const eslintCode = await eslintRun()
|
|
122
|
+
const esLintTook = Date.now() - esLintStart
|
|
123
|
+
took.push(`eslint: ${esLintTook}ms`)
|
|
124
|
+
if (eslintCode.status) {
|
|
125
|
+
spinner.prefixText = bgRedBright(` kitql-lint `)
|
|
126
|
+
spinner.fail(red(`eslint failed, check logs above.`))
|
|
127
|
+
process.exit(eslintCode.status)
|
|
128
|
+
}
|
|
119
129
|
}
|
|
120
130
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
131
|
+
if (!eslintOnly) {
|
|
132
|
+
const prettierStart = Date.now()
|
|
133
|
+
const prettierCode = await prettierRun()
|
|
134
|
+
const prettierTook = Date.now() - prettierStart
|
|
135
|
+
took.push(`prettier: ${prettierTook}ms`)
|
|
136
|
+
if (prettierCode.status) {
|
|
137
|
+
spinner.prefixText = bgRedBright(` kitql-lint `)
|
|
138
|
+
spinner.fail(red(`prettier failed, check logs above.`))
|
|
139
|
+
process.exit(prettierCode.status)
|
|
140
|
+
}
|
|
126
141
|
}
|
|
127
142
|
|
|
128
143
|
spinner.prefixText = bgGreen(` kitql-lint `)
|
|
129
|
-
spinner.succeed(`All good, your files looks great
|
|
144
|
+
spinner.succeed(`All good, your files looks great! ${gray(`(${took.join(', ')})`)}`)
|
|
130
145
|
spinner.stop()
|
|
131
146
|
process.exit(0)
|
package/eslint.config.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { includeIgnoreFile } from '@eslint/compat'
|
|
2
2
|
import js from '@eslint/js'
|
|
3
|
+
import pnpmCatalogs from 'eslint-plugin-pnpm-catalogs'
|
|
3
4
|
import svelte from 'eslint-plugin-svelte'
|
|
4
5
|
import unusedImports from 'eslint-plugin-unused-imports'
|
|
5
6
|
import globals from 'globals'
|
|
@@ -66,6 +67,16 @@ export const config = [
|
|
|
66
67
|
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
67
68
|
},
|
|
68
69
|
},
|
|
70
|
+
{
|
|
71
|
+
name: '@kitql:pnpmCatalogs',
|
|
72
|
+
plugins: {
|
|
73
|
+
pnpmCatalogs,
|
|
74
|
+
},
|
|
75
|
+
rules: {
|
|
76
|
+
'pnpmCatalogs/enforce-catalog': 'error',
|
|
77
|
+
'pnpmCatalogs/valid-catalog': 'error',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
69
80
|
{
|
|
70
81
|
name: '@kitql:rules',
|
|
71
82
|
rules: {
|
|
@@ -86,8 +97,11 @@ export const config = [
|
|
|
86
97
|
|
|
87
98
|
'no-undef': 'off',
|
|
88
99
|
'no-inner-declarations': 'off',
|
|
100
|
+
|
|
89
101
|
'svelte/no-at-html-tags': 'off',
|
|
90
102
|
'svelte/no-inner-declarations': 'off',
|
|
103
|
+
|
|
104
|
+
'svelte/require-each-key': 'warn',
|
|
91
105
|
},
|
|
92
106
|
},
|
|
93
107
|
]
|
package/helper/findFileOrUp.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitql/eslint-config",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"funding": "https://github.com/sponsors/jycouet",
|
|
6
|
+
"homepage": "https://www.kitql.dev/",
|
|
5
7
|
"description": "opinionated linting and formatting for projects",
|
|
6
8
|
"repository": {
|
|
7
9
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/jycouet/kitql",
|
|
10
|
+
"url": "git+https://github.com/jycouet/kitql.git",
|
|
9
11
|
"directory": "packages/eslint-config",
|
|
10
12
|
"homepage": "https://github.com/jycouet/kitql/tree/main/packages/eslint-config"
|
|
11
13
|
},
|
|
@@ -27,26 +29,24 @@
|
|
|
27
29
|
"eslint",
|
|
28
30
|
"eslint-config"
|
|
29
31
|
],
|
|
30
|
-
"peerDependencies": {
|
|
31
|
-
"prettier": "^3.3.3"
|
|
32
|
-
},
|
|
33
32
|
"dependencies": {
|
|
34
33
|
"@eslint/compat": "^1.1.1",
|
|
35
34
|
"@eslint/js": "^9.10.0",
|
|
36
35
|
"@theguild/prettier-config": "3.0.0",
|
|
37
36
|
"@types/eslint": "9.6.1",
|
|
38
|
-
"@typescript-eslint/parser": "
|
|
39
|
-
"commander": "13.
|
|
37
|
+
"@typescript-eslint/parser": "8.5.0",
|
|
38
|
+
"commander": "13.1.0",
|
|
40
39
|
"eslint": "^9.10.0",
|
|
41
|
-
"eslint-plugin-
|
|
42
|
-
"eslint-plugin-
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
40
|
+
"eslint-plugin-pnpm-catalogs": "0.0.2",
|
|
41
|
+
"eslint-plugin-svelte": "3.0.3",
|
|
42
|
+
"eslint-plugin-unused-imports": "4.1.4",
|
|
43
|
+
"globals": "16.0.0",
|
|
44
|
+
"ora": "8.1.0",
|
|
45
|
+
"prettier": "3.5.3",
|
|
46
46
|
"prettier-plugin-svelte": "3.3.2",
|
|
47
47
|
"prettier-plugin-tailwindcss": "0.6.6",
|
|
48
|
-
"typescript-eslint": "8.
|
|
49
|
-
"@kitql/helpers": "0.8.
|
|
48
|
+
"typescript-eslint": "8.26.0",
|
|
49
|
+
"@kitql/helpers": "0.8.12"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|