@foray1010/eslint-config 7.4.1 → 7.6.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 +18 -0
- package/package.json +12 -12
- package/presets/base.js +23 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
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.6.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.5.0...@foray1010/eslint-config@7.6.0) (2022-09-30)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **eslint-config:** forbid unnecessary callback wrapper ([d560348](https://github.com/foray1010/common-presets/commit/d560348b26180cd81fb01ced982935df70f23d9e))
|
|
11
|
+
- **eslint-config:** re-enable recommended [@typescript-eslint](https://github.com/typescript-eslint) rules ([4b46143](https://github.com/foray1010/common-presets/commit/4b461433b4ff2e3fe7ab909be7c9f6a42d7ccb5f))
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
- **eslint-config:** disable allowAutomaticSingleRunInference ([53b8265](https://github.com/foray1010/common-presets/commit/53b8265bfddf3736b2f13409e53ddbb2be346d32))
|
|
16
|
+
- **eslint-config:** disable allowAutomaticSingleRunInference ([ecb189c](https://github.com/foray1010/common-presets/commit/ecb189ce72c8185d7ad1cd44444463c5dd83b067))
|
|
17
|
+
|
|
18
|
+
## [7.5.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.4.1...@foray1010/eslint-config@7.5.0) (2022-09-28)
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
- **eslint-config:** prefer readonly types ([4996d63](https://github.com/foray1010/common-presets/commit/4996d63dc356ffd904ae931f2dbd32fd3312ec50))
|
|
23
|
+
|
|
6
24
|
## [7.4.1](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.4.0...@foray1010/eslint-config@7.4.1) (2022-09-23)
|
|
7
25
|
|
|
8
26
|
### Bug Fixes
|
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": "7.
|
|
4
|
+
"version": "7.6.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": {
|
|
@@ -23,28 +23,28 @@
|
|
|
23
23
|
"type:check": "tsc"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@foray1010/common-presets-utils": "^5.0.
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
28
|
-
"@typescript-eslint/parser": "^5.
|
|
26
|
+
"@foray1010/common-presets-utils": "^5.0.4",
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^5.38.1",
|
|
28
|
+
"@typescript-eslint/parser": "^5.38.1",
|
|
29
29
|
"confusing-browser-globals": "^1.0.10",
|
|
30
30
|
"eslint-config-prettier": "^8.3.0",
|
|
31
31
|
"eslint-plugin-compat": "^4.0.0",
|
|
32
32
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
33
|
+
"eslint-plugin-functional": "^4.4.0",
|
|
33
34
|
"eslint-plugin-import": "^2.22.1",
|
|
34
|
-
"eslint-plugin-jest": "^27.0.
|
|
35
|
+
"eslint-plugin-jest": "^27.0.4",
|
|
35
36
|
"eslint-plugin-jest-dom": "^4.0.0",
|
|
36
|
-
"eslint-plugin-jsdoc": "^39.
|
|
37
|
-
"eslint-plugin-n": "^15.
|
|
37
|
+
"eslint-plugin-jsdoc": "^39.3.6",
|
|
38
|
+
"eslint-plugin-n": "^15.3.0",
|
|
38
39
|
"eslint-plugin-prettier": "^4.0.0",
|
|
39
|
-
"eslint-plugin-react": "^7.
|
|
40
|
+
"eslint-plugin-react": "^7.31.8",
|
|
40
41
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
41
42
|
"eslint-plugin-simple-import-sort": "^8.0.0",
|
|
42
|
-
"eslint-plugin-testing-library": "^5.
|
|
43
|
+
"eslint-plugin-testing-library": "^5.7.0"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"@types/confusing-browser-globals": "1.0.0",
|
|
46
|
-
"@types/eslint": "8.4.6"
|
|
47
|
-
"typescript": "4.8.3"
|
|
47
|
+
"@types/eslint": "8.4.6"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"eslint": "^8.0.0",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "78887040561cbee1de447df3c885414f81cbefba"
|
|
60
60
|
}
|
package/presets/base.js
CHANGED
|
@@ -155,11 +155,15 @@ module.exports = {
|
|
|
155
155
|
parserOptions: {
|
|
156
156
|
// faster linting on cli
|
|
157
157
|
// https://github.com/typescript-eslint/typescript-eslint/issues/3528
|
|
158
|
-
|
|
158
|
+
// turned off because @typescript-eslint/no-unsafe-* rules will output wrong errors
|
|
159
|
+
// allowAutomaticSingleRunInference: true,
|
|
159
160
|
project: ['./tsconfig*.json', './packages/*/tsconfig*.json'],
|
|
160
161
|
sourceType: 'module',
|
|
161
162
|
},
|
|
162
|
-
plugins: [
|
|
163
|
+
plugins: [
|
|
164
|
+
'@typescript-eslint/eslint-plugin',
|
|
165
|
+
'eslint-plugin-functional',
|
|
166
|
+
],
|
|
163
167
|
rules: {
|
|
164
168
|
// extend existing rule
|
|
165
169
|
'@typescript-eslint/ban-types': [
|
|
@@ -201,16 +205,6 @@ module.exports = {
|
|
|
201
205
|
'error',
|
|
202
206
|
{ checksVoidReturn: false },
|
|
203
207
|
],
|
|
204
|
-
// many false alarms
|
|
205
|
-
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
206
|
-
// some third party packages doesn't offer typings
|
|
207
|
-
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
208
|
-
// some third party packages doesn't offer typings
|
|
209
|
-
'@typescript-eslint/no-unsafe-call': 'off',
|
|
210
|
-
// some third party packages doesn't offer typings
|
|
211
|
-
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
212
|
-
// some third party packages doesn't offer typings
|
|
213
|
-
'@typescript-eslint/no-unsafe-return': 'off',
|
|
214
208
|
// do not block functions referring to other functions
|
|
215
209
|
'@typescript-eslint/no-use-before-define': [
|
|
216
210
|
'error',
|
|
@@ -229,8 +223,9 @@ module.exports = {
|
|
|
229
223
|
typedefs: false,
|
|
230
224
|
},
|
|
231
225
|
],
|
|
232
|
-
//
|
|
233
|
-
|
|
226
|
+
// use with functional/prefer-readonly-type
|
|
227
|
+
// mark class variables as readonly if it is not mutated
|
|
228
|
+
'@typescript-eslint/prefer-readonly': 'error',
|
|
234
229
|
// allow primitive value in template string
|
|
235
230
|
'@typescript-eslint/restrict-template-expressions': [
|
|
236
231
|
'error',
|
|
@@ -247,6 +242,20 @@ module.exports = {
|
|
|
247
242
|
'error',
|
|
248
243
|
{ ignoreStatic: true },
|
|
249
244
|
],
|
|
245
|
+
// use with @typescript-eslint/prefer-readonly
|
|
246
|
+
'functional/prefer-readonly-type': [
|
|
247
|
+
'error',
|
|
248
|
+
{
|
|
249
|
+
// sometimes it is easier to mutate, it should be fine to mutate within local scope
|
|
250
|
+
allowLocalMutation: true,
|
|
251
|
+
// don't force library consumer to use readonly type
|
|
252
|
+
allowMutableReturnType: true,
|
|
253
|
+
// allow mutating class variables
|
|
254
|
+
ignoreClass: 'fieldsOnly',
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
// forbid unnecessary callback wrapper
|
|
258
|
+
'functional/prefer-tacit': 'error',
|
|
250
259
|
},
|
|
251
260
|
overrides: [
|
|
252
261
|
{
|