@foray1010/eslint-config 16.0.1 → 17.0.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 +36 -0
- package/README.md +75 -76
- package/bases/base.mjs +11 -4
- package/constants.mjs +0 -1
- package/package.json +21 -20
- package/tsconfig.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,42 @@
|
|
|
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
|
+
## [17.0.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@16.1.0...@foray1010/eslint-config@17.0.0) (2026-05-17)
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
- drop node v20 and v25
|
|
11
|
+
- **deps:** require typescript `^6.0.3`
|
|
12
|
+
- **eslint-config:** require eslint `^10.3.0`
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- **eslint-config:** encourage to use named parameters
|
|
17
|
+
- **eslint-config:** require eslint `^10.3.0`
|
|
18
|
+
- **eslint-config:** update eslint-plugin-unicorn to v64 (major)
|
|
19
|
+
- support es2024
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
- **eslint-config:** update eslint-plugin-compat to v7 (major)
|
|
24
|
+
- **eslint-config:** update eslint-plugin-n to v18 (major)
|
|
25
|
+
- **eslint-config:** update eslint-plugin-simple-import-sort to v13 (major)
|
|
26
|
+
|
|
27
|
+
### Miscellaneous Chores
|
|
28
|
+
|
|
29
|
+
- **deps:** require typescript `^6.0.3`
|
|
30
|
+
- drop node v20 and v25
|
|
31
|
+
|
|
32
|
+
## [16.1.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@16.0.1...@foray1010/eslint-config@16.1.0) (2026-01-24)
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
- **deps:** update globals to v17 ([d0b3bd9](https://github.com/foray1010/common-presets/commit/d0b3bd9707098a9e7a95bd0e9e250f417fe33494))
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
- **deps:** update eslint-plugin-regexp to v3 ([b4e82bb](https://github.com/foray1010/common-presets/commit/b4e82bb23fa2280dbf8c95e92b0d86ee9d420b8a))
|
|
41
|
+
|
|
6
42
|
## [16.0.1](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@16.0.0...@foray1010/eslint-config@16.0.1) (2025-10-31)
|
|
7
43
|
|
|
8
44
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -21,86 +21,85 @@ Z for looser rules
|
|
|
21
21
|
1. `yarn add -DE @foray1010/eslint-config eslint prettier`
|
|
22
22
|
|
|
23
23
|
2. Create an `eslint.config.js` in the project root
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
```
|
|
24
|
+
- For general purpose or Node.js project (support TypeScript)
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
import {
|
|
28
|
+
eslintIgnoresConfig,
|
|
29
|
+
eslintNodeConfig,
|
|
30
|
+
} from '@foray1010/eslint-config'
|
|
31
|
+
import { defineConfig } from 'eslint/config'
|
|
32
|
+
|
|
33
|
+
const config = defineConfig(eslintIgnoresConfig, eslintNodeConfig)
|
|
34
|
+
export default config
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- For general frontend projects (support TypeScript)
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
import {
|
|
41
|
+
eslintIgnoresConfig,
|
|
42
|
+
eslintBrowserConfig,
|
|
43
|
+
} from '@foray1010/eslint-config'
|
|
44
|
+
import { defineConfig } from 'eslint/config'
|
|
45
|
+
|
|
46
|
+
const config = defineConfig(eslintIgnoresConfig, eslintBrowserConfig)
|
|
47
|
+
export default config
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- For frontend React projects (support TypeScript)
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
import {
|
|
54
|
+
eslintIgnoresConfig,
|
|
55
|
+
eslintReactConfig,
|
|
56
|
+
} from '@foray1010/eslint-config'
|
|
57
|
+
import { defineConfig } from 'eslint/config'
|
|
58
|
+
|
|
59
|
+
const config = defineConfig(eslintIgnoresConfig, eslintReactConfig)
|
|
60
|
+
export default config
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- You can apply config per different directories
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
import {
|
|
67
|
+
eslintIgnoresConfig,
|
|
68
|
+
eslintNodeConfig,
|
|
69
|
+
eslintReactConfig,
|
|
70
|
+
} from '@foray1010/eslint-config'
|
|
71
|
+
import { defineConfig } from 'eslint/config'
|
|
72
|
+
|
|
73
|
+
const config = defineConfig(
|
|
74
|
+
eslintIgnoresConfig,
|
|
75
|
+
{
|
|
76
|
+
ignores: ['src/**'],
|
|
77
|
+
extends: [eslintNodeConfig],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
files: ['src/**'],
|
|
81
|
+
extends: [eslintReactConfig],
|
|
82
|
+
},
|
|
83
|
+
)
|
|
84
|
+
export default config
|
|
85
|
+
```
|
|
87
86
|
|
|
88
87
|
3. If the project support ES Modules, you can directly use `eslint` command with the following setting in `package.json`.
|
|
89
88
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"type": "module"
|
|
92
|
+
}
|
|
93
|
+
```
|
|
95
94
|
|
|
96
95
|
4. If the project does not support ES Modules, you have to put the config in `eslint.config.mjs` instead, and use the following npm script in `package.json`. Note that your editor may not support custom eslint config path and may not work properly.
|
|
97
96
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"scripts": {
|
|
100
|
+
"eslint": "ESLINT_USE_FLAT_CONFIG=true eslint --config eslint.config.mjs"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
105
104
|
|
|
106
|
-
|
|
105
|
+
then use `npm run eslint` or `yarn eslint` to replace `eslint`
|
package/bases/base.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable import-x/extensions */
|
|
2
2
|
import js from '@eslint/js'
|
|
3
|
-
// @ts-expect-error - no official types
|
|
4
3
|
import eslintPluginEslintCommentsConfigs from '@eslint-community/eslint-plugin-eslint-comments/configs'
|
|
5
4
|
import { hasDep, isESM } from '@foray1010/common-presets-utils'
|
|
5
|
+
import eslintPluginFoxglove from '@foxglove/eslint-plugin'
|
|
6
6
|
import { defineConfig } from 'eslint/config'
|
|
7
7
|
import eslintPluginImportX from 'eslint-plugin-import-x'
|
|
8
8
|
import eslintPluginJest from 'eslint-plugin-jest'
|
|
@@ -32,6 +32,9 @@ async function generateTypeScriptConfig() {
|
|
|
32
32
|
eslintPluginImportX.configs['typescript'],
|
|
33
33
|
esmConfig,
|
|
34
34
|
],
|
|
35
|
+
plugins: {
|
|
36
|
+
'@foxglove': eslintPluginFoxglove,
|
|
37
|
+
},
|
|
35
38
|
languageOptions: {
|
|
36
39
|
parserOptions: {
|
|
37
40
|
// faster linting on cli
|
|
@@ -42,6 +45,8 @@ async function generateTypeScriptConfig() {
|
|
|
42
45
|
},
|
|
43
46
|
},
|
|
44
47
|
rules: {
|
|
48
|
+
// promote named parameters by disallowing boolean parameters (boolean trap)
|
|
49
|
+
'@foxglove/no-boolean-parameters': 'error',
|
|
45
50
|
// separate type exports which allow certain optimizations within compilers
|
|
46
51
|
'@typescript-eslint/consistent-type-exports': [
|
|
47
52
|
'error',
|
|
@@ -261,7 +266,7 @@ const baseConfig = defineConfig(
|
|
|
261
266
|
},
|
|
262
267
|
},
|
|
263
268
|
{
|
|
264
|
-
extends: [eslintPluginRegexp.configs
|
|
269
|
+
extends: [eslintPluginRegexp.configs.recommended],
|
|
265
270
|
rules: {
|
|
266
271
|
// enable regexp strict mode (use `v` flag instead when it is widely supported)
|
|
267
272
|
'regexp/require-unicode-regexp': 'error',
|
|
@@ -306,9 +311,9 @@ const baseConfig = defineConfig(
|
|
|
306
311
|
reportUnusedInlineConfigs: 'error',
|
|
307
312
|
},
|
|
308
313
|
languageOptions: {
|
|
309
|
-
ecmaVersion:
|
|
314
|
+
ecmaVersion: 2024,
|
|
310
315
|
globals: {
|
|
311
|
-
...globals.
|
|
316
|
+
...globals.es2024,
|
|
312
317
|
/* Not using `node` to explicitly import node.js only built-in modules, e.g.
|
|
313
318
|
* import { Buffer } from 'node:buffer'
|
|
314
319
|
* import process from 'node:process'
|
|
@@ -319,6 +324,8 @@ const baseConfig = defineConfig(
|
|
|
319
324
|
rules: {
|
|
320
325
|
// always use named function for easier to debug via stack trace
|
|
321
326
|
'func-names': ['error', 'as-needed'],
|
|
327
|
+
// promote named parameters by limiting function parameters
|
|
328
|
+
'max-params': ['error', { max: 3, countThis: 'never' }],
|
|
322
329
|
// prefer explicitly convert type for readability
|
|
323
330
|
'no-implicit-coercion': 'error',
|
|
324
331
|
// make sure private class members are in-use
|
package/constants.mjs
CHANGED
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": "17.0.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,37 @@
|
|
|
20
20
|
"type:check": "tsc"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@eslint-community/eslint-plugin-eslint-comments": "^4.
|
|
24
|
-
"@eslint/js": "^
|
|
25
|
-
"@foray1010/common-presets-utils": "^
|
|
23
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
|
|
24
|
+
"@eslint/js": "^10.0.1",
|
|
25
|
+
"@foray1010/common-presets-utils": "^10.0.0",
|
|
26
|
+
"@foxglove/eslint-plugin": "^2.1.2",
|
|
26
27
|
"confusing-browser-globals": "^1.0.11",
|
|
27
28
|
"eslint-config-prettier": "^10.1.8",
|
|
28
29
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
29
|
-
"eslint-plugin-compat": "^
|
|
30
|
-
"eslint-plugin-import-x": "^4.16.
|
|
31
|
-
"eslint-plugin-jest": "^29.
|
|
30
|
+
"eslint-plugin-compat": "^7.0.2",
|
|
31
|
+
"eslint-plugin-import-x": "^4.16.2",
|
|
32
|
+
"eslint-plugin-jest": "^29.15.2",
|
|
32
33
|
"eslint-plugin-jest-dom": "^5.5.0",
|
|
33
34
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
34
|
-
"eslint-plugin-n": "^
|
|
35
|
-
"eslint-plugin-prettier": "^5.5.
|
|
35
|
+
"eslint-plugin-n": "^18.0.1",
|
|
36
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
36
37
|
"eslint-plugin-react": "^7.37.5",
|
|
37
|
-
"eslint-plugin-react-hooks": "^7.
|
|
38
|
-
"eslint-plugin-regexp": "^
|
|
39
|
-
"eslint-plugin-simple-import-sort": "^
|
|
40
|
-
"eslint-plugin-testing-library": "^7.
|
|
41
|
-
"eslint-plugin-unicorn": "^
|
|
42
|
-
"globals": "^
|
|
43
|
-
"typescript-eslint": "^8.
|
|
38
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
39
|
+
"eslint-plugin-regexp": "^3.1.0",
|
|
40
|
+
"eslint-plugin-simple-import-sort": "^13.0.0",
|
|
41
|
+
"eslint-plugin-testing-library": "^7.16.2",
|
|
42
|
+
"eslint-plugin-unicorn": "^64.0.0",
|
|
43
|
+
"globals": "^17.6.0",
|
|
44
|
+
"typescript-eslint": "^8.59.2"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@types/confusing-browser-globals": "1.0.3"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
50
|
"@testing-library/dom": "^10.4.1",
|
|
50
|
-
"eslint": "^
|
|
51
|
+
"eslint": "^10.3.0",
|
|
51
52
|
"prettier": "^3.6.2",
|
|
52
|
-
"typescript": "^
|
|
53
|
+
"typescript": "^6.0.3"
|
|
53
54
|
},
|
|
54
55
|
"peerDependenciesMeta": {
|
|
55
56
|
"@testing-library/dom": {
|
|
@@ -60,10 +61,10 @@
|
|
|
60
61
|
}
|
|
61
62
|
},
|
|
62
63
|
"engines": {
|
|
63
|
-
"node": "^
|
|
64
|
+
"node": "^22.12.0 || ^24.11.0 || >=26"
|
|
64
65
|
},
|
|
65
66
|
"publishConfig": {
|
|
66
67
|
"access": "public"
|
|
67
68
|
},
|
|
68
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "b0dcdf4522afb97a5ee7088c20299aad17738056"
|
|
69
70
|
}
|