@foray1010/eslint-config 12.0.0 → 12.2.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 +16 -0
- package/bases/base.mjs +9 -7
- package/bases/browser.mjs +0 -1
- package/bases/node.mjs +6 -6
- package/package.json +4 -4
- package/utils/applyConfig.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [12.2.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@12.1.0...@foray1010/eslint-config@12.2.0) (2024-01-20)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **eslint-config:** prefer promise style when using nodejs modules ([ff2b07e](https://github.com/foray1010/common-presets/commit/ff2b07ec726573f8e21b3b0ff54b069061591153))
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **deps:** update dependency eslint-plugin-unicorn to v50 ([aa474d6](https://github.com/foray1010/common-presets/commit/aa474d613a309319f0323ae4dcb32f6dd85f78e4))
|
|
15
|
+
|
|
16
|
+
## [12.1.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@12.0.0...@foray1010/eslint-config@12.1.0) (2023-11-17)
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
- **eslint-config:** enable regexp strict mode ([07d035b](https://github.com/foray1010/common-presets/commit/07d035badb143ce4490cd4731b8bf43667bbf07b))
|
|
21
|
+
|
|
6
22
|
## [12.0.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@11.0.3...@foray1010/eslint-config@12.0.0) (2023-11-17)
|
|
7
23
|
|
|
8
24
|
### ⚠ BREAKING CHANGES
|
package/bases/base.mjs
CHANGED
|
@@ -185,9 +185,9 @@ async function generateTypeScriptConfig() {
|
|
|
185
185
|
// reduce the difficult to use this rule
|
|
186
186
|
ignoreInferredTypes: true,
|
|
187
187
|
// escape hatch without using eslint-disable
|
|
188
|
-
ignoreNamePattern: /Mutable
|
|
188
|
+
ignoreNamePattern: /Mutable$/u.source,
|
|
189
189
|
ignoreTypePattern: [
|
|
190
|
-
/^React
|
|
190
|
+
/^React\./u.source, // Some React types does not work with `Readonly`
|
|
191
191
|
],
|
|
192
192
|
},
|
|
193
193
|
],
|
|
@@ -205,12 +205,12 @@ async function generateTypeScriptConfig() {
|
|
|
205
205
|
// modified from https://github.com/eslint-functional/eslint-plugin-functional/blob/main/docs/rules/type-declaration-immutability.md#preset-overrides
|
|
206
206
|
fixer: [
|
|
207
207
|
{
|
|
208
|
-
pattern: /^(Array|Map|Set)<(.+)
|
|
209
|
-
replace: /Readonly\$1<\$2
|
|
208
|
+
pattern: /^(Array|Map|Set)<(.+)>$/u.source,
|
|
209
|
+
replace: /Readonly\$1<\$2>/u.source,
|
|
210
210
|
},
|
|
211
211
|
{
|
|
212
|
-
pattern: /^(.+)
|
|
213
|
-
replace: /Readonly<\$1
|
|
212
|
+
pattern: /^(.+)$/u.source,
|
|
213
|
+
replace: /Readonly<\$1>/u.source,
|
|
214
214
|
},
|
|
215
215
|
],
|
|
216
216
|
},
|
|
@@ -311,7 +311,7 @@ const baseConfig = [
|
|
|
311
311
|
...eslintPluginRegexp.configs['recommended']?.rules,
|
|
312
312
|
...Object.fromEntries(
|
|
313
313
|
Object.entries(
|
|
314
|
-
eslintPluginUnicorn.configs['recommended']?.rules ?? {},
|
|
314
|
+
eslintPluginUnicorn.configs['flat/recommended']?.rules ?? {},
|
|
315
315
|
).filter(([ruleName]) => {
|
|
316
316
|
// only use a subset of recommended rules as other rules are too strict
|
|
317
317
|
return (
|
|
@@ -411,6 +411,8 @@ const baseConfig = [
|
|
|
411
411
|
destructuring: 'all',
|
|
412
412
|
},
|
|
413
413
|
],
|
|
414
|
+
// enable regexp strict mode (use `v` flag instead when it is widely supported)
|
|
415
|
+
'regexp/require-unicode-regexp': 'error',
|
|
414
416
|
// use with `unicorn/throw-new-error`
|
|
415
417
|
// disallow builtins to be created without `new` operator, to be consistent with es6 class syntax
|
|
416
418
|
'unicorn/new-for-builtins': 'error',
|
package/bases/browser.mjs
CHANGED
package/bases/node.mjs
CHANGED
|
@@ -8,9 +8,7 @@ import eslintPluginN from 'eslint-plugin-n'
|
|
|
8
8
|
const cjsConfig = {
|
|
9
9
|
languageOptions: {
|
|
10
10
|
globals: {
|
|
11
|
-
// @ts-expect-error
|
|
12
11
|
__dirname: 'readonly',
|
|
13
|
-
// @ts-expect-error
|
|
14
12
|
__filename: 'readonly',
|
|
15
13
|
},
|
|
16
14
|
},
|
|
@@ -25,11 +23,9 @@ const nodeConfig = [
|
|
|
25
23
|
languageOptions: {
|
|
26
24
|
globals: {
|
|
27
25
|
// hack to mute no-undef error, and show n/prefer-global/buffer error instead
|
|
28
|
-
|
|
29
|
-
Buffer: 'writable',
|
|
26
|
+
Buffer: 'readonly',
|
|
30
27
|
// hack to mute no-undef error, and show n/prefer-global/process error instead
|
|
31
|
-
|
|
32
|
-
process: 'writable',
|
|
28
|
+
process: 'readonly',
|
|
33
29
|
},
|
|
34
30
|
},
|
|
35
31
|
rules: {
|
|
@@ -57,6 +53,10 @@ const nodeConfig = [
|
|
|
57
53
|
'n/prefer-global/url': ['error', 'always'],
|
|
58
54
|
// prefer global `URLSearchParams` to be isomorphic
|
|
59
55
|
'n/prefer-global/url-search-params': ['error', 'always'],
|
|
56
|
+
// prefer `import { promises as dns } from 'node:dns'`
|
|
57
|
+
'n/prefer-promises/dns': 'error',
|
|
58
|
+
// prefer `import { promises as fs } from 'node:fs'`
|
|
59
|
+
'n/prefer-promises/fs': 'error',
|
|
60
60
|
// make `process.exit()` expressions the same code path as `throw`
|
|
61
61
|
'n/process-exit-as-throw': 'error',
|
|
62
62
|
// enforce shebang on the entry bin file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@foray1010/eslint-config",
|
|
4
|
-
"version": "12.
|
|
4
|
+
"version": "12.2.0",
|
|
5
5
|
"homepage": "https://github.com/foray1010/common-presets/tree/master/packages/eslint-config#readme",
|
|
6
6
|
"bugs": "https://github.com/foray1010/common-presets/issues",
|
|
7
7
|
"repository": {
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"eslint-plugin-regexp": "^2.1.1",
|
|
42
42
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
43
43
|
"eslint-plugin-testing-library": "^6.1.2",
|
|
44
|
-
"eslint-plugin-unicorn": "^
|
|
44
|
+
"eslint-plugin-unicorn": "^50.0.1",
|
|
45
45
|
"globals": "^13.23.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/confusing-browser-globals": "1.0.3",
|
|
49
|
-
"@types/eslint": "8.
|
|
49
|
+
"@types/eslint": "8.56.2",
|
|
50
50
|
"@types/eslint__js": "8.42.3"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "46fd1d0f56467d4b461f6264eabd040712989a7e"
|
|
73
73
|
}
|
package/utils/applyConfig.mjs
CHANGED
|
@@ -64,7 +64,7 @@ function generateCombinations(prefixes, originalGlobs) {
|
|
|
64
64
|
|
|
65
65
|
return prefixes.flatMap((prefix) => {
|
|
66
66
|
return verifiedOriginalGlobs.flatMap((originalGlob) => {
|
|
67
|
-
const signRegexp = /^!/
|
|
67
|
+
const signRegexp = /^!/u
|
|
68
68
|
const sign = originalGlob.match(signRegexp)?.[0] ?? ''
|
|
69
69
|
return sign + path.join(prefix, originalGlob.replace(signRegexp, ''))
|
|
70
70
|
})
|