@foray1010/eslint-config 6.3.0 → 7.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 +33 -0
- package/package.json +8 -8
- package/presets/base.js +15 -8
- package/presets/node.js +7 -7
- package/presets/react.js +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,39 @@
|
|
|
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
|
+
## [7.0.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@6.4.0...@foray1010/eslint-config@7.0.0) (2022-06-13)
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
- drop support for typescript >=5
|
|
11
|
+
- drop eslint 7
|
|
12
|
+
- drop node 12 and 17
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- **deps:** update dependency eslint-plugin-jsdoc to v39 ([f868271](https://github.com/foray1010/common-presets/commit/f8682716ee922a6a517d5c0173390dec0bd2e346))
|
|
17
|
+
- reenable import/named ([62fe238](https://github.com/foray1010/common-presets/commit/62fe2389b852749d63735b02e4898708a132b522))
|
|
18
|
+
- reenable no-floating-promises for test files ([3a03ad8](https://github.com/foray1010/common-presets/commit/3a03ad8e13f2b2440babc96880cd290f4ea6b386))
|
|
19
|
+
- replace eslint-plugin-node by eslint-plugin-n ([764320c](https://github.com/foray1010/common-presets/commit/764320cc26795c245008ce5bdbb87662e5dbae60))
|
|
20
|
+
|
|
21
|
+
### Miscellaneous Chores
|
|
22
|
+
|
|
23
|
+
- drop eslint 7 ([543fd6a](https://github.com/foray1010/common-presets/commit/543fd6a702596e5e447a0797a4713d2f08478ecb))
|
|
24
|
+
- drop node 12 and 17 ([c43351e](https://github.com/foray1010/common-presets/commit/c43351e0da92209fc3100d9cb1bc129af320fdac))
|
|
25
|
+
- remove peerDependencies versions that are not sure if supported ([2175adb](https://github.com/foray1010/common-presets/commit/2175adb62efe7d1762f6f66ce9bb0e7adb5f82e5))
|
|
26
|
+
|
|
27
|
+
## [6.4.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@6.3.1...@foray1010/eslint-config@6.4.0) (2022-04-25)
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
- **eslint-config:** add more rules for jest ([9e7b466](https://github.com/foray1010/common-presets/commit/9e7b466c332d90d56e5d41d4a006147148c3ae32))
|
|
32
|
+
|
|
33
|
+
### [6.3.1](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@6.3.0...@foray1010/eslint-config@6.3.1) (2022-04-25)
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
- allow unnecessary fragment for single expression ([3208164](https://github.com/foray1010/common-presets/commit/320816415a3554c96a71275b0f36444bc9495259))
|
|
38
|
+
|
|
6
39
|
## [6.3.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@6.2.0...@foray1010/eslint-config@6.3.0) (2022-04-25)
|
|
7
40
|
|
|
8
41
|
### Features
|
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": "7.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,7 +20,7 @@
|
|
|
20
20
|
"eslintignore"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@foray1010/common-presets-utils": "^
|
|
23
|
+
"@foray1010/common-presets-utils": "^5.0.0",
|
|
24
24
|
"@typescript-eslint/eslint-plugin": "^5.13.0",
|
|
25
25
|
"@typescript-eslint/parser": "^5.13.0",
|
|
26
26
|
"confusing-browser-globals": "^1.0.10",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"eslint-plugin-import": "^2.22.1",
|
|
31
31
|
"eslint-plugin-jest": "^26.0.0",
|
|
32
32
|
"eslint-plugin-jest-dom": "^4.0.0",
|
|
33
|
-
"eslint-plugin-jsdoc": "^
|
|
34
|
-
"eslint-plugin-
|
|
33
|
+
"eslint-plugin-jsdoc": "^39.0.0",
|
|
34
|
+
"eslint-plugin-n": "^15.2.2",
|
|
35
35
|
"eslint-plugin-prettier": "^4.0.0",
|
|
36
36
|
"eslint-plugin-react": "^7.23.2",
|
|
37
37
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"eslint-plugin-testing-library": "^5.3.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"eslint": "
|
|
43
|
-
"prettier": "
|
|
42
|
+
"eslint": "^8.0.0",
|
|
43
|
+
"prettier": "^2.0.0"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
|
-
"node": "^
|
|
46
|
+
"node": "^14.17.0 || >=16.13.0 || >=18.0.0"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "6b2dbe64ac8e4677dfb6b72f70e185bcd607f17b"
|
|
52
52
|
}
|
package/presets/base.js
CHANGED
|
@@ -16,8 +16,7 @@ module.exports = {
|
|
|
16
16
|
extends: [
|
|
17
17
|
'eslint:recommended',
|
|
18
18
|
'plugin:eslint-comments/recommended',
|
|
19
|
-
'plugin:import/
|
|
20
|
-
'plugin:import/warnings',
|
|
19
|
+
'plugin:import/recommended',
|
|
21
20
|
'plugin:jsdoc/recommended',
|
|
22
21
|
'plugin:prettier/recommended',
|
|
23
22
|
'eslint-config-prettier',
|
|
@@ -47,8 +46,6 @@ module.exports = {
|
|
|
47
46
|
'import/default': 'off',
|
|
48
47
|
// make sure import statements above the others
|
|
49
48
|
'import/first': 'error',
|
|
50
|
-
// doesn't work with redux-saga/effects
|
|
51
|
-
'import/named': 'off',
|
|
52
49
|
// separate import statements from the others
|
|
53
50
|
'import/newline-after-import': 'error',
|
|
54
51
|
// avoid anonymous function or class for easier to debug via stack trace
|
|
@@ -124,8 +121,12 @@ module.exports = {
|
|
|
124
121
|
},
|
|
125
122
|
{
|
|
126
123
|
files: testFileGlobs,
|
|
127
|
-
extends: ['plugin:jest/recommended'],
|
|
124
|
+
extends: ['plugin:jest/recommended', 'plugin:jest/style'],
|
|
128
125
|
plugins: ['eslint-plugin-jest'],
|
|
126
|
+
rules: {
|
|
127
|
+
// make sure lifecycle hooks on the top for readability
|
|
128
|
+
'jest/prefer-hooks-on-top': 'error',
|
|
129
|
+
},
|
|
129
130
|
},
|
|
130
131
|
// typescript plugins are depended on `typescript` package
|
|
131
132
|
...(hasDep('typescript')
|
|
@@ -188,10 +189,18 @@ module.exports = {
|
|
|
188
189
|
'@typescript-eslint/no-use-before-define': [
|
|
189
190
|
'error',
|
|
190
191
|
{
|
|
192
|
+
/* options from eslint/no-use-before-define */
|
|
193
|
+
// allow use function before defined as they could be hoisted
|
|
191
194
|
functions: false,
|
|
192
195
|
classes: true,
|
|
193
196
|
variables: true,
|
|
194
|
-
|
|
197
|
+
|
|
198
|
+
/* options from @typescript-eslint/no-use-before-define */
|
|
199
|
+
enums: true,
|
|
200
|
+
// confusing option, it will disable `typedefs`
|
|
201
|
+
ignoreTypeReferences: false,
|
|
202
|
+
// tsc allows types to be used before define
|
|
203
|
+
typedefs: false,
|
|
195
204
|
},
|
|
196
205
|
],
|
|
197
206
|
// fault alarms in 4.29.3
|
|
@@ -206,8 +215,6 @@ module.exports = {
|
|
|
206
215
|
{
|
|
207
216
|
files: testFileGlobs,
|
|
208
217
|
rules: {
|
|
209
|
-
// testing-library's `act` may or may not response promise, this rule produces false alarm
|
|
210
|
-
'@typescript-eslint/no-floating-promises': 'off',
|
|
211
218
|
// doesn't work with jest.fn<void>()
|
|
212
219
|
'@typescript-eslint/no-invalid-void-type': 'off',
|
|
213
220
|
},
|
package/presets/node.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
-
plugins: ['eslint-plugin-
|
|
4
|
+
plugins: ['eslint-plugin-n'],
|
|
5
5
|
env: {
|
|
6
6
|
node: true,
|
|
7
7
|
},
|
|
8
8
|
rules: {
|
|
9
9
|
// disallow deprecated node APIs
|
|
10
|
-
'
|
|
10
|
+
'n/no-deprecated-api': 'error',
|
|
11
11
|
// disallow the assignment to `exports`
|
|
12
|
-
'
|
|
12
|
+
'n/no-exports-assign': 'error',
|
|
13
13
|
// disallow `bin` files that npm ignores
|
|
14
|
-
'
|
|
14
|
+
'n/no-unpublished-bin': 'error',
|
|
15
15
|
// disallow unsupported Node.js built-in APIs on the specified version
|
|
16
|
-
'
|
|
16
|
+
'n/no-unsupported-features/node-builtins': 'error',
|
|
17
17
|
// make `process.exit()` expressions the same code path as `throw`
|
|
18
|
-
'
|
|
18
|
+
'n/process-exit-as-throw': 'error',
|
|
19
19
|
// enforce shebang on the entry bin file
|
|
20
|
-
'
|
|
20
|
+
'n/shebang': 'error',
|
|
21
21
|
},
|
|
22
22
|
}
|
package/presets/react.js
CHANGED
|
@@ -6,6 +6,7 @@ module.exports = {
|
|
|
6
6
|
extends: [
|
|
7
7
|
'plugin:react/recommended',
|
|
8
8
|
'plugin:react/jsx-runtime',
|
|
9
|
+
'plugin:react-hooks/recommended',
|
|
9
10
|
'eslint-config-prettier',
|
|
10
11
|
],
|
|
11
12
|
parserOptions: {
|
|
@@ -21,7 +22,13 @@ module.exports = {
|
|
|
21
22
|
},
|
|
22
23
|
},
|
|
23
24
|
rules: {
|
|
24
|
-
'react/jsx-no-useless-fragment':
|
|
25
|
+
'react/jsx-no-useless-fragment': [
|
|
26
|
+
'error',
|
|
27
|
+
{
|
|
28
|
+
// allow unnecessary fragment for single expression to bypass some typescript errors (e.g. do not allow string and only allow react element)
|
|
29
|
+
allowExpressions: true,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
25
32
|
'react/jsx-sort-props': [
|
|
26
33
|
'error',
|
|
27
34
|
{
|
|
@@ -36,7 +43,6 @@ module.exports = {
|
|
|
36
43
|
],
|
|
37
44
|
// rely on typescript instead, and it does not work well with types that are imported from elsewhere
|
|
38
45
|
'react/prop-types': 'off',
|
|
39
|
-
'react-hooks/rules-of-hooks': 'error',
|
|
40
46
|
'react-hooks/exhaustive-deps': [
|
|
41
47
|
'error',
|
|
42
48
|
{
|