eslint-config-beslogic 2.4.14 → 3.0.2

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/.eslintrc.js CHANGED
@@ -8,14 +8,14 @@ module.exports = {
8
8
  "extends": [
9
9
  "./node-js",
10
10
  "plugin:eslint-plugin/all",
11
- "./dprint",
11
+ "./stylistic", // For the sake of testing
12
12
  "./json-like"
13
13
  ],
14
14
  "parserOptions": {
15
15
  "sourceType": "script"
16
16
  },
17
17
  "rules": {
18
- "max-len": "off",
18
+ "@stylistic/max-len": "off",
19
19
  "max-lines": "off",
20
20
  // We're a script project, using the console is fine
21
21
  // (same config as in jest)
@@ -35,6 +35,10 @@ module.exports = {
35
35
  {
36
36
  "case": "kebabCase"
37
37
  }
38
- ]
38
+ ],
39
+
40
+ // Conflicts with dprint's bracePosition = sameLineUnlessHanging
41
+ "@stylistic/brace-style": "off",
42
+ "@stylistic/indent": "off"
39
43
  }
40
44
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,85 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.2
4
+
5
+ - Made `eslint-plugin-sonarjs` optional for pre-commit.ci contexts
6
+
7
+ ## 3.0.0
8
+
9
+ ### Important migration points
10
+
11
+ - Remove `eslint-plugin-unused-imports` from your pre-commit configs
12
+ - Uninstall `eslint-plugin-total-functions`
13
+ - Remove the `beslogic/dprint` preset. It no longer exists and is no longer needed
14
+ - If not using dprint, please add the `beslogic/stylistic` preset
15
+ - If you prefered stricter linting, add `beslogic/extra-strict` to your presets
16
+ - If you have ``parserOptions.project` configured, try removing it.
17
+ - If you only have `tsconfig.json` files and no complex `tsconfig.*.json`, you can also try this instead:
18
+
19
+ ```js
20
+ /** @type {import("eslint").Linter.Config} */
21
+ module.exports = {
22
+ parserOptions: {
23
+ projectService: {
24
+ allowDefaultProject: []
25
+ },
26
+ // Still needed for plugins that haven't updated to typescript-eslint@8 yet
27
+ // Namely: eslint-plugin-sonarjs
28
+ EXPERIMENTAL_useProjectService: true
29
+ }
30
+ }
31
+ ```
32
+
33
+ `eslint-plugin-sonarjs@2` added a ton of rules, a lot of which duplicates base ESLint rules and other plugins we have. _**Please report those you find**_
34
+
35
+ ### Changes
36
+
37
+ #### Provided an `extra-strict` preset
38
+
39
+ - Removed `eslint-plugin-total-functions`
40
+ - Replaced rule `total-functions/no-unsafe-type-assertion` with a configured `no-autofix/@typescript-eslint/consistent-type-assertions` in the new `extra-strict` addon preset that warns on any non-param, non-unknown object cast
41
+ - Disabled `@typescript-eslint/no-invalid-this` in the `extra-strict` addon preset as we assume `"noImplicitThis": true`
42
+ - Moved the following rules to a new `extra-strict` addon preset:
43
+ - `@typescript-eslint/no-unnecessary-boolean-literal-compare`
44
+ - `@typescript-eslint/no-unnecessary-condition`
45
+ - `@typescript-eslint/prefer-nullish-coalescing`
46
+ - `etc/no-enum`
47
+ - `no-autofix/@angular-eslint/template/i18n`
48
+ - The `typescript` preset should now work with `"strict": false` in `tsconfig.json`
49
+ - Enabled rule `arrow-body-style` to disallow using "immediate returns" in arrow functions
50
+ - Moved the `etc/no-commented-out-code` rule to the `extra-strict` preset
51
+
52
+ #### Updated to typescript-eslint v8
53
+
54
+ - Bumped `typescript-eslint` to `^8.0`
55
+ - Enabled `typescript-eslint`'s [Project Service](https://typescript-eslint.io/blog/announcing-typescript-eslint-v8#project-service). Replacing `settings.parserOptions.project = [...]` and `settings.parserOptions.deprecated__createDefaultProgram = true` in `typescript` and `angular` presets with `settings.parserOptions.projectService = true`
56
+ - Enabled `allowRegExp` for `restrict-template-expressions`
57
+ - As of `typescript-eslint@8.6`: `Error`, `URL` and `URLSearchParams` are also allowed by default (see <https://typescript-eslint.io/rules/restrict-template-expressions/#allow>)
58
+ - Stopped using `@babel/eslint-parser` by default for Javascript presets. TypeScript projects will use the TypeScript parser from the typescript preset. Scripts don't use Babel. And we don't expect pure-JS projects to use experimental features (if they do, they can configure `@babel/eslint-parser` themselves).
59
+ - Bumped `eslint-plugin-jest` to `^28.7`
60
+ - Removed the `dprint` preset. Those stylistic rules are simply no longer enabled by default
61
+ - Created a new preset `stylistic` to allow re-enabling rules taken care of by dprint
62
+ - Migrated lots of rules from ESLint, typescript-eslint and eslint-plugin-autofix to ESLint Stylistic
63
+
64
+ #### Various
65
+
66
+ - Bumped `dprint` to `^0.47.2` to autodiscover `.dprint.jsonc`
67
+ - Bumped the minimal EcmaScript version to 2022 in ESLint and TSConfig settings
68
+ - `.eslintrc.mjs` is now treated the same as `.eslintrc.js` and `.eslintrc.cjs`
69
+ - Bumped `eslint-plugin-no-autofix` to `^2.0`
70
+ - Dropped support for node 17
71
+ - Bumped `eslint-plugin-sonarjs` to `^2.0`
72
+ - This adds a ton of rules, including some duplicating base ESLint rules and other plugins we have. _**Please report those you find**_
73
+ - Trying out replacing the `eslint-plugin-unused-imports` plugin by `sonarjs/unused-import` rule
74
+ - Bumped `eslint-plugin-import` to `^2.30` which fixes `import/newline-after-import`'s `considerComments`+`exactCount`
75
+ - Allow single-line ternary when they fit on a single line
76
+ - Update the `operator-linebreak` rule to put the operator in front (along with an update to dprint's `operatorPosition`). Both of which default to left-side and we now aggree more with. This also aligns with our Ruff preset
77
+ - Re-enabled `react/jsx-no-leaked-render` in TypeScript (TSX) files
78
+ - Disabled crashing rules from Cartant: `rxjs/no-implicit-any-catch` and `etc/throw-error`. Please upvote:
79
+ - <https://github.com/cartant/eslint-plugin-etc/issues/47>
80
+ - <https://github.com/cartant/eslint-plugin-rxjs/issues/122>
81
+ - <https://github.com/cartant/eslint-plugin-rxjs/issues/132>
82
+
3
83
  ## 2.4.14
4
84
 
5
85
  - Updated pre-commit.ci documentation
package/README.md CHANGED
@@ -2,9 +2,7 @@
2
2
 
3
3
  ## Installation and usage
4
4
 
5
- Run `npm i --save-dev eslint-config-beslogic`\
6
- For extra strict TypeScript linting, you can also install [eslint-plugin-total-functions](https://www.npmjs.com/package/eslint-plugin-total-functions): `npm i --save-dev eslint-plugin-total-functions`\
7
- The installation will be automatically detected and configured.
5
+ Run `npm i --save-dev eslint-config-beslogic`
8
6
 
9
7
  Depending on your needs, you will need to also install other peer dependencies for linting.
10
8
 
@@ -19,15 +17,7 @@ These are configuration files you'll have to update manually to best work with t
19
17
 
20
18
  ### `package.json`
21
19
 
22
- Add the following `scripts`:
23
-
24
- ```json
25
- "scripts": {
26
- "eslint": "eslint ./ --ignore-path .gitignore",
27
- "lint": "dprint check && npm run eslint",
28
- "lint:fix": "dprint fmt && npm run eslint -- --fix"
29
- },
30
- ```
20
+ Read the [`package.json`](https://github.com/BesLogic/shared-configs#packagejson-for-dprint-and-eslint) section of our Shared Configs for one-liner shortcut scripts you can use.
31
21
 
32
22
  ### Base `tsconfig.json`
33
23
 
@@ -47,17 +37,15 @@ Extend the following in your base `tsconfig.json` (follow link for more details)
47
37
 
48
38
  "No Unchecked Indexed Access" makes index accesses even stricter. You may not want it in your project or in your tests. You can disable it with `"compilerOptions": { "noUncheckedIndexedAccess": false }`.
49
39
 
50
- If deploying / bundling with an Angular npm package, also set `angularCompilerOptions": { "strictMetadataEmit": true }`
40
+ If deploying / bundling with an Angular npm package, also set `angularCompilerOptions": { "strictMetadataEmit": true }`.
51
41
 
52
42
  ### `.vscode/settings.json` and `.vscode/extensions.json`
53
43
 
54
- <!-- Keep in sync with https://dev.azure.com/Beslogic/Beslogic%20Architecture%20Reference/_wiki/wikis/Beslogic-Architecture-Reference.wiki/757/VSCode-settings-and-extensions-(.vscode-.code-workspace) -->
55
-
56
- Read and copy from [VSCode Settings and Extensions](https://socket.dev/npm/package/eslint-config-beslogic/files/latest/.vscode)
44
+ Read and copy the sections for the languages you use from [BesLogic/shared-configs/.vscode](https://github.com/BesLogic/shared-configs/tree/main/.vscode).
57
45
 
58
- ### `dprint.json`
46
+ ### `.dprint.jsonc`
59
47
 
60
- If using the [`beslogic/dprint` preset](#beslogicdprint), use the following:
48
+ Extend the following in your base `.dprint.jsonc` (follow link for more details):
61
49
 
62
50
  ```jsonc
63
51
  {
@@ -103,22 +91,29 @@ As you'll easily bust the 250MiB limit on the free tier, omit the following depe
103
91
 
104
92
  - `dprint`
105
93
  - `@eslint-community/eslint-plugin-eslint-comments`
106
- - `eslint-import-resolver-typescript`
107
- - `eslint-plugin-total-functions`
108
94
  - `esling-plugin-no-autofix`
109
- - `eslint-plugin-testing-library`
95
+ - `eslint-import-resolver-typescript`
96
+ - `eslint-plugin-etc`
110
97
  - `eslint-plugin-jest-formatting`
111
98
  - `eslint-plugin-jest`
112
- - `eslint-plugin-etc`
113
-
114
- If using TypeScript, in your ESLint config, you'll _have to_ use the experimental project service, or you'll run into OOM issues:
99
+ - `eslint-plugin-sonarjs`
100
+ - `eslint-plugin-testing-library`
115
101
 
116
- ```json
117
- "parser": "@typescript-eslint/parser",
118
- "parserOptions": {
119
- // Experimental, but causes pre-commit to actually find the project and avoids OOM
120
- "EXPERIMENTAL_useProjectService": true,
121
- },
102
+ If using TypeScript and pre-commit.ci, in your ESLint config you'll _have to_ use the project service, or you'll run into OOM issues:
103
+
104
+ ```js
105
+ /** @type {import("eslint").Linter.Config} */
106
+ module.exports = {
107
+ parser: "@typescript-eslint/parser",
108
+ parserOptions: {
109
+ projectService: {
110
+ allowDefaultProject: []
111
+ },
112
+ // Still needed for plugins that haven't updated to typescript-eslint@8 yet
113
+ // Namely: eslint-plugin-sonarjs
114
+ EXPERIMENTAL_useProjectService: true
115
+ }
116
+ }
122
117
  ```
123
118
 
124
119
  ## Patched packages
@@ -159,8 +154,7 @@ Basic TypeScript-specific configs and `TSX` support, is extended by all other Ty
159
154
 
160
155
  For the linting to be fully effective, please make sure that your base `tsconfig.json` extends `eslint-config-beslogic/tsconfig.X.X.json` (see [Parallel configurations](#parallel-configurations)).
161
156
 
162
- For extra strict TypeScript linting, you can also install [eslint-plugin-total-functions](https://www.npmjs.com/package/eslint-plugin-total-functions): `npm i --save-dev eslint-plugin-total-functions`\
163
- The installation will be automatically detected and configured.
157
+ If you want extra strict linting, consider adding the [`beslogic/extra-strict` preset](#beslogicextra-strict).
164
158
 
165
159
  ### `beslogic/node-js`
166
160
 
@@ -246,15 +240,21 @@ Add the following `devDependencies` to your `package.json`:
246
240
  npm install --save-dev eslint-plugin-storybook
247
241
  ```
248
242
 
249
- ## Stylistic Presets
243
+ ## Stylistic and pedantic Presets
250
244
 
251
245
  If used, these presets should always come last, in this specific order.
252
246
 
253
- ### `beslogic/dprint`
247
+ ### `beslogic/extra-strict`
248
+
249
+ Enables extra-strict rules for `beslogic/typescript` and `beslogic/angular`, and forces that your `tsconfig.json` is strictly configured.
250
+
251
+ ### `beslogic/stylistic`
254
252
 
255
- Disables all stylistic rules that are taken care of by [dprint](https://dprint.dev/plugins/typescript/).
253
+ Enables stylistic rules that would be taken care of by [dprint](https://dprint.dev/plugins/typescript/). Please read [What About Formatting?](https://typescript-eslint.io/users/what-about-formatting/)
256
254
 
257
- You must also extend the base configuration in a `dprint.json` file (see [Parallel configurations](#parallel-configurations)).
255
+ We don't recommend using this preset, and to use dprint instead (see [Parallel configurations](#parallel-configurations)).
256
+
257
+ But if for some reason, `dprint` isn't an option for you, this preset follows our standards using ESLint.
258
258
 
259
259
  ### `beslogic/json-like`
260
260
 
@@ -263,3 +263,13 @@ Enforces stylistic rules for JS objects to look like valid JSON objects.
263
263
  ## Changelog
264
264
 
265
265
  You can view the changelog under the [Code Tab](https://www.npmjs.com/package/eslint-config-beslogic?activeTab=code), or at <https://socket.dev/npm/package/eslint-config-beslogic/files/latest/CHANGELOG.md>
266
+
267
+ <!-- (keep this section hidden from public README)
268
+ ## Dev testing:
269
+
270
+ To test updates to ESLint-Config-Beslogic in other existing projects:
271
+ 1. At the root of this repo, run `npm i` then `npm run yalc`
272
+ 2. In the target project, run `npm i --save-dev yalc` then `yalc add eslint-config-beslogic`
273
+ 3. Update the project's .eslintrc config file as needed
274
+ 4. Run your linting
275
+ -->
@@ -0,0 +1,175 @@
1
+ // These are the rules I haven't yet validated if they duplicate existing rules
2
+ {
3
+ "sonarjs/alt-text": "error",
4
+ "sonarjs/anchor-has-content": "error",
5
+ "sonarjs/anchor-is-valid": "error",
6
+ "sonarjs/anchor-precedence": "error",
7
+ "sonarjs/argument-type": "error",
8
+ "sonarjs/arguments-order": "error",
9
+ "sonarjs/array-callback-without-return": "error",
10
+ "sonarjs/assertions-in-tests": "error",
11
+ "sonarjs/bitwise-operators": "error",
12
+ "sonarjs/call-argument-line": "error",
13
+ "sonarjs/certificate-transparency": "error",
14
+ "sonarjs/chai-determinate-assertion": "error",
15
+ "sonarjs/class-name": "error",
16
+ "sonarjs/code-eval": "error",
17
+ "sonarjs/comma-or-logical-or-case": "error",
18
+ "sonarjs/confidential-information-logging": "error",
19
+ "sonarjs/content-length": "error",
20
+ "sonarjs/content-security-policy": "error",
21
+ "sonarjs/cookie-no-httponly": "error",
22
+ "sonarjs/cors": "error",
23
+ "sonarjs/csrf": "error",
24
+ "sonarjs/different-types-comparison": "error",
25
+ "sonarjs/disabled-auto-escaping": "error",
26
+ "sonarjs/disabled-resource-integrity": "error",
27
+ "sonarjs/disabled-timeout": "error",
28
+ "sonarjs/encryption-secure-mode": "error",
29
+ "sonarjs/file-permissions": "error",
30
+ "sonarjs/file-uploads": "error",
31
+ "sonarjs/fixme-tag": "error",
32
+ "sonarjs/for-loop-increment-sign": "error",
33
+ "sonarjs/frame-ancestors": "error",
34
+ "sonarjs/function-inside-loop": "error",
35
+ "sonarjs/future-reserved-words": "error",
36
+ "sonarjs/generator-without-yield": "error",
37
+ "sonarjs/hashing": "error",
38
+ "sonarjs/hidden-files": "error",
39
+ "sonarjs/html-has-lang": "error",
40
+ "sonarjs/in-operator-type-error": "error",
41
+ "sonarjs/inconsistent-function-call": "error",
42
+ "sonarjs/index-of-compare-to-positive-number": "error",
43
+ "sonarjs/insecure-cookie": "error",
44
+ "sonarjs/insecure-jwt-token": "error",
45
+ "sonarjs/inverted-assertion-arguments": "error",
46
+ "sonarjs/label-has-associated-control": "error",
47
+ "sonarjs/label-position": "error",
48
+ "sonarjs/link-with-target-blank": "error",
49
+ "sonarjs/max-switch-cases": "error",
50
+ "sonarjs/media-has-caption": "error",
51
+ "sonarjs/misplaced-loop-counter": "error",
52
+ "sonarjs/mouse-events-a11y": "error",
53
+ "sonarjs/new-cap": "error",
54
+ "sonarjs/new-operator-misuse": "error",
55
+ "sonarjs/no-accessor-field-mismatch": "error",
56
+ "sonarjs/no-all-duplicated-branches": "error",
57
+ "sonarjs/no-alphabetical-sort": "error",
58
+ "sonarjs/no-angular-bypass-sanitization": "error",
59
+ "sonarjs/no-array-delete": "error",
60
+ "sonarjs/no-associative-arrays": "error",
61
+ "sonarjs/no-async-constructor": "error",
62
+ "sonarjs/no-base-to-string": "error",
63
+ "sonarjs/no-case-label-in-switch": "error",
64
+ "sonarjs/no-clear-text-protocols": "error",
65
+ "sonarjs/no-code-after-done": "error",
66
+ "sonarjs/no-collection-size-mischeck": "error",
67
+ "sonarjs/no-dead-store": "error",
68
+ "sonarjs/no-duplicate-in-composite": "error",
69
+ "sonarjs/no-duplicated-branches": "error",
70
+ "sonarjs/no-element-overwrite": "error",
71
+ "sonarjs/no-empty-after-reluctant": "error",
72
+ "sonarjs/no-empty-collection": "error",
73
+ "sonarjs/no-empty-test-file": "error",
74
+ "sonarjs/no-equals-in-for-termination": "error",
75
+ "sonarjs/no-exclusive-tests": "error",
76
+ "sonarjs/no-extra-arguments": "error",
77
+ "sonarjs/no-global-this": "error",
78
+ "sonarjs/no-globals-shadowing": "error",
79
+ "sonarjs/no-gratuitous-expressions": "error",
80
+ "sonarjs/no-hardcoded-credentials": "error",
81
+ "sonarjs/no-hardcoded-ip": "error",
82
+ "sonarjs/no-identical-conditions": "error",
83
+ "sonarjs/no-identical-expressions": "error",
84
+ "sonarjs/no-identical-functions": "error",
85
+ "sonarjs/no-ignored-exceptions": "error",
86
+ "sonarjs/no-ignored-return": "error",
87
+ "sonarjs/no-implicit-global": "error",
88
+ "sonarjs/no-in-misuse": "error",
89
+ "sonarjs/no-incomplete-assertions": "error",
90
+ "sonarjs/no-infinite-loop": "error",
91
+ "sonarjs/no-internal-api-use": "error",
92
+ "sonarjs/no-intrusive-permissions": "error",
93
+ "sonarjs/no-invalid-await": "error",
94
+ "sonarjs/no-invariant-returns": "error",
95
+ "sonarjs/no-inverted-boolean-check": "error",
96
+ "sonarjs/no-ip-forward": "error",
97
+ "sonarjs/no-labels": "error",
98
+ "sonarjs/no-literal-call": "error",
99
+ "sonarjs/no-mime-sniff": "error",
100
+ "sonarjs/no-misleading-array-reverse": "error",
101
+ "sonarjs/no-mixed-content": "error",
102
+ "sonarjs/no-nested-assignment": "error",
103
+ "sonarjs/no-nested-functions": "error",
104
+ "sonarjs/no-nested-template-literals": "error",
105
+ "sonarjs/no-one-iteration-loop": "error",
106
+ "sonarjs/no-parameter-reassignment": "error",
107
+ "sonarjs/no-primitive-wrappers": "error",
108
+ "sonarjs/no-redundant-assignments": "error",
109
+ "sonarjs/no-redundant-boolean": "error",
110
+ "sonarjs/no-redundant-jump": "error",
111
+ "sonarjs/no-redundant-optional": "error",
112
+ "sonarjs/no-referrer-policy": "error",
113
+ "sonarjs/no-same-argument-assert": "error",
114
+ "sonarjs/no-same-line-conditional": "error",
115
+ "sonarjs/no-selector-parameter": "error",
116
+ "sonarjs/no-self-compare": "error",
117
+ "sonarjs/no-self-import": "error",
118
+ "sonarjs/no-skipped-test": "error",
119
+ "sonarjs/no-small-switch": "error",
120
+ "sonarjs/no-table-as-layout": "error",
121
+ "sonarjs/no-try-promise": "error",
122
+ "sonarjs/no-undefined-argument": "error",
123
+ "sonarjs/no-unenclosed-multiline-block": "error",
124
+ "sonarjs/no-unsafe-unzip": "error",
125
+ "sonarjs/no-unthrown-error": "error",
126
+ "sonarjs/no-unused-collection": "error",
127
+ "sonarjs/no-use-of-empty-return-value": "error",
128
+ "sonarjs/no-useless-call": "error",
129
+ "sonarjs/no-useless-constructor": "error",
130
+ "sonarjs/no-useless-increment": "error",
131
+ "sonarjs/no-useless-intersection": "error",
132
+ "sonarjs/no-vue-bypass-sanitization": "error",
133
+ "sonarjs/no-weak-cipher": "error",
134
+ "sonarjs/no-weak-keys": "error",
135
+ "sonarjs/non-existent-operator": "error",
136
+ "sonarjs/null-dereference": "error",
137
+ "sonarjs/object-alt-content": "error",
138
+ "sonarjs/os-command": "error",
139
+ "sonarjs/post-message": "error",
140
+ "sonarjs/prefer-default-last": "error",
141
+ "sonarjs/prefer-for-of": "error",
142
+ "sonarjs/prefer-function-type": "error",
143
+ "sonarjs/prefer-namespace-keyword": "error",
144
+ "sonarjs/prefer-promise-shorthand": "error",
145
+ "sonarjs/prefer-single-boolean-return": "error",
146
+ "sonarjs/prefer-type-guard": "error",
147
+ "sonarjs/prefer-while": "error",
148
+ "sonarjs/production-debug": "error",
149
+ "sonarjs/pseudo-random": "error",
150
+ "sonarjs/public-static-readonly": "error",
151
+ "sonarjs/publicly-writable-directories": "error",
152
+ "sonarjs/reduce-initial-value": "error",
153
+ "sonarjs/redundant-type-aliases": "error",
154
+ "sonarjs/regex-complexity": "error",
155
+ "sonarjs/session-regeneration": "error",
156
+ "sonarjs/sql-queries": "error",
157
+ "sonarjs/stable-tests": "error",
158
+ "sonarjs/stateful-regex": "error",
159
+ "sonarjs/strict-transport-security": "error",
160
+ "sonarjs/super-invocation": "error",
161
+ "sonarjs/table-header-reference": "error",
162
+ "sonarjs/table-header": "error",
163
+ "sonarjs/test-check-exception": "error",
164
+ "sonarjs/unnecessary-character-escapes": "error",
165
+ "sonarjs/unused-named-groups": "error",
166
+ "sonarjs/unverified-certificate": "error",
167
+ "sonarjs/unverified-hostname": "error",
168
+ "sonarjs/updated-const-var": "error",
169
+ "sonarjs/updated-loop-counter": "error",
170
+ "sonarjs/use-type-alias": "error",
171
+ "sonarjs/void-use": "error",
172
+ "sonarjs/weak-ssl": "error",
173
+ "sonarjs/x-powered-by": "error",
174
+ "sonarjs/xml-parser-xxe": "error"
175
+ }
package/angular.js CHANGED
@@ -35,8 +35,8 @@ const noRestrictedSyntax = [
35
35
  "selector":
36
36
  "PropertyDefinition[definite=true]:not(:has(Decorator[expression.callee.name=\"Input\"] Property[key.name=\"required\"][value.value=true]))",
37
37
  "message":
38
- "Forbidden non-null property assertion. https://typescript-eslint.io/rules/no-non-null-assertion . " +
39
- "This is only allowed on required component @Input({ required:true }). https://angular.io/api/core/Input#required"
38
+ "Forbidden non-null property assertion. https://typescript-eslint.io/rules/no-non-null-assertion . "
39
+ + "This is only allowed on required component @Input({ required:true }). https://angular.io/api/core/Input#required"
40
40
  },
41
41
  {
42
42
  "selector":
@@ -55,6 +55,10 @@ const typeDefinitionOverride = typescriptConfig
55
55
  .overrides
56
56
  ?.find(override => override.files === "*.d.ts")
57
57
 
58
+ const noAutofixRreferArrowFunctionsConfig = javascriptConfig
59
+ .rules
60
+ ?.["no-autofix/prefer-arrow/prefer-arrow-functions"]
61
+ ?.[1]
58
62
  const preferArrowFunctionsConfig = javascriptConfig
59
63
  .rules
60
64
  ?.["prefer-arrow/prefer-arrow-functions"]
@@ -118,53 +122,8 @@ module.exports = {
118
122
  // and it was added in 14.2.0. Not enforcing it for now allows a wider range of versions.
119
123
  // It's kind of annoying to deal with without autofixes anyway.
120
124
  "no-autofix/@angular-eslint/template/attributes-order": "off",
125
+ // Don't autofix as these should be handled manually, also configured in extra-strict preset
121
126
  "@angular-eslint/template/i18n": "off",
122
- "no-autofix/@angular-eslint/template/i18n": [
123
- // Too many TODO and needs per-project extensions to justify this as "error"
124
- hasNoAutofix
125
- ? "warn"
126
- : "off",
127
- {
128
- // NOTE: doesn't work for text elements.
129
- // See: https://github.com/angular-eslint/angular-eslint/issues/999
130
- "boundTextAllowedPattern": "EmPassion",
131
- "ignoreTags": [
132
- // NOTE: Asked for those to be added in the base library
133
- // See: https://github.com/angular-eslint/angular-eslint/issues/997
134
- "meta",
135
- "link",
136
- "title",
137
- "mat-drawer",
138
- "mat-icon",
139
- "ng-container",
140
- ":svg:polygon"
141
- ],
142
- "ignoreAttributes": [
143
- // NOTE: Asked for those to be added in the base library
144
- // See: https://github.com/angular-eslint/angular-eslint/issues/997
145
- "img[ngSrc]",
146
- "input[accept]",
147
- "cdkColumnDef",
148
- "mat-accordion[displayMode]",
149
- "mat-dialog-actions[align]",
150
- "mat-form-field[appearance]",
151
- "mat-form-field[floatLabel]",
152
- "matTooltipPosition",
153
- "panelClass",
154
- // Our extended configs for non-Angular component
155
- "data-testid",
156
- "ion-input[autocapitalize]",
157
- "ion-input[autofocus]",
158
- "ion-input[enterkeyhint]",
159
- "ion-input[inputmode]",
160
- "ion-input[labelPlacement]",
161
- "ion-select[interface]",
162
- "mtxTooltipClass",
163
- "size",
164
- "slot"
165
- ]
166
- }
167
- ],
168
127
  // This constantly requires wrapping images in an additional div or knowing the exact display size.
169
128
  // Doesn't support relative sizing either, not sure if worth even trying to enforce.
170
129
  "@angular-eslint/template/prefer-ngsrc": "off",
@@ -187,21 +146,12 @@ module.exports = {
187
146
  "plugin:@angular-eslint/template/process-inline-templates"
188
147
  ],
189
148
  "parserOptions": {
190
- // TODO: Try "project": true https://typescript-eslint.io/blog/parser-options-project-true/
191
- // This wouldn't work for tsconfig.spec.ts though
192
- // https://typescript-eslint.io/blog/parser-options-project-true/#investigating-custom-tsconfig-names
193
- // https://github.com/typescript-eslint/typescript-eslint/issues/7383#issuecomment-2073032501
194
- // TODO: even better, try: https://typescript-eslint.io/packages/parser/#experimental_useprojectservice
195
- // "EXPERIMENTAL_useProjectService": true,
196
149
  "project": [
197
150
  "tsconfig?(.*).json",
198
- "projects/*/tsconfig?(.*).json",
199
- "*/tsconfig?(.*).json" // For example: e2e/tsconfig.json
151
+ "**/tsconfig?(.*).json" // For example: e2e/tsconfig.json
200
152
  ],
201
- // TODO: Consider use a tsconfig.eslint.json instead
202
- // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/README.md#parseroptionscreatedefaultprogram
203
- "deprecated__createDefaultProgram": true,
204
153
  // Needed specifically for @typescript-eslint/consistent-type-imports
154
+ // https://typescript-eslint.io/rules/consistent-type-imports/#caveat-decorators--experimentaldecorators-true--emitdecoratormetadata-true
205
155
  "emitDecoratorMetadata": typescriptVersion >= 5
206
156
  },
207
157
  "rules": {
@@ -361,6 +311,14 @@ module.exports = {
361
311
  // https://github.com/bahmutov/eslint-rules/issues/54
362
312
  // TODO: consider https://github.com/jonaskello/eslint-plugin-functional/blob/HEAD/docs/rules/prefer-tacit.md
363
313
  "extra-rules/potential-point-free": "off",
314
+ "no-autofix/prefer-arrow/prefer-arrow-functions": [
315
+ "error",
316
+ {
317
+ ...noAutofixRreferArrowFunctionsConfig,
318
+ // https://github.com/TristonJ/eslint-plugin-prefer-arrow/issues/17
319
+ "classPropertiesAllowed": false
320
+ }
321
+ ],
364
322
  "prefer-arrow/prefer-arrow-functions": [
365
323
  "error",
366
324
  {