@foray1010/eslint-config 7.8.0 → 7.10.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 CHANGED
@@ -3,6 +3,23 @@
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.10.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.9.0...@foray1010/eslint-config@7.10.0) (2022-10-18)
7
+
8
+ ### Features
9
+
10
+ - **eslint-config:** do not allow usage of deprecated code ([ed21e5e](https://github.com/foray1010/common-presets/commit/ed21e5e671a67230453a682e9f80519bdcb0e551))
11
+ - **eslint-config:** encourage to use JS standard #private over TS private accessibility modifier ([5e913c8](https://github.com/foray1010/common-presets/commit/5e913c84e709a6d586fde790f122459170130a26))
12
+
13
+ ## [7.9.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.8.0...@foray1010/eslint-config@7.9.0) (2022-10-07)
14
+
15
+ ### Features
16
+
17
+ - use indexed syntax for accessing undefined fields ([7c1f9d6](https://github.com/foray1010/common-presets/commit/7c1f9d63349f0b34b00aa8608d6908763d964c3e))
18
+
19
+ ### Bug Fixes
20
+
21
+ - **eslint-config:** enforce accessibility modifier in constructor in TS ([7cb3f2b](https://github.com/foray1010/common-presets/commit/7cb3f2b9f5de215255b1a541bac3cc1bd731589c))
22
+
6
23
  ## [7.8.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.7.3...@foray1010/eslint-config@7.8.0) (2022-10-03)
7
24
 
8
25
  ### 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": "7.8.0",
4
+ "version": "7.10.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,12 +23,13 @@
23
23
  "type:check": "tsc"
24
24
  },
25
25
  "dependencies": {
26
- "@foray1010/common-presets-utils": "^5.0.4",
26
+ "@foray1010/common-presets-utils": "^5.1.0",
27
27
  "@typescript-eslint/eslint-plugin": "^5.38.1",
28
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
+ "eslint-plugin-deprecation": "^1.3.2",
32
33
  "eslint-plugin-eslint-comments": "^3.2.0",
33
34
  "eslint-plugin-functional": "^4.4.1",
34
35
  "eslint-plugin-import": "^2.22.1",
@@ -57,5 +58,5 @@
57
58
  "publishConfig": {
58
59
  "access": "public"
59
60
  },
60
- "gitHead": "728b8351b1895f7af4b9b476461f8a3fd6f34a60"
61
+ "gitHead": "95efcde57421305c554daf6fe3704e8abe10a000"
61
62
  }
package/presets/base.js CHANGED
@@ -178,6 +178,7 @@ module.exports = {
178
178
  },
179
179
  plugins: [
180
180
  '@typescript-eslint/eslint-plugin',
181
+ 'eslint-plugin-deprecation',
181
182
  'eslint-plugin-functional',
182
183
  ],
183
184
  env: {
@@ -201,15 +202,20 @@ module.exports = {
201
202
  'error',
202
203
  { prefer: 'type-imports' },
203
204
  ],
205
+ // disable the base rule as it can report incorrect errors, use @typescript-eslint/dot-notation instead
206
+ 'dot-notation': 'off',
207
+ // only allow indexed syntax (e.g. `obj['key']`) for accessing undefined fields
208
+ '@typescript-eslint/dot-notation': [
209
+ 'error',
210
+ {
211
+ allowIndexSignaturePropertyAccess: true,
212
+ },
213
+ ],
204
214
  // encourage to use private accessibility modifier
205
215
  '@typescript-eslint/explicit-member-accessibility': [
206
216
  'error',
207
217
  {
208
218
  accessibility: 'explicit',
209
- overrides: {
210
- // don't bother because it is always public
211
- constructors: 'off',
212
- },
213
219
  },
214
220
  ],
215
221
  // sometimes auto detect can provide a better and narrower type
@@ -262,6 +268,8 @@ module.exports = {
262
268
  'error',
263
269
  { ignoreStatic: true },
264
270
  ],
271
+ // do not allow usage of deprecated code
272
+ 'deprecation/deprecation': 'error',
265
273
  // use with @typescript-eslint/prefer-readonly
266
274
  'functional/prefer-readonly-type': [
267
275
  'error',
@@ -276,6 +284,16 @@ module.exports = {
276
284
  ],
277
285
  // forbid unnecessary callback wrapper
278
286
  'functional/prefer-tacit': 'error',
287
+ 'no-restricted-syntax': [
288
+ 'error',
289
+ {
290
+ // encourage to use JS standard #private over TS private accessibility modifier, but excluding constructor because it cannot be private in JS: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields#description
291
+ selector:
292
+ ':matches(PropertyDefinition, MethodDefinition)[accessibility="private"]:not([kind="constructor"])',
293
+ message:
294
+ 'Use #private instead (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields)',
295
+ },
296
+ ],
279
297
  // @typescript-eslint/eslint-plugin suggests to disable it: https://github.com/typescript-eslint/typescript-eslint/blob/2588e9ea55f78352fdd6ae92a306135aabb49a1a/docs/linting/TROUBLESHOOTING.md#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
280
298
  // It is disabled in recommended config but re-enabled here to enforce a subset of global variables that supported by both node.js and browsers
281
299
  'no-undef': 'error',