@ntnyq/eslint-config 4.0.0-beta.1 → 4.0.0-beta.11
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/README.md +51 -13
- package/dist/index.d.ts +15462 -14302
- package/dist/index.js +1483 -1172
- package/package.json +56 -42
package/README.md
CHANGED
|
@@ -15,12 +15,24 @@
|
|
|
15
15
|
- Out-of-box support for TypeScript, Vue, JSON, Markdown, YAML, TOML, SVG and etc
|
|
16
16
|
- Strict but provides useful rules to guard your codebase
|
|
17
17
|
- Custom ESLint commands for [eslint-plugin-command](https://github.com/antfu/eslint-plugin-command)
|
|
18
|
-
- [ESLint flat config](https://eslint.org/docs/latest/use/configure/configuration-files) for ESLint v9.
|
|
18
|
+
- [ESLint flat config](https://eslint.org/docs/latest/use/configure/configuration-files) for ESLint v9.20.0+
|
|
19
19
|
|
|
20
20
|
## Install
|
|
21
21
|
|
|
22
22
|
```shell
|
|
23
|
-
|
|
23
|
+
npm i eslint typescript @ntnyq/eslint-config -D
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```shell
|
|
27
|
+
yarn add eslint typescript @ntnyq/eslint-config -D
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```shell
|
|
31
|
+
pnpm add eslint typescript @ntnyq/eslint-config -D
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```shell
|
|
35
|
+
bun add eslint typescript @ntnyq/eslint-config -D
|
|
24
36
|
```
|
|
25
37
|
|
|
26
38
|
## Usage
|
|
@@ -40,8 +52,8 @@ Add scripts `lint` in `package.json`:
|
|
|
40
52
|
```json
|
|
41
53
|
{
|
|
42
54
|
"scripts": {
|
|
43
|
-
"lint": "eslint
|
|
44
|
-
"lint:fix": "eslint
|
|
55
|
+
"lint": "eslint",
|
|
56
|
+
"lint:fix": "eslint --fix"
|
|
45
57
|
}
|
|
46
58
|
}
|
|
47
59
|
```
|
|
@@ -53,7 +65,26 @@ Add scripts `lint` in `package.json`:
|
|
|
53
65
|
|
|
54
66
|
## Prettier config
|
|
55
67
|
|
|
68
|
+
Install `prettier` and setup your prettier config:
|
|
69
|
+
|
|
70
|
+
```shell
|
|
71
|
+
npm i prettier @ntnyq/prettier-config -D
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```shell
|
|
75
|
+
yarn add prettier @ntnyq/prettier-config -D
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```shell
|
|
79
|
+
pnpm add prettier @ntnyq/prettier-config -D
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```shell
|
|
83
|
+
bun add prettier @ntnyq/prettier-config -D
|
|
84
|
+
```
|
|
85
|
+
|
|
56
86
|
```js
|
|
87
|
+
// prettier.config.mjs
|
|
57
88
|
// @ts-check
|
|
58
89
|
|
|
59
90
|
import { config, defineConfig } from '@ntnyq/prettier-config'
|
|
@@ -86,12 +117,13 @@ export default defineConfig({
|
|
|
86
117
|
"eslint.enable": true,
|
|
87
118
|
"prettier.enable": true,
|
|
88
119
|
"editor.formatOnSave": true,
|
|
120
|
+
"prettier.configPath": "./prettier.config.mjs",
|
|
121
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
89
122
|
"editor.codeActionsOnSave": {
|
|
90
123
|
"source.fixAll.eslint": "explicit",
|
|
91
124
|
"source.organizeImports": "never",
|
|
92
125
|
"source.sortImports": "never"
|
|
93
126
|
},
|
|
94
|
-
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
95
127
|
"eslint.validate": [
|
|
96
128
|
"vue",
|
|
97
129
|
"yaml",
|
|
@@ -124,7 +156,7 @@ pnpm add husky nano-staged -D
|
|
|
124
156
|
"prepare": "husky"
|
|
125
157
|
},
|
|
126
158
|
"nano-staged": {
|
|
127
|
-
"*.{js,ts,cjs,mjs,jsx,tsx,vue,md,svg,
|
|
159
|
+
"*.{js,ts,cjs,mjs,jsx,tsx,vue,md,svg,yml,yaml,toml,json}": "eslint --fix",
|
|
128
160
|
"*.{css,scss,html}": "prettier -uw"
|
|
129
161
|
}
|
|
130
162
|
}
|
|
@@ -148,9 +180,18 @@ Check for detail in:
|
|
|
148
180
|
### Config interface
|
|
149
181
|
|
|
150
182
|
```ts
|
|
151
|
-
export interface ConfigOptions
|
|
183
|
+
export interface ConfigOptions {
|
|
184
|
+
/**
|
|
185
|
+
* Shareable options
|
|
186
|
+
*/
|
|
187
|
+
shareable?: OptionsShareable
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Configs enabled by default
|
|
191
|
+
* @pg
|
|
192
|
+
*/
|
|
152
193
|
command?: ConfigCommandOptions
|
|
153
|
-
|
|
194
|
+
eslintComments?: ConfigESLintCommentsOptions
|
|
154
195
|
ignores?: ConfigIgnoresOptions
|
|
155
196
|
importX?: ConfigImportXOptions
|
|
156
197
|
javascript?: ConfigJavaScriptOptions
|
|
@@ -159,9 +200,10 @@ export interface ConfigOptions extends ConfigOptionsInternal, OptionsExtensions
|
|
|
159
200
|
specials?: ConfigSpecialsOptions
|
|
160
201
|
|
|
161
202
|
/**
|
|
162
|
-
* bellow can be disabled
|
|
203
|
+
* Configs bellow can be disabled
|
|
163
204
|
*/
|
|
164
205
|
antfu?: boolean | ConfigAntfuOptions
|
|
206
|
+
deMorgan?: boolean | ConfigDeMorganOptions
|
|
165
207
|
depend?: boolean | ConfigDependOptions
|
|
166
208
|
githubAction?: boolean | ConfigGitHubActionOptions
|
|
167
209
|
gitignore?: boolean | ConfigGitIgnoreOptions
|
|
@@ -180,16 +222,12 @@ export interface ConfigOptions extends ConfigOptionsInternal, OptionsExtensions
|
|
|
180
222
|
unocss?: boolean | ConfigUnoCSSOptions
|
|
181
223
|
vue?: boolean | ConfigVueOptions
|
|
182
224
|
yml?: boolean | ConfigYmlOptions
|
|
183
|
-
|
|
184
225
|
/**
|
|
185
226
|
* disabled by default
|
|
186
227
|
*/
|
|
187
228
|
svgo?: boolean | ConfigSVGOOptions
|
|
188
|
-
|
|
189
229
|
/**
|
|
190
230
|
* disabled by default
|
|
191
|
-
*
|
|
192
|
-
* require `eslint-plugin-eslint-plugin` installed mannally
|
|
193
231
|
*/
|
|
194
232
|
eslintPlugin?: boolean | ConfigESLintPluginOptions
|
|
195
233
|
}
|