@dartess/eslint-plugin 0.2.0 → 0.2.1
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 +4 -0
- package/README.md +34 -15
- package/dist/configs/post-format.d.ts +3 -0
- package/dist/configs/post-format.js +9 -0
- package/dist/configs/recommended.js +0 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -30,10 +30,18 @@ All of it pinched with extra configs, setups and extra rules. Just take it and u
|
|
|
30
30
|
|
|
31
31
|
## Installation
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Install [ESLint](https://eslint.org/), required peer deps and the plugin itself:
|
|
34
34
|
|
|
35
35
|
```sh
|
|
36
|
-
npm i -D eslint
|
|
36
|
+
npm i -D eslint \
|
|
37
|
+
eslint-plugin-import-x \
|
|
38
|
+
eslint-import-resolver-typescript \
|
|
39
|
+
eslint-plugin-unicorn \
|
|
40
|
+
eslint-plugin-decorator-position \
|
|
41
|
+
eslint-plugin-de-morgan \
|
|
42
|
+
typescript-eslint \
|
|
43
|
+
@eslint-community/eslint-plugin-eslint-comments \
|
|
44
|
+
@dartess/eslint-plugin
|
|
37
45
|
```
|
|
38
46
|
|
|
39
47
|
Next, also install the packages that suit your needs.
|
|
@@ -51,12 +59,6 @@ npm i -D eslint-plugin-mobx
|
|
|
51
59
|
npm i -D eslint-plugin-storybook
|
|
52
60
|
```
|
|
53
61
|
|
|
54
|
-
Next, install `@dartess/eslint-plugin` itself.
|
|
55
|
-
|
|
56
|
-
```sh
|
|
57
|
-
npm i -D @dartess/eslint-plugin
|
|
58
|
-
```
|
|
59
|
-
|
|
60
62
|
## Usage configs
|
|
61
63
|
|
|
62
64
|
Shared config based on `eslint-config-airbnb`, `eslint-config-airbnb-typescript`, `eslint-plugin-react/recommended`, `eslint-plugin-react/jsx-runtime`.
|
|
@@ -65,6 +67,7 @@ Edit or create `eslint.config.ts` (or `eslint.config.mts`). You probably have to
|
|
|
65
67
|
|
|
66
68
|
```ts
|
|
67
69
|
import dartessEslintPluginRecommended from '@dartess/eslint-plugin/recommended';
|
|
70
|
+
import dartessEslintPluginRecommendedPostFormat from '@dartess/eslint-plugin/recommended-post-format';
|
|
68
71
|
|
|
69
72
|
// if `react` is used
|
|
70
73
|
import dartessEslintPluginReact from '@dartess/eslint-plugin/react';
|
|
@@ -89,6 +92,7 @@ export default [
|
|
|
89
92
|
},
|
|
90
93
|
|
|
91
94
|
...dartessEslintPluginRecommended,
|
|
95
|
+
|
|
92
96
|
// if `react` is used
|
|
93
97
|
...dartessEslintPluginReact,
|
|
94
98
|
// if `next.js` is used
|
|
@@ -97,21 +101,26 @@ export default [
|
|
|
97
101
|
...dartessEslintPluginMobx,
|
|
98
102
|
// if `storybook` is used
|
|
99
103
|
...dartessEslintPluginStorybook,
|
|
104
|
+
|
|
105
|
+
// <-- Put here your formatters congifs -->
|
|
106
|
+
// @see `Fine Tuning` -> `Formatters` section below
|
|
107
|
+
|
|
108
|
+
...dartessEslintPluginRecommendedPostFormat,
|
|
100
109
|
]
|
|
101
110
|
|
|
102
111
|
```
|
|
103
112
|
|
|
104
|
-
##
|
|
113
|
+
## Fine Tuning
|
|
105
114
|
|
|
106
|
-
|
|
107
|
-
[eslint-plugin-react-refresh](https://www.npmjs.com/package/eslint-plugin-react-refresh).
|
|
108
|
-
This plugin requires manual setup for you build tools.
|
|
115
|
+
### Formatting tools
|
|
109
116
|
|
|
110
|
-
If you're
|
|
117
|
+
If you're want to (and you should to) use formatting tools, you need to additionally install and setup something else.
|
|
111
118
|
|
|
112
|
-
|
|
119
|
+
Replace the `<-- Put here your formatters congifs -->` comment with the required code, beacuse we have a special config
|
|
120
|
+
that fine-tunes formatter behavior and should be applied afterward.
|
|
113
121
|
|
|
114
|
-
|
|
122
|
+
In case you for some reason don't want to use any formatting tools, you still have to put
|
|
123
|
+
`...dartessEslintPluginRecommendedPostFormat` in any place of your config.
|
|
115
124
|
|
|
116
125
|
#### dprint
|
|
117
126
|
|
|
@@ -131,6 +140,16 @@ Use `eslint-plugin-oxlint` for disabling unnecessary rules.
|
|
|
131
140
|
* Or use `eslint-plugin-prettier` for running `prettier` as eslint rule.
|
|
132
141
|
* Or 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).
|
|
133
142
|
|
|
143
|
+
### (for React users)
|
|
144
|
+
|
|
145
|
+
If you're using React, you also probably will want to add
|
|
146
|
+
[eslint-plugin-react-refresh](https://www.npmjs.com/package/eslint-plugin-react-refresh).
|
|
147
|
+
This plugin requires manual setup for you build tools.
|
|
148
|
+
|
|
149
|
+
### (for Mobx users)
|
|
150
|
+
|
|
151
|
+
If you're using Mobx with legacy decorators, you have to enable rule `mobx/missing-make-observable` manually.
|
|
152
|
+
|
|
134
153
|
## Supported Rules
|
|
135
154
|
|
|
136
155
|
Each rule has emojis denoting:
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dartess/eslint-plugin",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"description": "A set of rules and configs for various TypeScript projects",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"eslint",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"exports": {
|
|
17
17
|
".": "./dist/index.js",
|
|
18
18
|
"./recommended": "./dist/configs/recommended.js",
|
|
19
|
+
"./recommended-post-format": "./dist/configs/post-format.js",
|
|
19
20
|
"./react": "./dist/configs/react.js",
|
|
20
21
|
"./next": "./dist/configs/next.js",
|
|
21
22
|
"./mobx": "./dist/configs/mobx.js",
|