@dartess/eslint-plugin 0.0.2 → 0.0.4
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 +9 -0
- package/README.md +50 -23
- package/dist/configs/mobx.js +1 -0
- package/dist/configs/react.js +4 -1
- package/dist/configs/recommended.js +9 -1
- package/dist/configs/vendor-rules/es6.d.ts +0 -3
- package/dist/configs/vendor-rules/es6.js +0 -9
- package/dist/index.d.ts +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
[//]: # (https://keepachangelog.com/en/1.1.0/)
|
|
4
4
|
|
|
5
|
+
## [0.0.4] - 2025-12-27
|
|
6
|
+
|
|
7
|
+
- remove `arrow-body-style` from 'recommeded': not relevant for typed code
|
|
8
|
+
- add `@typescript-eslint/consistent-type-imports` to `recommeded`: it helps with three-shaking
|
|
9
|
+
|
|
10
|
+
## [0.0.3] - 2025-12-25
|
|
11
|
+
|
|
12
|
+
- disable recommended `mobx/missing-make-observable`: this rule useless with modern decorators syntax
|
|
13
|
+
|
|
5
14
|
## [0.0.2] - 2025-12-20
|
|
6
15
|
|
|
7
16
|
- mark optional deps as "optional" in "peerDependenciesMeta"
|
package/README.md
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
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
|
+
All of it pinched with extra configs, setups and extra rules. Just take it and use it!
|
|
19
|
+
|
|
20
|
+
### Notes
|
|
21
|
+
|
|
22
|
+
1. The package is intended for use with TypeScript (it'll be useful for plain JS, but it hasn't been weel-tested).
|
|
23
|
+
|
|
24
|
+
2. The package is intended for use only with the `flat` eslint config.
|
|
25
|
+
|
|
26
|
+
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
27
|
|
|
5
28
|
## Installation
|
|
6
29
|
|
|
7
|
-
You'll first need to install [ESLint](https://eslint.org/) and
|
|
30
|
+
You'll first need to install [ESLint](https://eslint.org/) and peer deps:
|
|
8
31
|
|
|
9
32
|
```sh
|
|
10
33
|
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 +48,7 @@ npm i -D eslint-plugin-mobx
|
|
|
25
48
|
npm i -D eslint-plugin-storybook
|
|
26
49
|
```
|
|
27
50
|
|
|
28
|
-
Next, install `@dartess/eslint-plugin`
|
|
51
|
+
Next, install `@dartess/eslint-plugin` itself.
|
|
29
52
|
|
|
30
53
|
```sh
|
|
31
54
|
npm i -D @dartess/eslint-plugin
|
|
@@ -52,7 +75,7 @@ import dartessEslintPluginStorybook from '@dartess/eslint-plugin/storybook';
|
|
|
52
75
|
import { parseGitIgnore } from '@dartess/eslint-plugin/utils';
|
|
53
76
|
|
|
54
77
|
export default [
|
|
55
|
-
parseGitIgnore(), // the easiest way to ignore all `.gitignore` files
|
|
78
|
+
parseGitIgnore(), // (optional) the easiest way to ignore all `.gitignore` files
|
|
56
79
|
|
|
57
80
|
{
|
|
58
81
|
languageOptions: {
|
|
@@ -75,43 +98,47 @@ export default [
|
|
|
75
98
|
|
|
76
99
|
```
|
|
77
100
|
|
|
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
101
|
## Next steps
|
|
85
102
|
|
|
86
|
-
If you'
|
|
103
|
+
If you're using React, you also probably will want to add
|
|
87
104
|
[eslint-plugin-react-refresh](https://www.npmjs.com/package/eslint-plugin-react-refresh).
|
|
88
105
|
This plugin requires manual setup for you build tools.
|
|
89
106
|
|
|
90
|
-
|
|
107
|
+
If you're using Mobx with legacy decorators, you have to enable rule `mobx/missing-make-observable` manually.
|
|
91
108
|
|
|
92
|
-
|
|
109
|
+
### Formatters
|
|
93
110
|
|
|
94
|
-
|
|
111
|
+
If you're want to (and you should to) use formatting tools, you need to additionally install and setup something else.
|
|
95
112
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
113
|
+
#### dprint
|
|
114
|
+
|
|
115
|
+
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).
|
|
116
|
+
|
|
117
|
+
#### Biome
|
|
118
|
+
|
|
119
|
+
Use `eslint-config-biome` for disabling unnecessary rules.
|
|
120
|
+
|
|
121
|
+
#### Oxlint
|
|
122
|
+
|
|
123
|
+
Use `eslint-plugin-oxlint` for disabling unnecessary rules.
|
|
124
|
+
|
|
125
|
+
#### Prettier (Old School)
|
|
126
|
+
|
|
127
|
+
* Use `eslint-config-prettier` for disabling unnecessary rules.
|
|
128
|
+
* Use `eslint-plugin-prettier` for running `prettier` as eslint rule.
|
|
129
|
+
* 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).
|
|
103
130
|
|
|
104
131
|
## Supported Rules
|
|
105
132
|
|
|
106
133
|
Each rule has emojis denoting:
|
|
107
134
|
|
|
108
|
-
- ✅ if it belongs to the `recommended` configuration
|
|
135
|
+
- ✅ if it belongs to the one of `recommended` configuration
|
|
109
136
|
- 🔧 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
|
|
110
137
|
- 💡 if some problems reported by the rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions)
|
|
111
138
|
|
|
112
139
|
| Name | Description | ✅ | 🔧 | 💡 |
|
|
113
140
|
|:-----------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------|:--|:---|:---|
|
|
114
|
-
| [strict-observable-components-declaration](docs/rules/strict-observable-components-declaration.md) | Wrapping components in `observer` must comply with the regulations. |
|
|
141
|
+
| [strict-observable-components-declaration](docs/rules/strict-observable-components-declaration.md) | Wrapping components in `observer` must comply with the regulations. | ✅ | | |
|
|
115
142
|
| [require-observer](docs/rules/require-observer.md) | Components using the stores must be wrapped in an `observer` | ✅ | 🔧 | |
|
|
116
143
|
| [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. | | | |
|
|
117
144
|
| [jsx-no-text-as-child](docs/rules/jsx-text-as-child.md) | JSX elements should not have text without translation | | | |
|
package/dist/configs/mobx.js
CHANGED
|
@@ -5,6 +5,7 @@ const config = [
|
|
|
5
5
|
name: '@dartess/mobx',
|
|
6
6
|
rules: {
|
|
7
7
|
'mobx/missing-observer': 'off', // replaced by the neater "@dartess/require-observer"
|
|
8
|
+
'mobx/missing-make-observable': 'off', // useless with modern decorators syntax
|
|
8
9
|
'@dartess/strict-observable-components-declaration': 'error',
|
|
9
10
|
'@dartess/require-observer': 'error',
|
|
10
11
|
},
|
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}'],
|
|
@@ -199,8 +199,16 @@ const config = [
|
|
|
199
199
|
allowNever: false,
|
|
200
200
|
},
|
|
201
201
|
],
|
|
202
|
-
'@typescript-eslint/no-import-type-side-effects': 'error', // TODO is enabled by default?
|
|
203
202
|
'@typescript-eslint/array-type': ['error', { default: 'generic' }],
|
|
203
|
+
/* this two rules help with three-shaking */
|
|
204
|
+
'@typescript-eslint/no-import-type-side-effects': 'error',
|
|
205
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
206
|
+
'error',
|
|
207
|
+
{
|
|
208
|
+
fixStyle: 'inline-type-imports',
|
|
209
|
+
disallowTypeAnnotations: false,
|
|
210
|
+
},
|
|
211
|
+
],
|
|
204
212
|
},
|
|
205
213
|
},
|
|
206
214
|
{
|
|
@@ -3,15 +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
6
|
// disallow modifying variables of class declarations
|
|
16
7
|
// https://eslint.org/docs/rules/no-class-assign
|
|
17
8
|
'no-class-assign': 'error',
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dartess/eslint-plugin",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.4",
|
|
5
5
|
"description": "A set of rules and configs for various react projects",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"eslint",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"lint": "eslint .",
|
|
25
|
+
"lint:fix": "npm run lint -- --fix",
|
|
25
26
|
"clean": "rimraf dist",
|
|
26
27
|
"build": "npm run clean && tsc -p tsconfig.build.json",
|
|
27
28
|
"test": "node --import ./test-setup.ts --test --experimental-strip-types",
|