eslint-config-beslogic 4.3.2 → 5.1.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/.dprint.jsonc +2 -2
- package/CHANGELOG.md +124 -10
- package/LICENSE +1 -1
- package/README.md +39 -31
- package/TODO-SONARJS_CHECK_IF_DUPLICATED.json +0 -17
- package/angular.mjs +100 -84
- package/eslint.config.mjs +24 -35
- package/extra-strict.mjs +70 -15
- package/index.mjs +1 -1
- package/javascript.mjs +208 -181
- package/jest.mjs +5 -19
- package/json-like.mjs +5 -3
- package/lib/utils.mjs +20 -18
- package/mui.mjs +7 -9
- package/node-js.mjs +44 -32
- package/package.json +40 -50
- package/react-native.mjs +4 -3
- package/react-redux.mjs +5 -19
- package/react.mjs +63 -19
- package/rxjs.mjs +51 -61
- package/storybook.mjs +7 -6
- package/stylistic.mjs +34 -16
- package/tsconfig.4.3.json +1 -1
- package/tsconfig.5.0.json +1 -1
- package/tsconfig.json +3 -2
- package/typescript.mjs +73 -95
package/.dprint.jsonc
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2025 Beslogic Inc.
|
|
3
3
|
|
|
4
4
|
{
|
|
5
5
|
// https://dprint.dev/config/#extending-a-different-configuration-file
|
|
6
|
-
"extends": "https://raw.githubusercontent.com/
|
|
6
|
+
"extends": "https://raw.githubusercontent.com/Beslogic/shared-configs/main/.dprint-json-like.jsonc",
|
|
7
7
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,119 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.1.0
|
|
4
|
+
|
|
5
|
+
### Javascript / TypeScript
|
|
6
|
+
|
|
7
|
+
- Account for ESLint version-specific new settings and rules
|
|
8
|
+
- If ESLint-Config-Beslogic cannot infer the TypeScript version, `latest` will now be assumed instead of `4.9` (at the moment this only affects setting `languageOptions.parserOptions.emitDecoratorMetadata` in Angular preset)
|
|
9
|
+
- Migrated from `eslint-plugin-prefer-arrow@^1.2` to `eslint-plugin-prefer-arrow-functions@^3.9.1`
|
|
10
|
+
- This changes the rule name from `prefer-arrow/prefer-arrow-functions` to `prefer-arrow-functions/prefer-arrow-functions`
|
|
11
|
+
<!-- - All functions named like an Angular Lifecycle Methods should now be excluded independent of the file name -->
|
|
12
|
+
- `unicorn/prevent-abbreviations` updates:
|
|
13
|
+
- Disallowed `frac` as an abbreviation (proposes `fraction`)
|
|
14
|
+
- Added `dependency`/`dependencies` as suggestions for the abbreviation `dep`/`deps`
|
|
15
|
+
- Allowed `prev` as an abbreviation in the React preset
|
|
16
|
+
- `no-console` is now always a warning. `no-restricted-globals` is used to catch leftover `console.log`
|
|
17
|
+
- Fixed an issue with rule `id-length`'s `exceptionPatterns` configuration where most symbols would be ignored due to a partial match
|
|
18
|
+
- Updated `id-length`'s max length from `32` to `40`
|
|
19
|
+
- Merged `id-length` and `no-autofix/id-length` configurations
|
|
20
|
+
- Enabled rule `import-x/no-extraneous-dependencies`
|
|
21
|
+
- Stopped checking for `builtinGlobals` in rule `no-shadow`
|
|
22
|
+
- Updated and simplified documentation concerning [`dprint`](https://github.com/Beslogic/shared-configs/blob/main/README.md#packagejson)
|
|
23
|
+
|
|
24
|
+
### React
|
|
25
|
+
|
|
26
|
+
- `react/require-default-props` now expects using default arguments instead of `.defaultProps` on function components
|
|
27
|
+
- Disabled rule `react-hooks/set-state-in-effect`
|
|
28
|
+
- Added `Link` to the components `jsx-a11y/anchor-is-valid` checks out of the box
|
|
29
|
+
- Restricted the replacement suggestions for `'` and `"` in `react/no-unescaped-entities` to make intent clearer
|
|
30
|
+
- Disabled rule `react/jsx-no-leaked-render`
|
|
31
|
+
- Enabled rule `react/prop-types` in the React preset, but left it disabled for TypeScript
|
|
32
|
+
|
|
33
|
+
### Stylistic
|
|
34
|
+
|
|
35
|
+
Configured the following rules to be closer to what dprint results in:
|
|
36
|
+
|
|
37
|
+
- Configured `@stylistic/jsx-one-expression-per-line` to `{ allow: 'single-line' }`
|
|
38
|
+
- Configured `react/jsx-curly-spacing` to `{ "when": "never", "children": true }`
|
|
39
|
+
|
|
40
|
+
## 5.0.0
|
|
41
|
+
|
|
42
|
+
- Dropped support for ESLint v8
|
|
43
|
+
- Note that we'll no longer be supporting the `ESLint-Config-Beslogic@v3` branch with the old-style configs
|
|
44
|
+
- Speedup due to removing compatibility layers
|
|
45
|
+
- Dropped support for Angular v18
|
|
46
|
+
- Removed all `languageOptions.parserOptions.project` configs in favor of `languageOptions.parserOptions.projectService: true`
|
|
47
|
+
- Using `eslint-plugin-import-x`'s new resolver system
|
|
48
|
+
- Wrapped `eslint-plugin-extra-rules` in `fixupPluginRules` to fix `extra-rules/potential-point-free` on ESLint v9
|
|
49
|
+
- Exposed a pre-configured object for `@typescript-eslint/explicit-module-boundary-types` for libraries
|
|
50
|
+
- Let `eslint-plugin-n` completely configure `languageOptions` for Node (with automatic ESM vs CommonJS detection)
|
|
51
|
+
- Added names to all config objects
|
|
52
|
+
|
|
53
|
+
### Rule configuration changes
|
|
54
|
+
|
|
55
|
+
Given the nature of extending `all` and `recommended` configurations by default, I won't be listing all new rules here.
|
|
56
|
+
|
|
57
|
+
- `no-relative-import-paths/no-relative-import-paths`: Allow 1 parent level in imports
|
|
58
|
+
- Enabled `n/no-top-level-await`, but with `ignoreBin: true`. The rule can be bypassed by setting a hash-bang comment to your script files
|
|
59
|
+
- Stylistic: Try to get `@stylistic/indent` to match DPrint a bit more on nested ternary expressions
|
|
60
|
+
- Stylistic: Allow extra parents on nested conditional/ternary expressions
|
|
61
|
+
- Disallow `unknown` in `@typescript-eslint/no-base-to-string`, `@typescript-eslint/only-throw-error` and `"@typescript-eslint/prefer-promise-reject-errors`
|
|
62
|
+
- Disallow `any` in `@typescript-eslint/no-base-to-string`, `@typescript-eslint/only-throw-error` and `"@typescript-eslint/prefer-promise-reject-errors` in extra-strict preset
|
|
63
|
+
- Enabled `@typescript-eslint/prefer-nullish-coalescing` in non-strict preset, but with leaner configs. Should do nothing if `StrictNullChecks` is not enabled in your `tsconfig.json`
|
|
64
|
+
- Allow `while(true)` for `@typescript-eslint/no-unnecessary-condition`
|
|
65
|
+
- Enable autofixes for `no-new-native-nonconstructor`
|
|
66
|
+
- Added `reportUsedIgnorePattern: true` to `autofix/no-unused-vars`
|
|
67
|
+
- Updated rule `no-fallthrough` with `{commentPattern: "/(falls?\s?through|defaults?)/i", "reportUnusedFallthroughComment": true}`
|
|
68
|
+
- Rule `rxjs/no-finnish` was moved from the Angular preset to the RxJS preset
|
|
69
|
+
- Enabled rule `testing-library/no-test-id-queries` as warning in extra-strict preset
|
|
70
|
+
- Angular lifecycle hook prototype methods are now checked using `@angular-eslint/require-lifecycle-on-prototype` rather than `no-restricted-syntax`
|
|
71
|
+
- New `no-restricted-syntax` rule to enforce naming eslint configuration objects when using `defineConfig`
|
|
72
|
+
- Added some custom `no-restricted-syntax` from <https://typescript-eslint.io/troubleshooting/faqs/general/#how-can-i-ban-specific-language-feature>:
|
|
73
|
+
- Ban accessing `constructor.name`
|
|
74
|
+
- Ban static `this`
|
|
75
|
+
- Ban `const` enums. This replaces `etc/no-const-enum`
|
|
76
|
+
|
|
77
|
+
Disabled rules:
|
|
78
|
+
|
|
79
|
+
- Disabled rule `@angular-eslint/no-conflicting-lifecycle`
|
|
80
|
+
- Disabled rule `unicorn/better-regex`
|
|
81
|
+
- Dropped `eslint-plugin-etc`. All the interesting rules now have an equivalent in other plugins
|
|
82
|
+
- Disabled `@eslint-community/eslint-comments/no-unused-disable` rule in favor of `linterOptions.reportUnusedDisableDirectives`
|
|
83
|
+
|
|
84
|
+
### Dependency updates
|
|
85
|
+
|
|
86
|
+
#### Necessary to ensure proper ESLint v9 compatibility
|
|
87
|
+
|
|
88
|
+
- Migrated from `eslint-plugin-rxjs@^5.0.3` to `eslint-plugin-rxjs-angular-x@^0.1.0`
|
|
89
|
+
- Migrated from `"github:Beslogic/eslint-plugin-rxjs-angular#dist` to `eslint-plugin-rxjs-x@^0.8`
|
|
90
|
+
- Migrated `eslint-plugin-jest-formatting` to `eslint-plugin-jest`
|
|
91
|
+
- Bumped `eslint` to `^9.12`
|
|
92
|
+
- Bumped `eslint-plugin-jest` to `^28.8.3 || ^29.0.1`
|
|
93
|
+
- Bumped `eslint-plugin-sonarjs` tot `^3.0.2`
|
|
94
|
+
- Bumped `eslint-plugin-unicorn` to `^56.0.1`
|
|
95
|
+
- Bumped `eslint-plugin-react-redux` to `^4.2.0`
|
|
96
|
+
- Bumped `eslint-plugin-testing-library` `^7.2.0`
|
|
97
|
+
- Bumped `@eslint-community/eslint-plugin-eslint-comments` to `^4.3`
|
|
98
|
+
- Bumped `eslint-plugin-autofix` to `^2.2`
|
|
99
|
+
- Bumped `eslint-plugin-jsx-a11y` to `^6.10.0`
|
|
100
|
+
- Bumped `eslint-plugin-regexp` to `^2.3`
|
|
101
|
+
|
|
102
|
+
#### Necessary for unconditional support of new features and configs
|
|
103
|
+
|
|
104
|
+
- Bumped `eslint-plugin-no-autofix` to `^2.1`
|
|
105
|
+
- Bumped `@eslint/compat` to `^1.2.4 || ^2`
|
|
106
|
+
- Bumped `@stylistic/eslint-plugin` to `^5.3`
|
|
107
|
+
- Bumped `eslint-config-flat-gitignore` to `^2.1.0`
|
|
108
|
+
- Bumped `eslint-import-resolver-typescript` to `^4`
|
|
109
|
+
- Bumped `eslint-plugin-import-x` to `^4.15.1`
|
|
110
|
+
- Bumped `eslint-plugin-no-relative-import-paths` to `^1.5.5`
|
|
111
|
+
- Bumped `typescript-eslint` to `^8.35`
|
|
112
|
+
- Bumped `angular-eslint` to `>=19.6`
|
|
113
|
+
- Bumped `eslint-plugin-n` to `>=17.19`
|
|
114
|
+
- Bumped `eslint-plugin-react-hooks` to `^7.0.1`
|
|
115
|
+
- Bumped `eslint-plugin-react-prefer-function-component` to `^3.3.0 || ^4.0.1 || ^5`
|
|
116
|
+
|
|
3
117
|
## 4.3.2
|
|
4
118
|
|
|
5
119
|
- Disabled `@angular-eslint/no-host-metadata-property` as it is now the recommendation for signals. See <https://github.com/angular-eslint/angular-eslint/discussions/2303>
|
|
@@ -8,11 +122,11 @@
|
|
|
8
122
|
## 4.3.0
|
|
9
123
|
|
|
10
124
|
- Correctly also disable `compilerOptions.emitDecoratorMetadata` when disabling `compilerOptions.experimentalDecorators` out of the box
|
|
11
|
-
- Added instructions to
|
|
125
|
+
- Added instructions to explicitly enable both on Angular projects using experimental decorators
|
|
12
126
|
- Added a `tsconfig.5.6.json` TSConfig preset with `noUncheckedSideEffectImports` enabled
|
|
13
127
|
- Enabled `compilerOptions.resolveJsonModule` by default
|
|
14
128
|
- Enabled `compilerOptions.checkJS` by default
|
|
15
|
-
- Relaxed `prefer-arrow/prefer-arrow-functions` for `**/*[.-]service.ts` files as we expected `@Injectable` to have lifecycle methods
|
|
129
|
+
- Relaxed `prefer-arrow-functions/prefer-arrow-functions` for `**/*[.-]service.ts` files as we expected `@Injectable` to have lifecycle methods
|
|
16
130
|
- Disabled `@typescript-eslint/prefer-for-of` and `sonarjs/prefer-for-of` in favor of `unicorn/no-for-loop`
|
|
17
131
|
- Allowed `i++` in "loop afterthrought" (`for (i = 0; i < l; i++)`) for rule `autofix/no-plusplus`
|
|
18
132
|
- Set `@typescript-eslint/switch-exhaustiveness-check`'s `considerDefaultExhaustiveForUnions` to `false` in non-extra-strict preset
|
|
@@ -35,7 +149,7 @@
|
|
|
35
149
|
- Disabled `@typescript-eslint/no-misused-spread`:\
|
|
36
150
|
Still a handful of false-positives and I couldn't get the configuration working.\
|
|
37
151
|
Especially annoying with autogenerated API when spreading class instance
|
|
38
|
-
with readonly properties as its
|
|
152
|
+
with readonly properties as its constructor object.\
|
|
39
153
|
ie: `new Myclass({...someInstance, overwritten_prop: "foo"})`\
|
|
40
154
|
NOTE: If fixed, we'd still only want this in extra-strict config.
|
|
41
155
|
|
|
@@ -83,7 +197,7 @@
|
|
|
83
197
|
- Disabled `@typescript-eslint/no-misused-spread`:\
|
|
84
198
|
Still a handful of false-positives and I couldn't get the configuration working.\
|
|
85
199
|
Especially annoying with autogenerated API when spreading class instance
|
|
86
|
-
with readonly properties as its
|
|
200
|
+
with readonly properties as its constructor object.\
|
|
87
201
|
ie: `new Myclass({...someInstance, overwritten_prop: "foo"})`\
|
|
88
202
|
NOTE: If fixed, we'd still only want this in extra-strict config.
|
|
89
203
|
|
|
@@ -122,13 +236,13 @@
|
|
|
122
236
|
|
|
123
237
|
## 3.1.1
|
|
124
238
|
|
|
125
|
-
- Turned on `"objectLiteralTypeAssertions
|
|
239
|
+
- Turned on `"objectLiteralTypeAssertions` to `allow-as-parameter"` as error for `@typescript-eslint/consistent-type-assertions` in extra-strict config
|
|
126
240
|
- Enabled `@typescript-eslint/consistent-type-assertions` (but without the "as parameter" restriction) for Jest
|
|
127
241
|
- Added `boolean` and `nullish` to `@typescript-eslint/restrict-template-expressions` in `extra-strict` preset
|
|
128
242
|
If you really meant to write "true", "false", "null" or "undefined", then explicitly stringify it using `String()` (or `Intl.ListFormat` for `Array`s)
|
|
129
243
|
- Disabled `default-case` rule in TypeScript as it is redundant with `@typescript-eslint/switch-exhaustiveness-check` and conflicts with `unicorn/no-useless-switch-case`
|
|
130
244
|
- Bumped `eslint-plugin-sonarjs` to `2.0.4`
|
|
131
|
-
- Stopped attempting to support pre-commit.ci. Read the [`PR Autofixes`](https://github.com/
|
|
245
|
+
- Stopped attempting to support pre-commit.ci. Read the [`PR Autofixes`](https://github.com/Beslogic/shared-configs/blob/main/README.md#pr-autofixes) section of our Shared Configs for an explanation and alternatives.
|
|
132
246
|
|
|
133
247
|
## 3.0.2
|
|
134
248
|
|
|
@@ -220,7 +334,7 @@
|
|
|
220
334
|
|
|
221
335
|
## 2.4.12
|
|
222
336
|
|
|
223
|
-
- Restored `regexp/prefer-d` pre-2.4 behaviour of
|
|
337
|
+
- Restored `regexp/prefer-d` pre-2.4 behaviour of preferring `/[\d_]/` over `/[0-9_]/`
|
|
224
338
|
- Disabled all the following rules when running under pre-commit.ci to avoid false-positives due to missing types:
|
|
225
339
|
- `@typescript-eslint/no-redundant-type-constituents`
|
|
226
340
|
- `@typescript-eslint/no-unnecessary-condition`
|
|
@@ -240,12 +354,12 @@
|
|
|
240
354
|
|
|
241
355
|
## 2.4.7
|
|
242
356
|
|
|
243
|
-
- No longer recommending to
|
|
357
|
+
- No longer recommending to explicitly annotate void returning awaitable arrow functions as `(param): void => { statement }` in JavaScript
|
|
244
358
|
|
|
245
359
|
## 2.4.6
|
|
246
360
|
|
|
247
361
|
- Replaced `@typescript-eslint/*` with `typescript-eslint`
|
|
248
|
-
- Loosened rules
|
|
362
|
+
- Loosened rules requiring `strictNullChecks` if `eslint-plugin-total-functions` isn't also installed
|
|
249
363
|
|
|
250
364
|
## 2.4.5
|
|
251
365
|
|
|
@@ -262,7 +376,7 @@
|
|
|
262
376
|
- Moved `eslint-plugin-testing-library` to `dependencies`
|
|
263
377
|
- Bumped `eslint-plugin-unused-imports` to `^3.2.0` to fix error with `@typescript-eslint@7.8`
|
|
264
378
|
- Don't check for camelcase properties in eslint config files
|
|
265
|
-
- Turn on `prefer-arrow/prefer-arrow-functions` autofixing for `singleReturnOnly`
|
|
379
|
+
- Turn on `prefer-arrow-functions/prefer-arrow-functions` autofixing for `singleReturnOnly`
|
|
266
380
|
|
|
267
381
|
## 2.3.2
|
|
268
382
|
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License
|
|
2
2
|
|
|
3
|
-
Copyright
|
|
3
|
+
Copyright 2025 Beslogic Inc.
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
6
|
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Run `npm i --save-dev eslint-config-beslogic`
|
|
|
6
6
|
|
|
7
7
|
Depending on your needs, you will need to also install other peer dependencies for linting.
|
|
8
8
|
|
|
9
|
-
In your `eslint.config.[cm]?js` file, simply [extend](
|
|
9
|
+
In your `eslint.config.[cm]?js` file, simply [extend](#examples) our [presets](#presets) appropriate for your project.
|
|
10
10
|
|
|
11
11
|
For stylistic rules, it is highly recommended to use a dedicated formatter over ESLint. Read more here: <https://typescript-eslint.io/docs/linting/troubleshooting/formatting/>\
|
|
12
12
|
We assume [dprint](https://dprint.dev/) and don't enable any rules it covers by default. If you're not using a formatter, a [stylistic.mjs](#stylisticmjs) configuration is offered below.
|
|
@@ -17,7 +17,7 @@ These are configuration files you'll have to update manually to best work with t
|
|
|
17
17
|
|
|
18
18
|
### `package.json`
|
|
19
19
|
|
|
20
|
-
Read the [`package.json`](https://github.com/
|
|
20
|
+
Read the [`package.json`](https://github.com/Beslogic/shared-configs/blob/main/README.md#packagejson) section of our Shared Configs for one-liner shortcut scripts you can use.
|
|
21
21
|
|
|
22
22
|
### Base `tsconfig.json`
|
|
23
23
|
|
|
@@ -56,30 +56,29 @@ If deploying / bundling with an Angular npm package, also set `angularCompilerOp
|
|
|
56
56
|
|
|
57
57
|
### `.vscode/settings.json` and `.vscode/extensions.json`
|
|
58
58
|
|
|
59
|
-
Read and copy the sections for the languages you use from [
|
|
59
|
+
Read and copy the sections for the languages you use from [Beslogic/shared-configs/.vscode](https://github.com/Beslogic/shared-configs/tree/main/.vscode).
|
|
60
60
|
|
|
61
61
|
### `.dprint.jsonc`
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
<!-- Keep in sync with https://github.com/Beslogic/shared-configs README -->
|
|
64
|
+
|
|
65
|
+
Add the following into your `.dprint.jsonc` at the root of your git project (even if you have multiple workspaces):
|
|
64
66
|
|
|
65
67
|
```jsonc
|
|
66
68
|
{
|
|
67
69
|
// https://dprint.dev/config/#extending-a-different-configuration-file
|
|
68
|
-
"extends": "https://raw.githubusercontent.com/
|
|
70
|
+
"extends": "https://raw.githubusercontent.com/Beslogic/shared-configs/<hash>/.dprint.jsonc"
|
|
69
71
|
}
|
|
70
72
|
```
|
|
71
73
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
This configuration automatically includes known "exclusion" folders. But if you need to add more, you can copy and expand the `exludes` list in [dprint.json](https://github.com/BesLogic/shared-configs/blob/main/dprint.json).\
|
|
75
|
-
If you'd like to pin your config version, you can use a commit hash, like `https://raw.githubusercontent.com/BesLogic/shared-configs/a0d9a34/dprint.json`.
|
|
74
|
+
Read the [`dprint`](https://github.com/Beslogic/shared-configs/blob/main/README.md#dprint) section of our Shared Configs for more information.
|
|
76
75
|
|
|
77
|
-
If also using [`json-like.mjs` preset](#json-likemjs) extend from `https://raw.githubusercontent.com/
|
|
76
|
+
If also using [`json-like.mjs` preset](#json-likemjs) extend from `https://raw.githubusercontent.com/Beslogic/shared-configs/main/.dprint-json-like.jsonc` instead.
|
|
78
77
|
|
|
79
78
|
### PR Autofixes
|
|
80
79
|
|
|
81
80
|
We've stopped attempting to support pre-commit.ci.\
|
|
82
|
-
Read the [`PR Autofixes`](https://github.com/
|
|
81
|
+
Read the [`PR Autofixes`](https://github.com/Beslogic/shared-configs/blob/main/README.md#pr-autofixes) section of our Shared Configs for an explanation and alternatives.
|
|
83
82
|
|
|
84
83
|
## Patched packages
|
|
85
84
|
|
|
@@ -101,18 +100,18 @@ Angular Material's MatDialogRef [defaults it dialog result generic to `any`](htt
|
|
|
101
100
|
|
|
102
101
|
Below are all the different configurations you can extend from. You can mix and match as you want if a predefined configuration does not exist for your specific stack. You should import TypeScript configs after regular javascript ones at the root of the configuration.
|
|
103
102
|
|
|
104
|
-
Examples
|
|
103
|
+
### Examples
|
|
105
104
|
|
|
106
105
|
<details>
|
|
107
106
|
<summary>React + TypeScript</summary>
|
|
108
107
|
|
|
109
108
|
```js
|
|
110
|
-
import
|
|
109
|
+
import { defineConfig } from 'eslint/config';
|
|
111
110
|
import beslogicExtraStrict from 'eslint-config-beslogic/extra-strict.mjs'
|
|
112
111
|
import beslogicReact from 'eslint-config-beslogic/react.mjs'
|
|
113
112
|
import beslogicTypeScript from 'eslint-config-beslogic/typescript.mjs'
|
|
114
113
|
|
|
115
|
-
export default
|
|
114
|
+
export default defineConfig(
|
|
116
115
|
beslogicReact,
|
|
117
116
|
beslogicTypeScript,
|
|
118
117
|
beslogicExtraStrict,
|
|
@@ -127,11 +126,11 @@ export default tseslint.config(
|
|
|
127
126
|
<summary>Angular</summary>
|
|
128
127
|
|
|
129
128
|
```js
|
|
130
|
-
import
|
|
129
|
+
import { defineConfig } from 'eslint/config';
|
|
131
130
|
import beslogicAngular from 'eslint-config-beslogic/angular.mjs'
|
|
132
131
|
import beslogicExtraStrict from 'eslint-config-beslogic/extra-strict.mjs'
|
|
133
132
|
|
|
134
|
-
export default
|
|
133
|
+
export default defineConfig(
|
|
135
134
|
beslogicAngular,
|
|
136
135
|
beslogicExtraStrict,
|
|
137
136
|
// Your configs here
|
|
@@ -145,13 +144,13 @@ export default tseslint.config(
|
|
|
145
144
|
<summary>Frameworkless TypeScript w/o dprint</summary>
|
|
146
145
|
|
|
147
146
|
```js
|
|
148
|
-
import
|
|
147
|
+
import { defineConfig } from 'eslint/config';
|
|
149
148
|
import beslogicExtraStrict from 'eslint-config-beslogic/extra-strict.mjs'
|
|
150
149
|
import beslogicJavascript from 'eslint-config-beslogic/javascript.mjs'
|
|
151
150
|
import beslogicStylistic from 'eslint-config-beslogic/stylistic.mjs'
|
|
152
151
|
import beslogicTypeScript from 'eslint-config-beslogic/typescript.mjs'
|
|
153
152
|
|
|
154
|
-
export default
|
|
153
|
+
export default defineConfig(
|
|
155
154
|
beslogicJavascript,
|
|
156
155
|
beslogicTypeScript,
|
|
157
156
|
beslogicExtraStrict,
|
|
@@ -177,12 +176,29 @@ Basic javascript configs, is extended by all other configs except `typescript.mj
|
|
|
177
176
|
|
|
178
177
|
### `typescript.mjs`
|
|
179
178
|
|
|
180
|
-
Basic TypeScript-specific configs and `TSX` support, is extended by all other TypeScript exclusive configs. To avoid rules conflicts, it does **not** already extend from `javascript.mjs`. So you should extend from both in a pure TypeScript project.
|
|
179
|
+
Basic TypeScript-specific configs and `TSX` support, is extended by all other TypeScript exclusive configs. To avoid rules conflicts, it does **not** already extend from `javascript.mjs`. So you should extend from both in a pure TypeScript project. If you have a non-standard `tsconfig.json`, you may need custom configurations for [settings.import-x/resolver-next: [createTypeScriptImportResolver({project: ...})]](https://github.com/import-js/eslint-import-resolver-typescript#eslintconfigjs) and/or [settings.parserOptions.projectService](https://typescript-eslint.io/packages/parser#projectserviceoptions).
|
|
181
180
|
|
|
182
181
|
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)).
|
|
183
182
|
|
|
184
183
|
If you want extra strict linting, consider adding the [`extra-strict.mjs` preset](#extra-strictmjs).
|
|
185
184
|
|
|
185
|
+
If you are a writing library, use the following rule:
|
|
186
|
+
|
|
187
|
+
```js
|
|
188
|
+
import { defineConfig } from "eslint/config"
|
|
189
|
+
import { explicitModuleBoundaryType } from "eslint-config-beslogic/extra-strict.mjs"
|
|
190
|
+
|
|
191
|
+
export default defineConfig(
|
|
192
|
+
{
|
|
193
|
+
rules: {
|
|
194
|
+
"@typescript-eslint/explicit-module-boundary-types": explicitModuleBoundaryType
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
<!-- Notes about bun support for later: https://github.com/import-js/eslint-import-resolver-typescript#bun-->
|
|
201
|
+
|
|
186
202
|
### `node-js.mjs`
|
|
187
203
|
|
|
188
204
|
Configurations for NodeJS backends.
|
|
@@ -200,7 +216,7 @@ Configurations for projects using RxJs. Already extends and `typescript.mjs` for
|
|
|
200
216
|
Add the following `devDependencies` to your `package.json`:
|
|
201
217
|
|
|
202
218
|
```shell
|
|
203
|
-
npm install --save-dev eslint-plugin-rxjs
|
|
219
|
+
npm install --save-dev eslint-plugin-rxjs-x
|
|
204
220
|
```
|
|
205
221
|
|
|
206
222
|
### `react.mjs`
|
|
@@ -255,9 +271,11 @@ If bundling as an npm package set `"strictMetadataEmit": true` under `angularCom
|
|
|
255
271
|
Add the following `devDependencies` to your `package.json`:
|
|
256
272
|
|
|
257
273
|
```shell
|
|
258
|
-
npm install --save-dev @angular-eslint/eslint-plugin @angular-eslint/eslint-plugin-template @angular-eslint/template-parser
|
|
274
|
+
npm install --save-dev @angular-eslint/eslint-plugin @angular-eslint/eslint-plugin-template @angular-eslint/template-parser eslint-plugin-rxjs-angular-x eslint-plugin-angular-file-naming
|
|
259
275
|
```
|
|
260
276
|
|
|
277
|
+
If using Standalone Components, which are now the recommended default, you should enable the rule `"no-autofix/@angular-eslint/prefer-standalone": "error"`.
|
|
278
|
+
|
|
261
279
|
### `storybook.mjs`
|
|
262
280
|
|
|
263
281
|
Includes strict Storybook ESLint plugin and a custom rule for Angular components. This preset should be added last.\
|
|
@@ -292,13 +310,3 @@ Enforces stylistic rules for JS objects to look like valid JSON objects.
|
|
|
292
310
|
## Changelog
|
|
293
311
|
|
|
294
312
|
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>
|
|
295
|
-
|
|
296
|
-
<!-- (keep this section hidden from public README)
|
|
297
|
-
## Dev testing:
|
|
298
|
-
|
|
299
|
-
To test updates to ESLint-Config-Beslogic in other existing projects:
|
|
300
|
-
1. At the root of this repo, run `npm i` then `npm run yalc`
|
|
301
|
-
2. In the target project, run `npm i --save-dev yalc` then `yalc add eslint-config-beslogic`
|
|
302
|
-
3. Update the project's eslintrc.config.mjs config file as needed
|
|
303
|
-
4. Run your linting
|
|
304
|
-
-->
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
// These are the rules I haven't yet validated if they duplicate existing rules
|
|
2
2
|
{
|
|
3
|
-
"sonarjs/alt-text": "error",
|
|
4
|
-
"sonarjs/anchor-has-content": "error",
|
|
5
|
-
"sonarjs/anchor-is-valid": "error",
|
|
6
3
|
"sonarjs/anchor-precedence": "error",
|
|
7
4
|
"sonarjs/argument-type": "error",
|
|
8
5
|
"sonarjs/arguments-order": "error",
|
|
@@ -35,29 +32,24 @@
|
|
|
35
32
|
"sonarjs/generator-without-yield": "error",
|
|
36
33
|
"sonarjs/hashing": "error",
|
|
37
34
|
"sonarjs/hidden-files": "error",
|
|
38
|
-
"sonarjs/html-has-lang": "error",
|
|
39
35
|
"sonarjs/in-operator-type-error": "error",
|
|
40
36
|
"sonarjs/inconsistent-function-call": "error",
|
|
41
37
|
"sonarjs/index-of-compare-to-positive-number": "error",
|
|
42
38
|
"sonarjs/insecure-cookie": "error",
|
|
43
39
|
"sonarjs/insecure-jwt-token": "error",
|
|
44
40
|
"sonarjs/inverted-assertion-arguments": "error",
|
|
45
|
-
"sonarjs/label-has-associated-control": "error",
|
|
46
41
|
"sonarjs/label-position": "error",
|
|
47
42
|
"sonarjs/link-with-target-blank": "error",
|
|
48
43
|
"sonarjs/max-switch-cases": "error",
|
|
49
|
-
"sonarjs/media-has-caption": "error",
|
|
50
44
|
"sonarjs/misplaced-loop-counter": "error",
|
|
51
45
|
"sonarjs/mouse-events-a11y": "error",
|
|
52
46
|
"sonarjs/new-operator-misuse": "error",
|
|
53
47
|
"sonarjs/no-accessor-field-mismatch": "error",
|
|
54
48
|
"sonarjs/no-all-duplicated-branches": "error",
|
|
55
|
-
"sonarjs/no-alphabetical-sort": "error",
|
|
56
49
|
"sonarjs/no-angular-bypass-sanitization": "error",
|
|
57
50
|
"sonarjs/no-array-delete": "error",
|
|
58
51
|
"sonarjs/no-associative-arrays": "error",
|
|
59
52
|
"sonarjs/no-async-constructor": "error",
|
|
60
|
-
"sonarjs/no-base-to-string": "error",
|
|
61
53
|
"sonarjs/no-case-label-in-switch": "error",
|
|
62
54
|
"sonarjs/no-clear-text-protocols": "error",
|
|
63
55
|
"sonarjs/no-code-after-done": "error",
|
|
@@ -88,19 +80,16 @@
|
|
|
88
80
|
"sonarjs/no-infinite-loop": "error",
|
|
89
81
|
"sonarjs/no-internal-api-use": "error",
|
|
90
82
|
"sonarjs/no-intrusive-permissions": "error",
|
|
91
|
-
"sonarjs/no-invalid-await": "error",
|
|
92
83
|
"sonarjs/no-invariant-returns": "error",
|
|
93
84
|
"sonarjs/no-inverted-boolean-check": "error",
|
|
94
85
|
"sonarjs/no-ip-forward": "error",
|
|
95
86
|
"sonarjs/no-labels": "error",
|
|
96
87
|
"sonarjs/no-literal-call": "error",
|
|
97
88
|
"sonarjs/no-mime-sniff": "error",
|
|
98
|
-
"sonarjs/no-misleading-array-reverse": "error",
|
|
99
89
|
"sonarjs/no-mixed-content": "error",
|
|
100
90
|
"sonarjs/no-nested-assignment": "error",
|
|
101
91
|
"sonarjs/no-nested-functions": "error",
|
|
102
92
|
"sonarjs/no-nested-template-literals": "error",
|
|
103
|
-
"sonarjs/no-one-iteration-loop": "error",
|
|
104
93
|
"sonarjs/no-parameter-reassignment": "error",
|
|
105
94
|
"sonarjs/no-primitive-wrappers": "error",
|
|
106
95
|
"sonarjs/no-redundant-assignments": "error",
|
|
@@ -111,8 +100,6 @@
|
|
|
111
100
|
"sonarjs/no-same-argument-assert": "error",
|
|
112
101
|
"sonarjs/no-same-line-conditional": "error",
|
|
113
102
|
"sonarjs/no-selector-parameter": "error",
|
|
114
|
-
"sonarjs/no-self-compare": "error",
|
|
115
|
-
"sonarjs/no-self-import": "error",
|
|
116
103
|
"sonarjs/no-skipped-test": "error",
|
|
117
104
|
"sonarjs/no-small-switch": "error",
|
|
118
105
|
"sonarjs/no-table-as-layout": "error",
|
|
@@ -123,8 +110,6 @@
|
|
|
123
110
|
"sonarjs/no-unthrown-error": "error",
|
|
124
111
|
"sonarjs/no-unused-collection": "error",
|
|
125
112
|
"sonarjs/no-use-of-empty-return-value": "error",
|
|
126
|
-
"sonarjs/no-useless-call": "error",
|
|
127
|
-
"sonarjs/no-useless-constructor": "error",
|
|
128
113
|
"sonarjs/no-useless-increment": "error",
|
|
129
114
|
"sonarjs/no-useless-intersection": "error",
|
|
130
115
|
"sonarjs/no-vue-bypass-sanitization": "error",
|
|
@@ -136,8 +121,6 @@
|
|
|
136
121
|
"sonarjs/os-command": "error",
|
|
137
122
|
"sonarjs/post-message": "error",
|
|
138
123
|
"sonarjs/prefer-default-last": "error",
|
|
139
|
-
"sonarjs/prefer-function-type": "error",
|
|
140
|
-
"sonarjs/prefer-namespace-keyword": "error",
|
|
141
124
|
"sonarjs/prefer-promise-shorthand": "error",
|
|
142
125
|
"sonarjs/prefer-single-boolean-return": "error",
|
|
143
126
|
"sonarjs/prefer-type-guard": "error",
|