@1stg/eslint-config 9.1.0 → 10.1.0
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/CHANGELOG.md +21 -0
- package/_util.js +8 -2
- package/angular.js +1 -1
- package/base.js +30 -15
- package/loose.js +6 -6
- package/overrides.js +0 -5
- package/package.json +18 -14
- package/ts-base.js +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 10.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#377](https://github.com/1stG/configs/pull/377) [`ed8b7e5`](https://github.com/1stG/configs/commit/ed8b7e56fedf3c99b99b64631d675f67a7265825) Thanks [@JounQin](https://github.com/JounQin)! - feat: enable `eslint-plugin-node-dependencies` conditionally
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#377](https://github.com/1stG/configs/pull/377) [`ed8b7e5`](https://github.com/1stG/configs/commit/ed8b7e56fedf3c99b99b64631d675f67a7265825) Thanks [@JounQin](https://github.com/JounQin)! - fix: declare node engines range correctly
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`ed8b7e5`](https://github.com/1stG/configs/commit/ed8b7e56fedf3c99b99b64631d675f67a7265825)]:
|
|
14
|
+
- @1stg/config@1.1.0
|
|
15
|
+
|
|
16
|
+
## 10.0.0
|
|
17
|
+
|
|
18
|
+
### Major Changes
|
|
19
|
+
|
|
20
|
+
- [#371](https://github.com/1stG/configs/pull/371) [`3cbd4b7`](https://github.com/1stG/configs/commit/3cbd4b734f2297e58f4f917165924a903100d655) Thanks [@JounQin](https://github.com/JounQin)! - feat!: migrate `eslint-plugin-unicorn` to `eslint-plugin-unicorn-x`
|
|
21
|
+
|
|
22
|
+
- [#372](https://github.com/1stG/configs/pull/372) [`f6e2755`](https://github.com/1stG/configs/commit/f6e27555b4ece8266418cfb371b0165b8749b42d) Thanks [@JounQin](https://github.com/JounQin)! - feat!: use `n.convertPath` setting for hashbang rule
|
|
23
|
+
|
|
3
24
|
## 9.1.0
|
|
4
25
|
|
|
5
26
|
### Minor Changes
|
package/_util.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import path from 'node:path'
|
|
4
4
|
|
|
5
|
-
import { preferPrettier } from '@1stg/config'
|
|
5
|
+
import { isCI, isEnvDisabled, isEnvEnabled, preferPrettier } from '@1stg/config'
|
|
6
6
|
import {
|
|
7
7
|
isMonorepo,
|
|
8
8
|
isPkgAvailable,
|
|
@@ -25,7 +25,7 @@ if (isMonorepo()) {
|
|
|
25
25
|
return acc
|
|
26
26
|
}
|
|
27
27
|
const { name, peerDependencies = {}, dependencies = {} } = pkgJson
|
|
28
|
-
// eslint-disable-next-line unicorn/prefer-spread
|
|
28
|
+
// eslint-disable-next-line unicorn-x/prefer-spread
|
|
29
29
|
return acc.concat(
|
|
30
30
|
name,
|
|
31
31
|
Object.keys(peerDependencies),
|
|
@@ -78,3 +78,9 @@ export const nonSourceRules = /** @type {const} */ ({
|
|
|
78
78
|
'n/no-extraneous-require': 0,
|
|
79
79
|
'n/no-unsupported-features/es-builtins': 0,
|
|
80
80
|
})
|
|
81
|
+
|
|
82
|
+
const ESLINT_NODE_DEPS_ENV = 'ESLINT_NODE_DEPS'
|
|
83
|
+
|
|
84
|
+
export const isEslintNodeDepsEnabled = isCI
|
|
85
|
+
? !isEnvDisabled(ESLINT_NODE_DEPS_ENV)
|
|
86
|
+
: isEnvEnabled(ESLINT_NODE_DEPS_ENV)
|
package/angular.js
CHANGED
package/base.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import eslint from '@eslint/js'
|
|
4
4
|
import eslintCommentsConfigs from '@eslint-community/eslint-plugin-eslint-comments/configs'
|
|
5
|
+
import { isPkgAvailable, tryRequirePkg } from '@pkgr/utils'
|
|
5
6
|
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'
|
|
6
7
|
import css from 'eslint-plugin-css'
|
|
7
8
|
import importX from 'eslint-plugin-import-x'
|
|
@@ -11,11 +12,12 @@ import promise from 'eslint-plugin-promise'
|
|
|
11
12
|
import regexp from 'eslint-plugin-regexp'
|
|
12
13
|
import simpleImportSort from 'eslint-plugin-simple-import-sort'
|
|
13
14
|
import sonarjs from 'eslint-plugin-sonarjs'
|
|
14
|
-
import
|
|
15
|
+
import unicornX from 'eslint-plugin-unicorn-x'
|
|
15
16
|
import globals from 'globals'
|
|
16
17
|
import tseslint from 'typescript-eslint'
|
|
17
18
|
|
|
18
19
|
import {
|
|
20
|
+
isEslintNodeDepsEnabled,
|
|
19
21
|
isTsAvailable,
|
|
20
22
|
isWebpackAvailable,
|
|
21
23
|
magicNumbers,
|
|
@@ -32,8 +34,15 @@ export const base = tseslint.config([
|
|
|
32
34
|
promise.configs['flat/recommended'],
|
|
33
35
|
regexp.configs['flat/recommended'],
|
|
34
36
|
sonarjs.configs.recommended,
|
|
35
|
-
|
|
37
|
+
unicornX.configs.recommended,
|
|
36
38
|
prettierExtends,
|
|
39
|
+
isEslintNodeDepsEnabled && isPkgAvailable('eslint-plugin-node-dependencies')
|
|
40
|
+
? [
|
|
41
|
+
/** @type {typeof import('eslint-plugin-node-dependencies')} */ (
|
|
42
|
+
tryRequirePkg('eslint-plugin-node-dependencies')
|
|
43
|
+
).configs['flat/recommended'],
|
|
44
|
+
]
|
|
45
|
+
: [],
|
|
37
46
|
{
|
|
38
47
|
name: '@1stg/node',
|
|
39
48
|
files: ['**/*.{cjs,cts}'],
|
|
@@ -52,7 +61,13 @@ export const base = tseslint.config([
|
|
|
52
61
|
'node_modules/@d-ts',
|
|
53
62
|
'node_modules/@types',
|
|
54
63
|
],
|
|
55
|
-
'import-x/resolver-next':
|
|
64
|
+
'import-x/resolver-next': createTypeScriptImportResolver(),
|
|
65
|
+
n: {
|
|
66
|
+
convertPath: {
|
|
67
|
+
'**/bin.*ts': [String.raw`^(src/)?bin\.([cm]?)ts$`, 'lib/bin.$2js'],
|
|
68
|
+
'**/cli.*ts': [String.raw`^(src/)?cli\.([cm]?)ts$`, 'lib/cli.$2js'],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
56
71
|
},
|
|
57
72
|
languageOptions: {
|
|
58
73
|
sourceType: 'module',
|
|
@@ -116,9 +131,9 @@ export const base = tseslint.config([
|
|
|
116
131
|
},
|
|
117
132
|
],
|
|
118
133
|
'no-negated-condition': 2,
|
|
119
|
-
'no-process-exit': 0, // suspended by unicorn/no-process-exit
|
|
134
|
+
'no-process-exit': 0, // suspended by unicorn-x/no-process-exit
|
|
120
135
|
|
|
121
|
-
// The following rules are duplicate with `eslint-plugin-import`
|
|
136
|
+
// The following rules are duplicate with `eslint-plugin-import-x`
|
|
122
137
|
'n/no-extraneous-import': 0,
|
|
123
138
|
'n/no-extraneous-require': 0,
|
|
124
139
|
'n/no-missing-import': 0,
|
|
@@ -131,15 +146,15 @@ export const base = tseslint.config([
|
|
|
131
146
|
'prefer-const': [2, { destructuring: 'all' }],
|
|
132
147
|
'prefer-object-spread': 2,
|
|
133
148
|
'simple-import-sort/exports': 2,
|
|
134
|
-
'unicorn/catch-error-name': [
|
|
149
|
+
'unicorn-x/catch-error-name': [
|
|
135
150
|
2,
|
|
136
151
|
{
|
|
137
152
|
name: 'error',
|
|
138
153
|
ignore: ['^e(rr)?$'],
|
|
139
154
|
},
|
|
140
155
|
],
|
|
141
|
-
'unicorn/consistent-function-scoping': 0,
|
|
142
|
-
'unicorn/filename-case': [
|
|
156
|
+
'unicorn-x/consistent-function-scoping': 0,
|
|
157
|
+
'unicorn-x/filename-case': [
|
|
143
158
|
2,
|
|
144
159
|
{
|
|
145
160
|
cases: {
|
|
@@ -150,13 +165,13 @@ export const base = tseslint.config([
|
|
|
150
165
|
ignore: [/^[A-Z](([\dA-Z]+_)*[\dA-Z]+)?\.(mdx?|ya?ml)$/],
|
|
151
166
|
},
|
|
152
167
|
],
|
|
153
|
-
'unicorn/no-array-reduce': 0,
|
|
154
|
-
'unicorn/no-null': 0,
|
|
155
|
-
'unicorn/no-unreadable-array-destructuring': 0, // conflict with `no-unused-vars`
|
|
156
|
-
'unicorn/prefer-module': 0,
|
|
157
|
-
'unicorn/prefer-object-from-entries': 0,
|
|
158
|
-
'unicorn/prevent-abbreviations': 0,
|
|
159
|
-
'unicorn/prefer-export-from': [2, { ignoreUsedVariables: true }],
|
|
168
|
+
'unicorn-x/no-array-reduce': 0,
|
|
169
|
+
'unicorn-x/no-null': 0,
|
|
170
|
+
'unicorn-x/no-unreadable-array-destructuring': 0, // conflict with `no-unused-vars`
|
|
171
|
+
'unicorn-x/prefer-module': 0,
|
|
172
|
+
'unicorn-x/prefer-object-from-entries': 0,
|
|
173
|
+
'unicorn-x/prevent-abbreviations': 0,
|
|
174
|
+
'unicorn-x/prefer-export-from': [2, { ignoreUsedVariables: true }],
|
|
160
175
|
},
|
|
161
176
|
},
|
|
162
177
|
{
|
package/loose.js
CHANGED
|
@@ -28,12 +28,12 @@ export const loose = tseslint.config([
|
|
|
28
28
|
'no-negated-condition': 0, // not auto-fixable
|
|
29
29
|
'promise/always-return': 0,
|
|
30
30
|
'promise/catch-or-return': 0,
|
|
31
|
-
'unicorn/explicit-length-check': 0,
|
|
32
|
-
'unicorn/no-array-for-each': 0,
|
|
33
|
-
'unicorn/no-fn-reference-in-iterator': 0,
|
|
34
|
-
'unicorn/prefer-number-properties': 0,
|
|
35
|
-
'unicorn/prefer-prototype-methods': 0,
|
|
36
|
-
'unicorn/prefer-spread': 0,
|
|
31
|
+
'unicorn-x/explicit-length-check': 0,
|
|
32
|
+
'unicorn-x/no-array-for-each': 0,
|
|
33
|
+
'unicorn-x/no-fn-reference-in-iterator': 0,
|
|
34
|
+
'unicorn-x/prefer-number-properties': 0,
|
|
35
|
+
'unicorn-x/prefer-prototype-methods': 0,
|
|
36
|
+
'unicorn-x/prefer-spread': 0,
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
39
|
])
|
package/overrides.js
CHANGED
|
@@ -26,11 +26,6 @@ import { resolveSettings, tsBase } from './ts-base.js'
|
|
|
26
26
|
|
|
27
27
|
export const ts = tseslint.config(
|
|
28
28
|
tsBase,
|
|
29
|
-
{
|
|
30
|
-
name: '@1stg/cli',
|
|
31
|
-
files: ['**/{bin,cli}.ts'],
|
|
32
|
-
rules: { 'n/hashbang': 0 },
|
|
33
|
-
},
|
|
34
29
|
{
|
|
35
30
|
name: '@1stg/code-block',
|
|
36
31
|
files: ['**/*.{md,mdx}/**/*.{cts,mts,ts,tsx}'],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1stg/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Personal but Shareable ESLint Configuration for all 1stG.me projects",
|
|
6
6
|
"repository": "git+https://github.com/1stG/configs.git",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"funding": "https://opencollective.com/configs",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": "
|
|
12
|
+
"node": "^18.20.0 || ^20.19.0 || >=22.12.0"
|
|
13
13
|
},
|
|
14
14
|
"main": "index.js",
|
|
15
15
|
"exports": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"angular-eslint-template-parser": "^0.1.0",
|
|
30
30
|
"eslint": ">=8.0.0",
|
|
31
31
|
"eslint-plugin-jest": "^28.0.0",
|
|
32
|
+
"eslint-plugin-node-dependencies": "^1.0.0",
|
|
32
33
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
33
34
|
"eslint-plugin-react-refresh": "^0.4.0",
|
|
34
35
|
"eslint-plugin-vue": "^10.0.0"
|
|
@@ -55,6 +56,9 @@
|
|
|
55
56
|
"eslint-plugin-jest": {
|
|
56
57
|
"optional": true
|
|
57
58
|
},
|
|
59
|
+
"eslint-plugin-node-dependencies": {
|
|
60
|
+
"optional": true
|
|
61
|
+
},
|
|
58
62
|
"eslint-plugin-react-hooks": {
|
|
59
63
|
"optional": true
|
|
60
64
|
},
|
|
@@ -66,31 +70,31 @@
|
|
|
66
70
|
}
|
|
67
71
|
},
|
|
68
72
|
"dependencies": {
|
|
69
|
-
"@1stg/config": "^1.0
|
|
73
|
+
"@1stg/config": "^1.1.0",
|
|
70
74
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
71
|
-
"@eslint/js": "^9.
|
|
72
|
-
"@pkgr/utils": "^
|
|
73
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
74
|
-
"@typescript-eslint/parser": "^8.
|
|
75
|
+
"@eslint/js": "^9.28.0",
|
|
76
|
+
"@pkgr/utils": "^4.0.0",
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "^8.33.0",
|
|
78
|
+
"@typescript-eslint/parser": "^8.33.0",
|
|
75
79
|
"eslint-config-prettier": "^10.1.5",
|
|
76
|
-
"eslint-import-resolver-typescript": "^4.
|
|
80
|
+
"eslint-import-resolver-typescript": "^4.4.2",
|
|
77
81
|
"eslint-plugin-css": "^0.11.0",
|
|
78
|
-
"eslint-plugin-import-x": "^4.
|
|
79
|
-
"eslint-plugin-jsdoc": "^50.
|
|
82
|
+
"eslint-plugin-import-x": "^4.15.0",
|
|
83
|
+
"eslint-plugin-jsdoc": "^50.7.0",
|
|
80
84
|
"eslint-plugin-jsonc": "^2.20.1",
|
|
81
85
|
"eslint-plugin-markup": "^1.0.1",
|
|
82
86
|
"eslint-plugin-mdx": "^3.4.2",
|
|
83
87
|
"eslint-plugin-n": "^17.18.0",
|
|
84
|
-
"eslint-plugin-prettier": "^5.4.
|
|
88
|
+
"eslint-plugin-prettier": "^5.4.1",
|
|
85
89
|
"eslint-plugin-promise": "^7.2.1",
|
|
86
90
|
"eslint-plugin-regexp": "^2.7.0",
|
|
87
91
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
88
92
|
"eslint-plugin-sonarjs": "^3.0.2",
|
|
89
93
|
"eslint-plugin-toml": "^0.12.0",
|
|
90
|
-
"eslint-plugin-unicorn": "^
|
|
94
|
+
"eslint-plugin-unicorn-x": "^1.0.8",
|
|
91
95
|
"eslint-plugin-yml": "^1.18.0",
|
|
92
|
-
"globals": "^16.
|
|
93
|
-
"typescript-eslint": "^8.
|
|
96
|
+
"globals": "^16.2.0",
|
|
97
|
+
"typescript-eslint": "^8.33.0"
|
|
94
98
|
},
|
|
95
99
|
"publishConfig": {
|
|
96
100
|
"access": "public"
|
package/ts-base.js
CHANGED
|
@@ -129,10 +129,10 @@ export const tsBase = tseslint.config({
|
|
|
129
129
|
'promise/always-return': 0,
|
|
130
130
|
'promise/catch-or-return': 0,
|
|
131
131
|
// ts itself has guaranteed it
|
|
132
|
-
'unicorn/no-array-callback-reference': 0,
|
|
132
|
+
'unicorn-x/no-array-callback-reference': 0,
|
|
133
133
|
// covered by @typescript-eslint/no-extraneous-class
|
|
134
|
-
'unicorn/no-static-only-class': 0,
|
|
134
|
+
'unicorn-x/no-static-only-class': 0,
|
|
135
135
|
// covered by @typescript-eslint/no-this-alias
|
|
136
|
-
'unicorn/no-this-assignment': 0,
|
|
136
|
+
'unicorn-x/no-this-assignment': 0,
|
|
137
137
|
},
|
|
138
138
|
})
|