@foray1010/eslint-config 7.4.1 → 7.5.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 +6 -0
- package/package.json +12 -12
- package/presets/base.js +19 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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.5.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.4.1...@foray1010/eslint-config@7.5.0) (2022-09-28)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **eslint-config:** prefer readonly types ([4996d63](https://github.com/foray1010/common-presets/commit/4996d63dc356ffd904ae931f2dbd32fd3312ec50))
|
|
11
|
+
|
|
6
12
|
## [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
13
|
|
|
8
14
|
### 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.5.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": "32f909d569229f0358d66f7c8295a1d15e5c3de3"
|
|
60
60
|
}
|
package/presets/base.js
CHANGED
|
@@ -159,7 +159,10 @@ module.exports = {
|
|
|
159
159
|
project: ['./tsconfig*.json', './packages/*/tsconfig*.json'],
|
|
160
160
|
sourceType: 'module',
|
|
161
161
|
},
|
|
162
|
-
plugins: [
|
|
162
|
+
plugins: [
|
|
163
|
+
'@typescript-eslint/eslint-plugin',
|
|
164
|
+
'eslint-plugin-functional',
|
|
165
|
+
],
|
|
163
166
|
rules: {
|
|
164
167
|
// extend existing rule
|
|
165
168
|
'@typescript-eslint/ban-types': [
|
|
@@ -229,6 +232,9 @@ module.exports = {
|
|
|
229
232
|
typedefs: false,
|
|
230
233
|
},
|
|
231
234
|
],
|
|
235
|
+
// use with functional/prefer-readonly-type
|
|
236
|
+
// mark class variables as readonly if it is not mutated
|
|
237
|
+
'@typescript-eslint/prefer-readonly': 'error',
|
|
232
238
|
// fault alarms in 4.29.3
|
|
233
239
|
'@typescript-eslint/restrict-plus-operands': 'off',
|
|
234
240
|
// allow primitive value in template string
|
|
@@ -247,6 +253,18 @@ module.exports = {
|
|
|
247
253
|
'error',
|
|
248
254
|
{ ignoreStatic: true },
|
|
249
255
|
],
|
|
256
|
+
// use with @typescript-eslint/prefer-readonly
|
|
257
|
+
'functional/prefer-readonly-type': [
|
|
258
|
+
'error',
|
|
259
|
+
{
|
|
260
|
+
// sometimes it is easier to mutate, it should be fine to mutate within local scope
|
|
261
|
+
allowLocalMutation: true,
|
|
262
|
+
// don't force library consumer to use readonly type
|
|
263
|
+
allowMutableReturnType: true,
|
|
264
|
+
// allow mutating class variables
|
|
265
|
+
ignoreClass: 'fieldsOnly',
|
|
266
|
+
},
|
|
267
|
+
],
|
|
250
268
|
},
|
|
251
269
|
overrides: [
|
|
252
270
|
{
|