@dartess/eslint-plugin 0.0.3 → 0.0.6
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 +10 -0
- package/README.md +51 -24
- package/dist/configs/react.js +4 -1
- package/dist/configs/recommended.js +21 -1
- package/dist/configs/vendor-rules/best-practices.d.ts +0 -14
- package/dist/configs/vendor-rules/best-practices.js +0 -35
- package/dist/configs/vendor-rules/errors.d.ts +0 -22
- package/dist/configs/vendor-rules/errors.js +0 -55
- package/dist/configs/vendor-rules/es6.d.ts +0 -5
- package/dist/configs/vendor-rules/es6.js +0 -15
- package/dist/configs/vendor-rules/react.d.ts +0 -12
- package/dist/configs/vendor-rules/react.js +0 -36
- package/dist/configs/vendor-rules/variables.d.ts +0 -2
- package/dist/configs/vendor-rules/variables.js +0 -4
- package/dist/index.d.ts +1 -1
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
[//]: # (https://keepachangelog.com/en/1.1.0/)
|
|
4
4
|
|
|
5
|
+
## [0.0.6] - 2025-12-28
|
|
6
|
+
|
|
7
|
+
- cleanup extra overrides
|
|
8
|
+
- add `decorator-position/decorator-position` to `recommeded`: one line — one decorator
|
|
9
|
+
|
|
10
|
+
## [0.0.5] - 2025-12-27
|
|
11
|
+
|
|
12
|
+
- remove `arrow-body-style` from 'recommeded': not relevant for typed code
|
|
13
|
+
- add `@typescript-eslint/consistent-type-imports` to `recommeded`: it helps with three-shaking
|
|
14
|
+
|
|
5
15
|
## [0.0.3] - 2025-12-25
|
|
6
16
|
|
|
7
17
|
- disable recommended `mobx/missing-make-observable`: this rule useless with modern decorators syntax
|
package/README.md
CHANGED
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
# @dartess/eslint-plugin
|
|
2
2
|
|
|
3
|
-
A set of rules for various
|
|
3
|
+
A set of configs and rules for various TypeScript projects.
|
|
4
|
+
Based on outdated or deprecated configs `eslint-config-airbnb` and `eslint-config-airbnb-typescript`.
|
|
5
|
+
Also extends
|
|
6
|
+
* `@eslint/js` — `recommended`
|
|
7
|
+
* `typescript-eslint` — `strictTypeChecked` & `stylisticTypeChecked`
|
|
8
|
+
* `eslint-plugin-import-x` — `recommended` & `typescript`
|
|
9
|
+
* `@eslint-community/eslint-plugin-eslint-comments` — `recommended`
|
|
10
|
+
|
|
11
|
+
Also can extends (if it is applicable)
|
|
12
|
+
* `eslint-plugin-react` — `recommended` & `jsx-runtime`
|
|
13
|
+
* `@next/eslint-plugin-next` — `recommended` & `core-web-vitals`
|
|
14
|
+
* `eslint-config-next`
|
|
15
|
+
* `eslint-plugin-mobx` — `recommended`
|
|
16
|
+
* `eslint-plugin-storybook` — `recommended` & `csf-strict`
|
|
17
|
+
|
|
18
|
+
_(We also use `eslint-plugin-unicorn` but only special rules, without `recommended` config)_
|
|
19
|
+
|
|
20
|
+
All of it pinched with extra configs, setups and extra rules. Just take it and use it!
|
|
21
|
+
|
|
22
|
+
### Notes
|
|
23
|
+
|
|
24
|
+
1. The package is intended for use with TypeScript (it'll be useful for plain JS, but it hasn't been weel-tested).
|
|
25
|
+
|
|
26
|
+
2. The package is intended for use only with the `flat` eslint config.
|
|
27
|
+
|
|
28
|
+
3. _(for React users)_ The package is intended for use with [React New JSX Transform](https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html).
|
|
4
29
|
|
|
5
30
|
## Installation
|
|
6
31
|
|
|
7
|
-
You'll first need to install [ESLint](https://eslint.org/) and
|
|
32
|
+
You'll first need to install [ESLint](https://eslint.org/) and peer deps:
|
|
8
33
|
|
|
9
34
|
```sh
|
|
10
35
|
npm i -D eslint eslint-plugin-import-x eslint-import-resolver-typescript @eslint-community/eslint-plugin-eslint-comments typescript-eslint eslint-plugin-unicorn
|
|
@@ -25,7 +50,7 @@ npm i -D eslint-plugin-mobx
|
|
|
25
50
|
npm i -D eslint-plugin-storybook
|
|
26
51
|
```
|
|
27
52
|
|
|
28
|
-
Next, install `@dartess/eslint-plugin`
|
|
53
|
+
Next, install `@dartess/eslint-plugin` itself.
|
|
29
54
|
|
|
30
55
|
```sh
|
|
31
56
|
npm i -D @dartess/eslint-plugin
|
|
@@ -52,7 +77,7 @@ import dartessEslintPluginStorybook from '@dartess/eslint-plugin/storybook';
|
|
|
52
77
|
import { parseGitIgnore } from '@dartess/eslint-plugin/utils';
|
|
53
78
|
|
|
54
79
|
export default [
|
|
55
|
-
parseGitIgnore(), // the easiest way to ignore all `.gitignore` files
|
|
80
|
+
parseGitIgnore(), // (optional) the easiest way to ignore all `.gitignore` files
|
|
56
81
|
|
|
57
82
|
{
|
|
58
83
|
languageOptions: {
|
|
@@ -75,45 +100,47 @@ export default [
|
|
|
75
100
|
|
|
76
101
|
```
|
|
77
102
|
|
|
78
|
-
The package is intended for use with TypeScript.
|
|
79
|
-
|
|
80
|
-
The package is intended for use with [React New JSX Transform](https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html).
|
|
81
|
-
|
|
82
|
-
The package is intended for use only with the `flat` eslint config.
|
|
83
|
-
|
|
84
103
|
## Next steps
|
|
85
104
|
|
|
86
|
-
If you
|
|
105
|
+
If you're using React, you also probably will want to add
|
|
87
106
|
[eslint-plugin-react-refresh](https://www.npmjs.com/package/eslint-plugin-react-refresh).
|
|
88
107
|
This plugin requires manual setup for you build tools.
|
|
89
108
|
|
|
90
|
-
If you
|
|
109
|
+
If you're using Mobx with legacy decorators, you have to enable rule `mobx/missing-make-observable` manually.
|
|
91
110
|
|
|
92
|
-
|
|
111
|
+
### Formatters
|
|
93
112
|
|
|
94
|
-
|
|
113
|
+
If you're want to (and you should to) use formatting tools, you need to additionally install and setup something else.
|
|
95
114
|
|
|
96
|
-
|
|
115
|
+
#### dprint
|
|
97
116
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
117
|
+
Use `eslint-plugin-format` with rule `format/dprint` for running `dprint` as eslint rule (you probably will want to add `eslint-config-prettier` for disabling unnecessary rules).
|
|
118
|
+
|
|
119
|
+
#### Biome
|
|
120
|
+
|
|
121
|
+
Use `eslint-config-biome` for disabling unnecessary rules.
|
|
122
|
+
|
|
123
|
+
#### Oxlint
|
|
124
|
+
|
|
125
|
+
Use `eslint-plugin-oxlint` for disabling unnecessary rules.
|
|
126
|
+
|
|
127
|
+
#### Prettier (Old School)
|
|
128
|
+
|
|
129
|
+
* Use `eslint-config-prettier` for disabling unnecessary rules.
|
|
130
|
+
* Use `eslint-plugin-prettier` for running `prettier` as eslint rule.
|
|
131
|
+
* Use `eslint-plugin-format` with rule `format/prettier` for running `prettier` as eslint rule (you probably will want to add `eslint-config-prettier` for disabling unnecessary rules).
|
|
105
132
|
|
|
106
133
|
## Supported Rules
|
|
107
134
|
|
|
108
135
|
Each rule has emojis denoting:
|
|
109
136
|
|
|
110
|
-
- ✅ if it belongs to the `recommended` configuration
|
|
137
|
+
- ✅ if it belongs to the one of `recommended` configuration
|
|
111
138
|
- 🔧 if some problems reported by the rule are automatically fixable by the `--fix` [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) option
|
|
112
139
|
- 💡 if some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions)
|
|
113
140
|
|
|
114
141
|
| Name | Description | ✅ | 🔧 | 💡 |
|
|
115
142
|
|:-----------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------|:--|:---|:---|
|
|
116
|
-
| [strict-observable-components-declaration](docs/rules/strict-observable-components-declaration.md) | Wrapping components in `observer` must comply with the regulations. |
|
|
143
|
+
| [strict-observable-components-declaration](docs/rules/strict-observable-components-declaration.md) | Wrapping components in `observer` must comply with the regulations. | ✅ | | |
|
|
117
144
|
| [require-observer](docs/rules/require-observer.md) | Components using the stores must be wrapped in an `observer` | ✅ | 🔧 | |
|
|
118
145
|
| [prevent-mixing-external-and-internal-classes](docs/rules/prevent-mixing-external-and-internal-classes.md) | Prevent mixing of outer and inner classes to avoid dependency on style order. | | | |
|
|
119
146
|
| [jsx-no-text-as-child](docs/rules/jsx-text-as-child.md) | JSX elements should not have text without translation | | | |
|
package/dist/configs/react.js
CHANGED
|
@@ -19,7 +19,10 @@ const config = [
|
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
|
-
|
|
22
|
+
{
|
|
23
|
+
name: 'react/recommended', // missed name, @see e.g. https://github.com/jsx-eslint/eslint-plugin-react/pull/3882
|
|
24
|
+
...reactPlugin.configs.flat.recommended,
|
|
25
|
+
},
|
|
23
26
|
{
|
|
24
27
|
name: '@dartess/eslint-plugin-react/jsx-runtime',
|
|
25
28
|
files: ['**/*.{jsx,tsx}'],
|
|
@@ -7,6 +7,8 @@ import eslintPluginImportX from 'eslint-plugin-import-x';
|
|
|
7
7
|
import eslintPluginUnicorn from 'eslint-plugin-unicorn';
|
|
8
8
|
import pluginJs from '@eslint/js';
|
|
9
9
|
import eslintCommentsPlugin from '@eslint-community/eslint-plugin-eslint-comments/configs';
|
|
10
|
+
// @ts-ignore: https://github.com/NullVoxPopuli/eslint-plugin-decorator-position/issues/778
|
|
11
|
+
import eslintPluginDecoratorPosition from 'eslint-plugin-decorator-position';
|
|
10
12
|
import dartessPlugin from "../index.js";
|
|
11
13
|
import vendorRulesBestPractices from "./vendor-rules/best-practices.js";
|
|
12
14
|
import vendorRulesErrors from "./vendor-rules/errors.js";
|
|
@@ -47,6 +49,8 @@ const config = [
|
|
|
47
49
|
plugins: {
|
|
48
50
|
unicorn: eslintPluginUnicorn,
|
|
49
51
|
'@dartess': dartessPlugin,
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- https://github.com/NullVoxPopuli/eslint-plugin-decorator-position/issues/778
|
|
53
|
+
'decorator-position': eslintPluginDecoratorPosition,
|
|
50
54
|
},
|
|
51
55
|
languageOptions: {
|
|
52
56
|
parser: tsEslint.parser,
|
|
@@ -95,6 +99,14 @@ const config = [
|
|
|
95
99
|
allowUnboundThis: true,
|
|
96
100
|
},
|
|
97
101
|
],
|
|
102
|
+
/* one line — one decorator */
|
|
103
|
+
'decorator-position/decorator-position': [
|
|
104
|
+
'error',
|
|
105
|
+
{
|
|
106
|
+
properties: 'above',
|
|
107
|
+
methods: 'above',
|
|
108
|
+
},
|
|
109
|
+
],
|
|
98
110
|
},
|
|
99
111
|
},
|
|
100
112
|
{
|
|
@@ -199,8 +211,16 @@ const config = [
|
|
|
199
211
|
allowNever: false,
|
|
200
212
|
},
|
|
201
213
|
],
|
|
202
|
-
'@typescript-eslint/no-import-type-side-effects': 'error', // TODO is enabled by default?
|
|
203
214
|
'@typescript-eslint/array-type': ['error', { default: 'generic' }],
|
|
215
|
+
/* this two rules help with three-shaking */
|
|
216
|
+
'@typescript-eslint/no-import-type-side-effects': 'error',
|
|
217
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
218
|
+
'error',
|
|
219
|
+
{
|
|
220
|
+
fixStyle: 'inline-type-imports',
|
|
221
|
+
disallowTypeAnnotations: false,
|
|
222
|
+
},
|
|
223
|
+
],
|
|
204
224
|
},
|
|
205
225
|
},
|
|
206
226
|
{
|
|
@@ -16,7 +16,6 @@ declare const rules: {
|
|
|
16
16
|
'max-classes-per-file': ["error", number];
|
|
17
17
|
'no-alert': "error";
|
|
18
18
|
'no-caller': "error";
|
|
19
|
-
'no-case-declarations': "error";
|
|
20
19
|
'no-constructor-return': "error";
|
|
21
20
|
'no-else-return': ["error", {
|
|
22
21
|
allowElseIf: boolean;
|
|
@@ -24,15 +23,10 @@ declare const rules: {
|
|
|
24
23
|
'no-empty-function': ["error", {
|
|
25
24
|
allow: string[];
|
|
26
25
|
}];
|
|
27
|
-
'no-empty-pattern': "error";
|
|
28
26
|
'no-eval': "error";
|
|
29
27
|
'no-extend-native': "error";
|
|
30
28
|
'no-extra-bind': "error";
|
|
31
29
|
'no-extra-label': "error";
|
|
32
|
-
'no-fallthrough': "error";
|
|
33
|
-
'no-global-assign': ["error", {
|
|
34
|
-
exceptions: never[];
|
|
35
|
-
}];
|
|
36
30
|
'no-iterator': "error";
|
|
37
31
|
'no-labels': ["error", {
|
|
38
32
|
allowLoop: boolean;
|
|
@@ -43,9 +37,7 @@ declare const rules: {
|
|
|
43
37
|
'no-multi-str': "error";
|
|
44
38
|
'no-new': "error";
|
|
45
39
|
'no-new-wrappers': "error";
|
|
46
|
-
'no-nonoctal-decimal-escape': "error";
|
|
47
40
|
'no-object-constructor': "error";
|
|
48
|
-
'no-octal': "error";
|
|
49
41
|
'no-octal-escape': "error";
|
|
50
42
|
'no-param-reassign': ["error", {
|
|
51
43
|
props: boolean;
|
|
@@ -93,16 +85,10 @@ declare const rules: {
|
|
|
93
85
|
}];
|
|
94
86
|
'no-return-assign': ["error", string];
|
|
95
87
|
'no-script-url': "error";
|
|
96
|
-
'no-self-assign': ["error", {
|
|
97
|
-
props: boolean;
|
|
98
|
-
}];
|
|
99
88
|
'no-self-compare': "error";
|
|
100
89
|
'no-sequences': "error";
|
|
101
90
|
'no-throw-literal': "error";
|
|
102
|
-
'no-unused-labels': "error";
|
|
103
|
-
'no-useless-catch': "error";
|
|
104
91
|
'no-useless-concat': "error";
|
|
105
|
-
'no-useless-escape': "error";
|
|
106
92
|
'no-useless-return': "error";
|
|
107
93
|
'no-void': "error";
|
|
108
94
|
'prefer-promise-reject-errors': ["error", {
|
|
@@ -35,9 +35,6 @@ const rules = {
|
|
|
35
35
|
// disallow use of arguments.caller or arguments.callee
|
|
36
36
|
// https://eslint.org/docs/rules/no-caller
|
|
37
37
|
'no-caller': 'error',
|
|
38
|
-
// disallow lexical declarations in case/default clauses
|
|
39
|
-
// https://eslint.org/docs/rules/no-case-declarations
|
|
40
|
-
'no-case-declarations': 'error',
|
|
41
38
|
// Disallow returning value in constructor
|
|
42
39
|
// https://eslint.org/docs/rules/no-constructor-return
|
|
43
40
|
'no-constructor-return': 'error',
|
|
@@ -52,9 +49,6 @@ const rules = {
|
|
|
52
49
|
allow: ['arrowFunctions', 'functions', 'methods'],
|
|
53
50
|
},
|
|
54
51
|
],
|
|
55
|
-
// disallow empty destructuring patterns
|
|
56
|
-
// https://eslint.org/docs/rules/no-empty-pattern
|
|
57
|
-
'no-empty-pattern': 'error',
|
|
58
52
|
// disallow use of eval()
|
|
59
53
|
// https://eslint.org/docs/rules/no-eval
|
|
60
54
|
'no-eval': 'error',
|
|
@@ -67,12 +61,6 @@ const rules = {
|
|
|
67
61
|
// disallow Unnecessary Labels
|
|
68
62
|
// https://eslint.org/docs/rules/no-extra-label
|
|
69
63
|
'no-extra-label': 'error',
|
|
70
|
-
// disallow fallthrough of case statements
|
|
71
|
-
// https://eslint.org/docs/rules/no-fallthrough
|
|
72
|
-
'no-fallthrough': 'error',
|
|
73
|
-
// disallow reassignments of native objects or read-only globals
|
|
74
|
-
// https://eslint.org/docs/rules/no-global-assign
|
|
75
|
-
'no-global-assign': ['error', { exceptions: [] }],
|
|
76
64
|
// disallow usage of __iterator__ property
|
|
77
65
|
// https://eslint.org/docs/rules/no-iterator
|
|
78
66
|
'no-iterator': 'error',
|
|
@@ -94,15 +82,9 @@ const rules = {
|
|
|
94
82
|
// disallows creating new instances of String, Number, and Boolean
|
|
95
83
|
// https://eslint.org/docs/rules/no-new-wrappers
|
|
96
84
|
'no-new-wrappers': 'error',
|
|
97
|
-
// Disallow \8 and \9 escape sequences in string literals
|
|
98
|
-
// https://eslint.org/docs/rules/no-nonoctal-decimal-escape
|
|
99
|
-
'no-nonoctal-decimal-escape': 'error',
|
|
100
85
|
// Disallow calls to the Object constructor without an argument
|
|
101
86
|
// https://eslint.org/docs/latest/rules/no-object-constructor
|
|
102
87
|
'no-object-constructor': 'error',
|
|
103
|
-
// disallow use of (old style) octal literals
|
|
104
|
-
// https://eslint.org/docs/rules/no-octal
|
|
105
|
-
'no-octal': 'error',
|
|
106
88
|
// disallow use of octal escape sequences in string literals, such as
|
|
107
89
|
// var foo = 'Copyright \251';
|
|
108
90
|
// https://eslint.org/docs/rules/no-octal-escape
|
|
@@ -183,14 +165,6 @@ const rules = {
|
|
|
183
165
|
// disallow use of `javascript:` urls.
|
|
184
166
|
// https://eslint.org/docs/rules/no-script-url
|
|
185
167
|
'no-script-url': 'error',
|
|
186
|
-
// disallow self assignment
|
|
187
|
-
// https://eslint.org/docs/rules/no-self-assign
|
|
188
|
-
'no-self-assign': [
|
|
189
|
-
'error',
|
|
190
|
-
{
|
|
191
|
-
props: true,
|
|
192
|
-
},
|
|
193
|
-
],
|
|
194
168
|
// disallow comparisons where both sides are exactly the same
|
|
195
169
|
// https://eslint.org/docs/rules/no-self-compare
|
|
196
170
|
'no-self-compare': 'error',
|
|
@@ -200,18 +174,9 @@ const rules = {
|
|
|
200
174
|
// restrict what can be thrown as an exception
|
|
201
175
|
// https://eslint.org/docs/rules/no-throw-literal
|
|
202
176
|
'no-throw-literal': 'error',
|
|
203
|
-
// disallow unused labels
|
|
204
|
-
// https://eslint.org/docs/rules/no-unused-labels
|
|
205
|
-
'no-unused-labels': 'error',
|
|
206
|
-
// Disallow unnecessary catch clauses
|
|
207
|
-
// https://eslint.org/docs/rules/no-useless-catch
|
|
208
|
-
'no-useless-catch': 'error',
|
|
209
177
|
// disallow useless string concatenation
|
|
210
178
|
// https://eslint.org/docs/rules/no-useless-concat
|
|
211
179
|
'no-useless-concat': 'error',
|
|
212
|
-
// disallow unnecessary string escaping
|
|
213
|
-
// https://eslint.org/docs/rules/no-useless-escape
|
|
214
|
-
'no-useless-escape': 'error',
|
|
215
180
|
// disallow redundant return; keywords
|
|
216
181
|
// https://eslint.org/docs/rules/no-useless-return
|
|
217
182
|
'no-useless-return': 'error',
|
|
@@ -1,37 +1,15 @@
|
|
|
1
1
|
declare const rules: {
|
|
2
|
-
'for-direction': "error";
|
|
3
|
-
'no-async-promise-executor': "error";
|
|
4
2
|
'no-await-in-loop': "error";
|
|
5
|
-
'no-compare-neg-zero': "error";
|
|
6
3
|
'no-cond-assign': ["error", string];
|
|
7
|
-
'no-control-regex': "error";
|
|
8
|
-
'no-debugger': "error";
|
|
9
|
-
'no-dupe-else-if': "error";
|
|
10
|
-
'no-duplicate-case': "error";
|
|
11
|
-
'no-empty': "error";
|
|
12
|
-
'no-empty-character-class': "error";
|
|
13
|
-
'no-ex-assign': "error";
|
|
14
|
-
'no-extra-boolean-cast': "error";
|
|
15
4
|
'no-inner-declarations': "error";
|
|
16
|
-
'no-invalid-regexp': "error";
|
|
17
|
-
'no-irregular-whitespace': "error";
|
|
18
|
-
'no-loss-of-precision': "error";
|
|
19
|
-
'no-misleading-character-class': "error";
|
|
20
5
|
'no-promise-executor-return': "error";
|
|
21
|
-
'no-prototype-builtins': "error";
|
|
22
|
-
'no-regex-spaces': "error";
|
|
23
|
-
'no-sparse-arrays': "error";
|
|
24
6
|
'no-template-curly-in-string': "error";
|
|
25
|
-
'no-unexpected-multiline': "error";
|
|
26
7
|
'no-unreachable-loop': ["error", {
|
|
27
8
|
ignore: never[];
|
|
28
9
|
}];
|
|
29
|
-
'no-unsafe-finally': "error";
|
|
30
10
|
'no-unsafe-optional-chaining': ["error", {
|
|
31
11
|
disallowArithmeticOperators: boolean;
|
|
32
12
|
}];
|
|
33
|
-
'no-useless-backreference': "error";
|
|
34
|
-
'use-isnan': "error";
|
|
35
13
|
'valid-jsdoc': "off";
|
|
36
14
|
'valid-typeof': ["error", {
|
|
37
15
|
requireStringLiterals: boolean;
|
|
@@ -3,66 +3,19 @@
|
|
|
3
3
|
// License: MIT (see LICENSE-eslint-config-airbnb.md file)
|
|
4
4
|
// Permalink: https://github.com/airbnb/javascript/blob/c25bce83be4db06e6a221d79686c485cd2ed5d5d/packages/eslint-config-airbnb-base/rules/errors.js
|
|
5
5
|
const rules = {
|
|
6
|
-
// Enforce “for” loop update clause moving the counter in the right direction
|
|
7
|
-
// https://eslint.org/docs/rules/for-direction
|
|
8
|
-
'for-direction': 'error',
|
|
9
|
-
// disallow using an async function as a Promise executor
|
|
10
|
-
// https://eslint.org/docs/rules/no-async-promise-executor
|
|
11
|
-
'no-async-promise-executor': 'error',
|
|
12
6
|
// Disallow await inside of loops
|
|
13
7
|
// https://eslint.org/docs/rules/no-await-in-loop
|
|
14
8
|
'no-await-in-loop': 'error',
|
|
15
|
-
// Disallow comparisons to negative zero
|
|
16
|
-
// https://eslint.org/docs/rules/no-compare-neg-zero
|
|
17
|
-
'no-compare-neg-zero': 'error',
|
|
18
9
|
// disallow assignment in conditional expressions
|
|
19
10
|
'no-cond-assign': ['error', 'always'],
|
|
20
|
-
// disallow control characters in regular expressions
|
|
21
|
-
'no-control-regex': 'error',
|
|
22
|
-
// disallow use of debugger
|
|
23
|
-
'no-debugger': 'error',
|
|
24
|
-
// Disallow duplicate conditions in if-else-if chains
|
|
25
|
-
// https://eslint.org/docs/rules/no-dupe-else-if
|
|
26
|
-
'no-dupe-else-if': 'error',
|
|
27
|
-
// disallow a duplicate case label.
|
|
28
|
-
'no-duplicate-case': 'error',
|
|
29
|
-
// disallow empty statements
|
|
30
|
-
'no-empty': 'error',
|
|
31
|
-
// disallow the use of empty character classes in regular expressions
|
|
32
|
-
'no-empty-character-class': 'error',
|
|
33
|
-
// disallow assigning to the exception in a catch block
|
|
34
|
-
'no-ex-assign': 'error',
|
|
35
|
-
// disallow double-negation boolean casts in a boolean context
|
|
36
|
-
// https://eslint.org/docs/rules/no-extra-boolean-cast
|
|
37
|
-
'no-extra-boolean-cast': 'error',
|
|
38
11
|
// disallow function or variable declarations in nested blocks
|
|
39
12
|
'no-inner-declarations': 'error',
|
|
40
|
-
// disallow invalid regular expression strings in the RegExp constructor
|
|
41
|
-
'no-invalid-regexp': 'error',
|
|
42
|
-
// disallow irregular whitespace outside of strings and comments
|
|
43
|
-
'no-irregular-whitespace': 'error',
|
|
44
|
-
// Disallow Number Literals That Lose Precision
|
|
45
|
-
// https://eslint.org/docs/rules/no-loss-of-precision
|
|
46
|
-
'no-loss-of-precision': 'error',
|
|
47
|
-
// Disallow characters which are made with multiple code points in character class syntax
|
|
48
|
-
// https://eslint.org/docs/rules/no-misleading-character-class
|
|
49
|
-
'no-misleading-character-class': 'error',
|
|
50
13
|
// Disallow returning values from Promise executor functions
|
|
51
14
|
// https://eslint.org/docs/rules/no-promise-executor-return
|
|
52
15
|
'no-promise-executor-return': 'error',
|
|
53
|
-
// disallow use of Object.prototypes builtins directly
|
|
54
|
-
// https://eslint.org/docs/rules/no-prototype-builtins
|
|
55
|
-
'no-prototype-builtins': 'error',
|
|
56
|
-
// disallow multiple spaces in a regular expression literal
|
|
57
|
-
'no-regex-spaces': 'error',
|
|
58
|
-
// disallow sparse arrays
|
|
59
|
-
'no-sparse-arrays': 'error',
|
|
60
16
|
// Disallow template literal placeholder syntax in regular strings
|
|
61
17
|
// https://eslint.org/docs/rules/no-template-curly-in-string
|
|
62
18
|
'no-template-curly-in-string': 'error',
|
|
63
|
-
// Avoid code that looks like two expressions but is actually one
|
|
64
|
-
// https://eslint.org/docs/rules/no-unexpected-multiline
|
|
65
|
-
'no-unexpected-multiline': 'error',
|
|
66
19
|
// Disallow loops with a body that allows only one iteration
|
|
67
20
|
// https://eslint.org/docs/rules/no-unreachable-loop
|
|
68
21
|
'no-unreachable-loop': [
|
|
@@ -71,17 +24,9 @@ const rules = {
|
|
|
71
24
|
ignore: [], // WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement
|
|
72
25
|
},
|
|
73
26
|
],
|
|
74
|
-
// disallow return/throw/break/continue inside finally blocks
|
|
75
|
-
// https://eslint.org/docs/rules/no-unsafe-finally
|
|
76
|
-
'no-unsafe-finally': 'error',
|
|
77
27
|
// disallow use of optional chaining in contexts where the undefined value is not allowed
|
|
78
28
|
// https://eslint.org/docs/rules/no-unsafe-optional-chaining
|
|
79
29
|
'no-unsafe-optional-chaining': ['error', { disallowArithmeticOperators: true }],
|
|
80
|
-
// Disallow useless backreferences in regular expressions
|
|
81
|
-
// https://eslint.org/docs/rules/no-useless-backreference
|
|
82
|
-
'no-useless-backreference': 'error',
|
|
83
|
-
// disallow comparisons with the value NaN
|
|
84
|
-
'use-isnan': 'error',
|
|
85
30
|
// ensure JSDoc comments are valid
|
|
86
31
|
// https://eslint.org/docs/rules/valid-jsdoc
|
|
87
32
|
'valid-jsdoc': 'off',
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
declare const rules: {
|
|
2
|
-
'arrow-body-style': ["error", string, {
|
|
3
|
-
requireReturnForObjectLiteral: boolean;
|
|
4
|
-
}];
|
|
5
|
-
'no-class-assign': "error";
|
|
6
2
|
'no-restricted-exports': ["error", {
|
|
7
3
|
restrictedNamedExports: string[];
|
|
8
4
|
}];
|
|
@@ -41,7 +37,6 @@ declare const rules: {
|
|
|
41
37
|
'prefer-rest-params': "error";
|
|
42
38
|
'prefer-spread': "error";
|
|
43
39
|
'prefer-template': "error";
|
|
44
|
-
'require-yield': "error";
|
|
45
40
|
'symbol-description': "error";
|
|
46
41
|
};
|
|
47
42
|
export default rules;
|
|
@@ -3,18 +3,6 @@
|
|
|
3
3
|
// License: MIT (see LICENSE-eslint-config-airbnb.md file)
|
|
4
4
|
// Permalink: https://github.com/airbnb/javascript/blob/c25bce83be4db06e6a221d79686c485cd2ed5d5d/packages/eslint-config-airbnb-base/rules/es6.js
|
|
5
5
|
const rules = {
|
|
6
|
-
// enforces no braces where they can be omitted
|
|
7
|
-
// https://eslint.org/docs/rules/arrow-body-style
|
|
8
|
-
'arrow-body-style': [
|
|
9
|
-
'error',
|
|
10
|
-
'as-needed',
|
|
11
|
-
{
|
|
12
|
-
requireReturnForObjectLiteral: false,
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
// disallow modifying variables of class declarations
|
|
16
|
-
// https://eslint.org/docs/rules/no-class-assign
|
|
17
|
-
'no-class-assign': 'error',
|
|
18
6
|
// Disallow specified names in exports
|
|
19
7
|
// https://eslint.org/docs/rules/no-restricted-exports
|
|
20
8
|
'no-restricted-exports': [
|
|
@@ -98,9 +86,6 @@ const rules = {
|
|
|
98
86
|
// suggest using template literals instead of string concatenation
|
|
99
87
|
// https://eslint.org/docs/rules/prefer-template
|
|
100
88
|
'prefer-template': 'error',
|
|
101
|
-
// disallow generator functions that do not have yield
|
|
102
|
-
// https://eslint.org/docs/rules/require-yield
|
|
103
|
-
'require-yield': 'error',
|
|
104
89
|
// require a Symbol description
|
|
105
90
|
// https://eslint.org/docs/rules/symbol-description
|
|
106
91
|
'symbol-description': 'error',
|
|
@@ -37,20 +37,14 @@ declare const rules: {
|
|
|
37
37
|
allowAllCaps: boolean;
|
|
38
38
|
ignore: never[];
|
|
39
39
|
}];
|
|
40
|
-
'react/jsx-uses-vars': "error";
|
|
41
40
|
'react/no-danger': "error";
|
|
42
|
-
'react/no-deprecated': ["error"];
|
|
43
41
|
'react/no-did-update-set-state': "error";
|
|
44
42
|
'react/no-will-update-set-state': "error";
|
|
45
43
|
'react/no-direct-mutation-state': "off";
|
|
46
|
-
'react/no-is-mounted': "error";
|
|
47
|
-
'react/no-string-refs': "error";
|
|
48
|
-
'react/no-unknown-property': "error";
|
|
49
44
|
'react/prefer-es6-class': ["error", string];
|
|
50
45
|
'react/prefer-stateless-function': ["error", {
|
|
51
46
|
ignorePureComponents: boolean;
|
|
52
47
|
}];
|
|
53
|
-
'react/require-render-return': "error";
|
|
54
48
|
'react/self-closing-comp': "error";
|
|
55
49
|
'react/sort-comp': ["error", {
|
|
56
50
|
order: string[];
|
|
@@ -77,13 +71,7 @@ declare const rules: {
|
|
|
77
71
|
'react/jsx-filename-extension': ["error", {
|
|
78
72
|
extensions: string[];
|
|
79
73
|
}];
|
|
80
|
-
'react/jsx-no-comment-textnodes': "error";
|
|
81
|
-
'react/no-render-return-value': "error";
|
|
82
|
-
'react/no-find-dom-node': "error";
|
|
83
|
-
'react/no-danger-with-children': "error";
|
|
84
74
|
'react/style-prop-object': "error";
|
|
85
|
-
'react/no-unescaped-entities': "error";
|
|
86
|
-
'react/no-children-prop': "error";
|
|
87
75
|
'react/jsx-tag-spacing': ["error", {
|
|
88
76
|
closingSlash: string;
|
|
89
77
|
beforeSelfClosing: string;
|
|
@@ -58,15 +58,9 @@ const rules = {
|
|
|
58
58
|
ignore: [],
|
|
59
59
|
},
|
|
60
60
|
],
|
|
61
|
-
// Prevent variables used in JSX to be incorrectly marked as unused
|
|
62
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
|
|
63
|
-
'react/jsx-uses-vars': 'error',
|
|
64
61
|
// Prevent usage of dangerous JSX properties
|
|
65
62
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger.md
|
|
66
63
|
'react/no-danger': 'error',
|
|
67
|
-
// Prevent usage of deprecated methods
|
|
68
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
|
|
69
|
-
'react/no-deprecated': ['error'],
|
|
70
64
|
// Prevent usage of setState in componentDidUpdate
|
|
71
65
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
|
|
72
66
|
'react/no-did-update-set-state': 'error',
|
|
@@ -76,24 +70,12 @@ const rules = {
|
|
|
76
70
|
// Prevent direct mutation of this.state
|
|
77
71
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
|
|
78
72
|
'react/no-direct-mutation-state': 'off',
|
|
79
|
-
// Prevent usage of isMounted
|
|
80
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
|
|
81
|
-
'react/no-is-mounted': 'error',
|
|
82
|
-
// Prevent using string references
|
|
83
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
|
|
84
|
-
'react/no-string-refs': 'error',
|
|
85
|
-
// Prevent usage of unknown DOM property
|
|
86
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
|
|
87
|
-
'react/no-unknown-property': 'error',
|
|
88
73
|
// Require ES6 class declarations over React.createClass
|
|
89
74
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
|
|
90
75
|
'react/prefer-es6-class': ['error', 'always'],
|
|
91
76
|
// Require stateless functions when not using lifecycle methods, setState or ref
|
|
92
77
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
|
|
93
78
|
'react/prefer-stateless-function': ['error', { ignorePureComponents: true }],
|
|
94
|
-
// Require render() methods to return something
|
|
95
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
|
|
96
|
-
'react/require-render-return': 'error',
|
|
97
79
|
// Prevent extra closing tags for components without children
|
|
98
80
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
|
|
99
81
|
'react/self-closing-comp': 'error',
|
|
@@ -177,27 +159,9 @@ const rules = {
|
|
|
177
159
|
// only .jsx files may have JSX
|
|
178
160
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
|
|
179
161
|
'react/jsx-filename-extension': ['error', { extensions: ['.jsx'] }],
|
|
180
|
-
// prevent accidental JS comments from being injected into JSX as text
|
|
181
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
|
|
182
|
-
'react/jsx-no-comment-textnodes': 'error',
|
|
183
|
-
// disallow using React.render/ReactDOM.render's return value
|
|
184
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
|
|
185
|
-
'react/no-render-return-value': 'error',
|
|
186
|
-
// warn against using findDOMNode()
|
|
187
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
|
|
188
|
-
'react/no-find-dom-node': 'error',
|
|
189
|
-
// Prevent problem with children and props.dangerouslySetInnerHTML
|
|
190
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
|
|
191
|
-
'react/no-danger-with-children': 'error',
|
|
192
162
|
// Require style prop value be an object or var
|
|
193
163
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
|
|
194
164
|
'react/style-prop-object': 'error',
|
|
195
|
-
// Prevent invalid characters from appearing in markup
|
|
196
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
|
|
197
|
-
'react/no-unescaped-entities': 'error',
|
|
198
|
-
// Prevent passing of children as props
|
|
199
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
|
|
200
|
-
'react/no-children-prop': 'error',
|
|
201
165
|
// Validate whitespace in and around the JSX opening and closing brackets
|
|
202
166
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/jsx-tag-spacing.md
|
|
203
167
|
'react/jsx-tag-spacing': [
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
declare const rules: {
|
|
2
|
-
'no-delete-var': "error";
|
|
3
2
|
'no-label-var': "error";
|
|
4
3
|
'no-restricted-globals': ["error", {
|
|
5
4
|
name: string;
|
|
@@ -12,7 +11,6 @@ declare const rules: {
|
|
|
12
11
|
message: string;
|
|
13
12
|
}[]];
|
|
14
13
|
'no-shadow': "error";
|
|
15
|
-
'no-shadow-restricted-names': "error";
|
|
16
14
|
'no-undef-init': "error";
|
|
17
15
|
'no-unused-vars': ["error", {
|
|
18
16
|
vars: string;
|
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
// Permalink: https://github.com/airbnb/javascript/blob/c25bce83be4db06e6a221d79686c485cd2ed5d5d/packages/eslint-config-airbnb-base/rules/variables.js
|
|
5
5
|
import confusingBrowserGlobals from 'confusing-browser-globals';
|
|
6
6
|
const rules = {
|
|
7
|
-
// disallow deletion of variables
|
|
8
|
-
'no-delete-var': 'error',
|
|
9
7
|
// disallow labels that share a name with a variable
|
|
10
8
|
// https://eslint.org/docs/rules/no-label-var
|
|
11
9
|
'no-label-var': 'error',
|
|
@@ -27,8 +25,6 @@ const rules = {
|
|
|
27
25
|
],
|
|
28
26
|
// disallow declaration of variables already declared in the outer scope
|
|
29
27
|
'no-shadow': 'error',
|
|
30
|
-
// disallow shadowing of names such as arguments
|
|
31
|
-
'no-shadow-restricted-names': 'error',
|
|
32
28
|
// disallow use of undefined when initializing variables
|
|
33
29
|
'no-undef-init': 'error',
|
|
34
30
|
// disallow declaration of variables that are not used in the code
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dartess/eslint-plugin",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"description": "A set of rules and configs for various
|
|
4
|
+
"version": "0.0.6",
|
|
5
|
+
"description": "A set of rules and configs for various TypeScript projects",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"eslint",
|
|
8
|
-
"eslint-plugin"
|
|
8
|
+
"eslint-plugin",
|
|
9
|
+
"eslint-config-airbnb",
|
|
10
|
+
"eslint-config-airbnb-typescript"
|
|
9
11
|
],
|
|
10
12
|
"author": "Sergey Kozlov",
|
|
11
13
|
"main": "./dist/index.js",
|
|
@@ -22,6 +24,7 @@
|
|
|
22
24
|
},
|
|
23
25
|
"scripts": {
|
|
24
26
|
"lint": "eslint .",
|
|
27
|
+
"lint:fix": "npm run lint -- --fix",
|
|
25
28
|
"clean": "rimraf dist",
|
|
26
29
|
"build": "npm run clean && tsc -p tsconfig.build.json",
|
|
27
30
|
"test": "node --import ./test-setup.ts --test --experimental-strip-types",
|
|
@@ -47,6 +50,7 @@
|
|
|
47
50
|
"@next/eslint-plugin-next": "^16.0.0",
|
|
48
51
|
"eslint": "^9.0.0",
|
|
49
52
|
"eslint-import-resolver-typescript": "^4.0.0",
|
|
53
|
+
"eslint-plugin-decorator-position": "^6.0.0",
|
|
50
54
|
"eslint-plugin-import-x": "^4.1.0",
|
|
51
55
|
"eslint-plugin-jsx-a11y": "^6.10.0",
|
|
52
56
|
"eslint-plugin-mobx": "~0.0.13",
|
|
@@ -80,9 +84,6 @@
|
|
|
80
84
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
81
85
|
"@eslint/js": "^9.39.2",
|
|
82
86
|
"@types/confusing-browser-globals": "^1.0.3",
|
|
83
|
-
"@types/eslint": "^9.6.1",
|
|
84
|
-
"@types/eslint__js": "^8.42.3",
|
|
85
|
-
"@types/eslint-config-prettier": "^6.11.3",
|
|
86
87
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
87
88
|
"@types/eslint-plugin-mobx": "~0.0.0",
|
|
88
89
|
"@types/node": "^25.0.2",
|