eslint-config-beslogic 2.4.13 → 3.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/.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,84 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ### Important migration points
6
+
7
+ - Remove `eslint-plugin-unused-imports` from your pre-commit configs
8
+ - Uninstall `eslint-plugin-total-functions`
9
+ - Remove the `beslogic/dprint` preset. It no longer exists and is no longer needed
10
+ - If not using dprint, please add the `beslogic/stylistic` preset
11
+ - If you prefered stricter linting, add `beslogic/extra-strict` to your presets
12
+ - If you have ``parserOptions.project` configured, try removing it.
13
+ - If you only have `tsconfig.json` files and no complex `tsconfig.*.json`, you can also try this instead:
14
+
15
+ ```js
16
+ module.exports = {
17
+ parserOptions: {
18
+ projectService: {
19
+ allowDefaultProject: []
20
+ },
21
+ // Still needed for plugins that haven't updated to typescript-eslint@8 yet
22
+ // Namely: eslint-plugin-sonarjs
23
+ EXPERIMENTAL_useProjectService: true
24
+ }
25
+ }
26
+ ```
27
+
28
+ `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**_
29
+
30
+ ### Changes
31
+
32
+ #### Provided an `extra-strict` preset
33
+
34
+ - Removed `eslint-plugin-total-functions`
35
+ - 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
36
+ - Disabled `@typescript-eslint/no-invalid-this` in the `extra-strict` addon preset as we assume `"noImplicitThis": true`
37
+ - Moved the following rules to a new `extra-strict` addon preset:
38
+ - `@typescript-eslint/no-unnecessary-boolean-literal-compare`
39
+ - `@typescript-eslint/no-unnecessary-condition`
40
+ - `@typescript-eslint/prefer-nullish-coalescing`
41
+ - `etc/no-enum`
42
+ - `no-autofix/@angular-eslint/template/i18n`
43
+ - The `typescript` preset should now work with `"strict": false` in `tsconfig.json`
44
+ - Enabled rule `arrow-body-style` to disallow using "immediate returns" in arrow functions
45
+ - Moved the `etc/no-commented-out-code` rule to the `extra-strict` preset
46
+
47
+ #### Updated to typescript-eslint v8
48
+
49
+ - Bumped `typescript-eslint` to `^8.0`
50
+ - 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`
51
+ - Enabled `allowRegExp` for `restrict-template-expressions`
52
+ - 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>)
53
+ - 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).
54
+ - Bumped `eslint-plugin-jest` to `^28.7`
55
+ - Removed the `dprint` preset. Those stylistic rules are simply no longer enabled by default
56
+ - Created a new preset `stylistic` to allow re-enabling rules taken care of by dprint
57
+ - Migrated lots of rules from ESLint, typescript-eslint and eslint-plugin-autofix to ESLint Stylistic
58
+
59
+ #### Various
60
+
61
+ - Bumped `dprint` to `^0.47.2` to autodiscover `.dprint.jsonc`
62
+ - Bumped the minimal EcmaScript version to 2022 in ESLint and TSConfig settings
63
+ - `.eslintrc.mjs` is now treated the same as `.eslintrc.js` and `.eslintrc.cjs`
64
+ - Bumped `eslint-plugin-no-autofix` to `^2.0`
65
+ - Dropped support for node 17
66
+ - Bumped `eslint-plugin-sonarjs` to `^2.0`
67
+ - This adds a ton of rules, including some duplicating base ESLint rules and other plugins we have. _**Please report those you find**_
68
+ - Trying out replacing the `eslint-plugin-unused-imports` plugin by `sonarjs/unused-import` rule
69
+ - Bumped `eslint-plugin-import` to `^2.30` which fixes `import/newline-after-import`'s `considerComments`+`exactCount`
70
+ - Allow single-line ternary when they fit on a single line
71
+ - 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
72
+ - Re-enabled `react/jsx-no-leaked-render` in TypeScript (TSX) files
73
+ - Disabled crashing rules from Cartant: `rxjs/no-implicit-any-catch` and `etc/throw-error`. Please upvote:
74
+ - <https://github.com/cartant/eslint-plugin-etc/issues/47>
75
+ - <https://github.com/cartant/eslint-plugin-rxjs/issues/122>
76
+ - <https://github.com/cartant/eslint-plugin-rxjs/issues/132>
77
+
78
+ ## 2.4.14
79
+
80
+ - Updated pre-commit.ci documentation
81
+
3
82
  ## 2.4.13
4
83
 
5
84
  - Made `eslint-import-resolver-typescript` optional since it can't correctly resolve our shared `tsconfig.json` when ran in pre-commit.ci
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
  {
@@ -75,9 +63,27 @@ If also using [`beslogic/json-like` preset](#beslogicjson-like) extend from `htt
75
63
 
76
64
  ### Usage with `pre-commit.ci` (`.pre-commit-config.yaml`)
77
65
 
78
- Use the following hook: <https://github.com/pre-commit/mirrors-eslint>
79
-
80
- Set `args: [--fix, --quiet]`.
66
+ <!-- Use the following hook: <https://github.com/pre-commit/mirrors-eslint>
67
+ Set `args: [--ignore-path, .gitignore, --fix, --quiet]`.\
68
+ For mono-repos, specify your frontend project: `args: [frontend_project, --ignore-path, frontend_project/.gitignore, --fix, --quiet]`.
69
+ -->
70
+
71
+ ```yaml
72
+ repos:
73
+ - repo: local
74
+ hooks:
75
+ - id: eslint
76
+ name: eslint
77
+ language: node
78
+ # To run at root
79
+ entry: npm run eslint -- --fix --quiet
80
+ # To run in specific project (for monorepos)
81
+ entry: bash -c 'cd frontend_project && npm run eslint -- --fix --quiet'
82
+ files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx
83
+ types: [file]
84
+ pass_filenames: false
85
+ additional_dependencies: [...]
86
+ ```
81
87
 
82
88
  In the `additional_dependencies` field, you'll need to include _all_ the plugins we use (copy this project's `dependencies` in `package.json`), as well as the optional plugins you need for yor presets.
83
89
 
@@ -86,21 +92,26 @@ As you'll easily bust the 250MiB limit on the free tier, omit the following depe
86
92
  - `dprint`
87
93
  - `@eslint-community/eslint-plugin-eslint-comments`
88
94
  - `eslint-import-resolver-typescript`
89
- - `eslint-plugin-total-functions`
90
95
  - `esling-plugin-no-autofix`
91
96
  - `eslint-plugin-testing-library`
92
97
  - `eslint-plugin-jest-formatting`
93
98
  - `eslint-plugin-jest`
94
99
  - `eslint-plugin-etc`
95
100
 
96
- If using TypeScript, in your ESLint config, you'll _have to_ use the experimental project service, or you'll run into OOM issues:
97
-
98
- ```json
99
- "parser": "@typescript-eslint/parser",
100
- "parserOptions": {
101
- // Experimental, but causes pre-commit to actually find the project and avoids OOM
102
- "EXPERIMENTAL_useProjectService": true,
103
- },
101
+ 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:
102
+
103
+ ```js
104
+ module.exports = {
105
+ parser: "@typescript-eslint/parser",
106
+ parserOptions: {
107
+ projectService: {
108
+ allowDefaultProject: []
109
+ },
110
+ // Still needed for plugins that haven't updated to typescript-eslint@8 yet
111
+ // Namely: eslint-plugin-sonarjs
112
+ EXPERIMENTAL_useProjectService: true
113
+ }
114
+ }
104
115
  ```
105
116
 
106
117
  ## Patched packages
@@ -141,8 +152,7 @@ Basic TypeScript-specific configs and `TSX` support, is extended by all other Ty
141
152
 
142
153
  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)).
143
154
 
144
- 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`\
145
- The installation will be automatically detected and configured.
155
+ If you want extra strict linting, consider adding the [`beslogic/extra-strict` preset](#beslogicextra-strict).
146
156
 
147
157
  ### `beslogic/node-js`
148
158
 
@@ -228,15 +238,21 @@ Add the following `devDependencies` to your `package.json`:
228
238
  npm install --save-dev eslint-plugin-storybook
229
239
  ```
230
240
 
231
- ## Stylistic Presets
241
+ ## Stylistic and pedantic Presets
232
242
 
233
243
  If used, these presets should always come last, in this specific order.
234
244
 
235
- ### `beslogic/dprint`
245
+ ### `beslogic/extra-strict`
246
+
247
+ Enables extra-strict rules for `beslogic/typescript` and `beslogic/angular`, and forces that your `tsconfig.json` is strictly configured.
248
+
249
+ ### `beslogic/stylistic`
236
250
 
237
- Disables all stylistic rules that are taken care of by [dprint](https://dprint.dev/plugins/typescript/).
251
+ 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/)
238
252
 
239
- You must also extend the base configuration in a `dprint.json` file (see [Parallel configurations](#parallel-configurations)).
253
+ We don't recommend using this preset, and to use dprint instead (see [Parallel configurations](#parallel-configurations)).
254
+
255
+ But if for some reason, `dprint` isn't an option for you, this preset follows our standards using ESLint.
240
256
 
241
257
  ### `beslogic/json-like`
242
258
 
@@ -245,3 +261,13 @@ Enforces stylistic rules for JS objects to look like valid JSON objects.
245
261
  ## Changelog
246
262
 
247
263
  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>
264
+
265
+ <!-- (keep this section hidden from public README)
266
+ ## Dev testing:
267
+
268
+ To test updates to ESLint-Config-Beslogic in other existing projects:
269
+ 1. At the root of this repo, run `npm i` then `npm run yalc`
270
+ 2. In the target project, run `npm i --save-dev yalc` then `yalc add eslint-config-beslogic`
271
+ 3. Update the project's .eslintrc config file as needed
272
+ 4. Run your linting
273
+ -->
@@ -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
  {