@foray1010/eslint-config 11.0.3 → 12.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 +26 -0
- package/bases/base.mjs +16 -9
- package/package.json +26 -24
- package/utils/applyConfig.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
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.1.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@12.0.0...@foray1010/eslint-config@12.1.0) (2023-11-17)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **eslint-config:** enable regexp strict mode ([07d035b](https://github.com/foray1010/common-presets/commit/07d035badb143ce4490cd4731b8bf43667bbf07b))
|
|
11
|
+
|
|
12
|
+
## [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)
|
|
13
|
+
|
|
14
|
+
### ⚠ BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
- **deps:** require eslint `^8.52.0`
|
|
17
|
+
- require node `^18.12.0 || >=20.9.0`
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
- **eslint-config:** lint regexp ([65fa4ec](https://github.com/foray1010/common-presets/commit/65fa4ec480d1e4569ce2ace9a9a35fcd752f9234))
|
|
22
|
+
- support es2023 ([0993c39](https://github.com/foray1010/common-presets/commit/0993c39c8a2f011b3f18e7796d69c54fc51b8eda))
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
- **deps:** update dependency eslint-plugin-unicorn to v49 ([9501170](https://github.com/foray1010/common-presets/commit/9501170f2099029b64c1d9092b7342a0981d2d32))
|
|
27
|
+
|
|
28
|
+
### Miscellaneous Chores
|
|
29
|
+
|
|
30
|
+
- require node `^18.12.0 || >=20.9.0` ([e231508](https://github.com/foray1010/common-presets/commit/e231508673cefd6e4792083e4f15fd152446e32d))
|
|
31
|
+
|
|
6
32
|
## [11.0.3](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@11.0.2...@foray1010/eslint-config@11.0.3) (2023-10-01)
|
|
7
33
|
|
|
8
34
|
### Bug Fixes
|
package/bases/base.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import eslintPluginEslintComments from '@eslint-community/eslint-plugin-eslint-c
|
|
|
4
4
|
import { hasDep, isESM } from '@foray1010/common-presets-utils'
|
|
5
5
|
import eslintPluginImport from 'eslint-plugin-import'
|
|
6
6
|
import eslintPluginJest from 'eslint-plugin-jest'
|
|
7
|
+
import eslintPluginRegexp from 'eslint-plugin-regexp'
|
|
7
8
|
import eslintPluginSimpleImportSort from 'eslint-plugin-simple-import-sort'
|
|
8
9
|
import eslintPluginUnicorn from 'eslint-plugin-unicorn'
|
|
9
10
|
import globals from 'globals'
|
|
@@ -37,7 +38,7 @@ async function generateTypeScriptConfig() {
|
|
|
37
38
|
{
|
|
38
39
|
files: typeScriptFileGlobs,
|
|
39
40
|
languageOptions: {
|
|
40
|
-
|
|
41
|
+
// @ts-expect-error
|
|
41
42
|
parser: typescriptEslintParser,
|
|
42
43
|
parserOptions: {
|
|
43
44
|
// faster linting on cli
|
|
@@ -53,6 +54,7 @@ async function generateTypeScriptConfig() {
|
|
|
53
54
|
},
|
|
54
55
|
},
|
|
55
56
|
plugins: {
|
|
57
|
+
// @ts-expect-error
|
|
56
58
|
'@typescript-eslint': eslintPluginTypescriptEslint,
|
|
57
59
|
// @ts-expect-error
|
|
58
60
|
deprecation: eslintPluginDeprecation,
|
|
@@ -183,9 +185,9 @@ async function generateTypeScriptConfig() {
|
|
|
183
185
|
// reduce the difficult to use this rule
|
|
184
186
|
ignoreInferredTypes: true,
|
|
185
187
|
// escape hatch without using eslint-disable
|
|
186
|
-
ignoreNamePattern:
|
|
188
|
+
ignoreNamePattern: /Mutable$/u.source,
|
|
187
189
|
ignoreTypePattern: [
|
|
188
|
-
|
|
190
|
+
/^React\./u.source, // Some React types does not work with `Readonly`
|
|
189
191
|
],
|
|
190
192
|
},
|
|
191
193
|
],
|
|
@@ -203,12 +205,12 @@ async function generateTypeScriptConfig() {
|
|
|
203
205
|
// modified from https://github.com/eslint-functional/eslint-plugin-functional/blob/main/docs/rules/type-declaration-immutability.md#preset-overrides
|
|
204
206
|
fixer: [
|
|
205
207
|
{
|
|
206
|
-
pattern:
|
|
207
|
-
replace:
|
|
208
|
+
pattern: /^(Array|Map|Set)<(.+)>$/u.source,
|
|
209
|
+
replace: /Readonly\$1<\$2>/u.source,
|
|
208
210
|
},
|
|
209
211
|
{
|
|
210
|
-
pattern:
|
|
211
|
-
replace:
|
|
212
|
+
pattern: /^(.+)$/u.source,
|
|
213
|
+
replace: /Readonly<\$1>/u.source,
|
|
212
214
|
},
|
|
213
215
|
],
|
|
214
216
|
},
|
|
@@ -233,6 +235,7 @@ async function generateTypeScriptConfig() {
|
|
|
233
235
|
{
|
|
234
236
|
files: typeScriptTestFileGlobs,
|
|
235
237
|
plugins: {
|
|
238
|
+
// @ts-expect-error
|
|
236
239
|
'@typescript-eslint': eslintPluginTypescriptEslint,
|
|
237
240
|
jest: eslintPluginJest,
|
|
238
241
|
},
|
|
@@ -285,9 +288,9 @@ const baseConfig = [
|
|
|
285
288
|
js.configs.recommended,
|
|
286
289
|
{
|
|
287
290
|
languageOptions: {
|
|
288
|
-
ecmaVersion:
|
|
291
|
+
ecmaVersion: 2023,
|
|
289
292
|
globals: {
|
|
290
|
-
//
|
|
293
|
+
// No es2022/es2023 preset yet
|
|
291
294
|
...globals.es2021,
|
|
292
295
|
/* Not using `node` to explicitly import node.js only built-in modules, e.g.
|
|
293
296
|
* import { Buffer } from 'node:buffer'
|
|
@@ -299,11 +302,13 @@ const baseConfig = [
|
|
|
299
302
|
plugins: {
|
|
300
303
|
'@eslint-community/eslint-comments': eslintPluginEslintComments,
|
|
301
304
|
import: eslintPluginImport,
|
|
305
|
+
regexp: eslintPluginRegexp,
|
|
302
306
|
unicorn: eslintPluginUnicorn,
|
|
303
307
|
},
|
|
304
308
|
rules: {
|
|
305
309
|
...eslintPluginEslintComments.configs['recommended']?.rules,
|
|
306
310
|
...eslintPluginImport.configs['recommended']?.rules,
|
|
311
|
+
...eslintPluginRegexp.configs['recommended']?.rules,
|
|
307
312
|
...Object.fromEntries(
|
|
308
313
|
Object.entries(
|
|
309
314
|
eslintPluginUnicorn.configs['recommended']?.rules ?? {},
|
|
@@ -406,6 +411,8 @@ const baseConfig = [
|
|
|
406
411
|
destructuring: 'all',
|
|
407
412
|
},
|
|
408
413
|
],
|
|
414
|
+
// enable regexp strict mode
|
|
415
|
+
'regexp/require-unicode-regexp': 'error',
|
|
409
416
|
// use with `unicorn/throw-new-error`
|
|
410
417
|
// disallow builtins to be created without `new` operator, to be consistent with es6 class syntax
|
|
411
418
|
'unicorn/new-for-builtins': 'error',
|
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": "
|
|
4
|
+
"version": "12.1.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": {
|
|
@@ -20,36 +20,38 @@
|
|
|
20
20
|
"type:check": "tsc"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@eslint-community/eslint-plugin-eslint-comments": "^4.
|
|
24
|
-
"@eslint/js": "^8.
|
|
25
|
-
"@foray1010/common-presets-utils": "^
|
|
26
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
27
|
-
"@typescript-eslint/parser": "^6.
|
|
28
|
-
"confusing-browser-globals": "^1.0.
|
|
23
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.1.0",
|
|
24
|
+
"@eslint/js": "^8.53.0",
|
|
25
|
+
"@foray1010/common-presets-utils": "^8.0.0",
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^6.11.0",
|
|
27
|
+
"@typescript-eslint/parser": "^6.11.0",
|
|
28
|
+
"confusing-browser-globals": "^1.0.11",
|
|
29
29
|
"eslint-config-prettier": "^9.0.0",
|
|
30
|
-
"eslint-import-resolver-typescript": "^3.
|
|
31
|
-
"eslint-plugin-compat": "^4.
|
|
30
|
+
"eslint-import-resolver-typescript": "^3.6.1",
|
|
31
|
+
"eslint-plugin-compat": "^4.2.0",
|
|
32
32
|
"eslint-plugin-deprecation": "^2.0.0",
|
|
33
33
|
"eslint-plugin-functional": "^6.0.0",
|
|
34
|
-
"eslint-plugin-import": "^2.
|
|
35
|
-
"eslint-plugin-jest": "^27.
|
|
36
|
-
"eslint-plugin-jest-dom": "^5.
|
|
37
|
-
"eslint-plugin-n": "^16.
|
|
38
|
-
"eslint-plugin-prettier": "^5.0.
|
|
39
|
-
"eslint-plugin-react": "^7.
|
|
40
|
-
"eslint-plugin-react-hooks": "^4.
|
|
34
|
+
"eslint-plugin-import": "^2.29.0",
|
|
35
|
+
"eslint-plugin-jest": "^27.6.0",
|
|
36
|
+
"eslint-plugin-jest-dom": "^5.1.0",
|
|
37
|
+
"eslint-plugin-n": "^16.3.1",
|
|
38
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
39
|
+
"eslint-plugin-react": "^7.33.2",
|
|
40
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
41
|
+
"eslint-plugin-regexp": "^2.1.1",
|
|
41
42
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
42
|
-
"eslint-plugin-testing-library": "^6.
|
|
43
|
-
"eslint-plugin-unicorn": "^
|
|
44
|
-
"globals": "^13.
|
|
43
|
+
"eslint-plugin-testing-library": "^6.1.2",
|
|
44
|
+
"eslint-plugin-unicorn": "^49.0.0",
|
|
45
|
+
"globals": "^13.23.0"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"@types/confusing-browser-globals": "1.0.
|
|
48
|
-
"@types/eslint": "8.44.
|
|
48
|
+
"@types/confusing-browser-globals": "1.0.3",
|
|
49
|
+
"@types/eslint": "8.44.7",
|
|
50
|
+
"@types/eslint__js": "8.42.3"
|
|
49
51
|
},
|
|
50
52
|
"peerDependencies": {
|
|
51
53
|
"@testing-library/dom": "^9.0.0",
|
|
52
|
-
"eslint": "^8.
|
|
54
|
+
"eslint": "^8.52.0",
|
|
53
55
|
"prettier": "^3.0.0",
|
|
54
56
|
"typescript": "^5.0.2"
|
|
55
57
|
},
|
|
@@ -62,10 +64,10 @@
|
|
|
62
64
|
}
|
|
63
65
|
},
|
|
64
66
|
"engines": {
|
|
65
|
-
"node": "^
|
|
67
|
+
"node": "^18.12.0 || >=20.9.0"
|
|
66
68
|
},
|
|
67
69
|
"publishConfig": {
|
|
68
70
|
"access": "public"
|
|
69
71
|
},
|
|
70
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "42c44850b5cf45044e373ab543d4bb83766cd678"
|
|
71
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
|
})
|