@ntnyq/eslint-config 3.12.3 → 4.0.0-beta.10
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 +22 -23
- package/dist/index.d.ts +15462 -18228
- package/dist/index.js +1598 -1545
- package/package.json +71 -66
- package/dist/index.cjs +0 -3562
- package/dist/index.d.cts +0 -18565
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# eslint-config
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> ESLint config for JavaScript, TypeScript, Vue, JSON, Markdown, YAML, TOML, SVG and etc.
|
|
4
4
|
|
|
5
5
|
[](https://github.com/ntnyq/eslint-config/actions)
|
|
6
6
|
[](https://www.npmjs.com/package/@ntnyq/eslint-config/v/latest)
|
|
@@ -9,18 +9,18 @@
|
|
|
9
9
|
|
|
10
10
|
## Features
|
|
11
11
|
|
|
12
|
-
- Opinionable: single quotes, no semi, trailing comma, etc
|
|
13
12
|
- Designed to work alongside with [Prettier](https://prettier.io)
|
|
13
|
+
- Opinionable: single quote, no semi, trailing comma, etc
|
|
14
14
|
- Respect `.gitignore` via [eslint-config-flat-gitignore](https://github.com/antfu/eslint-config-flat-gitignore)
|
|
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
|
-
```
|
|
23
|
-
pnpm add eslint
|
|
22
|
+
```shell
|
|
23
|
+
pnpm add eslint typescript @ntnyq/eslint-config -D
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
## Usage
|
|
@@ -53,7 +53,14 @@ Add scripts `lint` in `package.json`:
|
|
|
53
53
|
|
|
54
54
|
## Prettier config
|
|
55
55
|
|
|
56
|
+
Install `prettier` and setup your prettier config:
|
|
57
|
+
|
|
58
|
+
```shell
|
|
59
|
+
pnpm add prettier @ntnyq/prettier-config -D
|
|
60
|
+
```
|
|
61
|
+
|
|
56
62
|
```js
|
|
63
|
+
// prettier.config.mjs
|
|
57
64
|
// @ts-check
|
|
58
65
|
|
|
59
66
|
import { config, defineConfig } from '@ntnyq/prettier-config'
|
|
@@ -86,14 +93,15 @@ export default defineConfig({
|
|
|
86
93
|
"eslint.enable": true,
|
|
87
94
|
"prettier.enable": true,
|
|
88
95
|
"editor.formatOnSave": true,
|
|
96
|
+
"prettier.configPath": "./prettier.config.mjs",
|
|
97
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
89
98
|
"editor.codeActionsOnSave": {
|
|
90
99
|
"source.fixAll.eslint": "explicit",
|
|
91
|
-
"source.organizeImports": "never"
|
|
100
|
+
"source.organizeImports": "never",
|
|
101
|
+
"source.sortImports": "never"
|
|
92
102
|
},
|
|
93
|
-
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
94
103
|
"eslint.validate": [
|
|
95
104
|
"vue",
|
|
96
|
-
"html",
|
|
97
105
|
"yaml",
|
|
98
106
|
"toml",
|
|
99
107
|
"json",
|
|
@@ -124,7 +132,8 @@ pnpm add husky nano-staged -D
|
|
|
124
132
|
"prepare": "husky"
|
|
125
133
|
},
|
|
126
134
|
"nano-staged": {
|
|
127
|
-
"*.{js,ts,cjs,mjs,jsx,tsx,vue,md,
|
|
135
|
+
"*.{js,ts,cjs,mjs,jsx,tsx,vue,md,svg,json,toml,yml,yaml}": "eslint --fix",
|
|
136
|
+
"*.{css,scss,html}": "prettier -uw"
|
|
128
137
|
}
|
|
129
138
|
}
|
|
130
139
|
```
|
|
@@ -147,9 +156,9 @@ Check for detail in:
|
|
|
147
156
|
### Config interface
|
|
148
157
|
|
|
149
158
|
```ts
|
|
150
|
-
export interface ConfigOptions extends
|
|
159
|
+
export interface ConfigOptions extends OptionsExtensions {
|
|
151
160
|
command?: ConfigCommandOptions
|
|
152
|
-
|
|
161
|
+
eslintComments?: ConfigESLintCommentsOptions
|
|
153
162
|
ignores?: ConfigIgnoresOptions
|
|
154
163
|
importX?: ConfigImportXOptions
|
|
155
164
|
javascript?: ConfigJavaScriptOptions
|
|
@@ -158,9 +167,10 @@ export interface ConfigOptions extends ConfigOptionsInternal, OptionsExtensions
|
|
|
158
167
|
specials?: ConfigSpecialsOptions
|
|
159
168
|
|
|
160
169
|
/**
|
|
161
|
-
* bellow can be disabled
|
|
170
|
+
* Configs bellow can be disabled
|
|
162
171
|
*/
|
|
163
172
|
antfu?: boolean | ConfigAntfuOptions
|
|
173
|
+
deMorgan?: boolean | ConfigDeMorganOptions
|
|
164
174
|
depend?: boolean | ConfigDependOptions
|
|
165
175
|
githubAction?: boolean | ConfigGitHubActionOptions
|
|
166
176
|
gitignore?: boolean | ConfigGitIgnoreOptions
|
|
@@ -179,25 +189,14 @@ export interface ConfigOptions extends ConfigOptionsInternal, OptionsExtensions
|
|
|
179
189
|
unocss?: boolean | ConfigUnoCSSOptions
|
|
180
190
|
vue?: boolean | ConfigVueOptions
|
|
181
191
|
yml?: boolean | ConfigYmlOptions
|
|
182
|
-
|
|
183
192
|
/**
|
|
184
193
|
* disabled by default
|
|
185
194
|
*/
|
|
186
195
|
svgo?: boolean | ConfigSVGOOptions
|
|
187
|
-
|
|
188
196
|
/**
|
|
189
197
|
* disabled by default
|
|
190
|
-
*
|
|
191
|
-
* require `eslint-plugin-eslint-plugin` installed mannally
|
|
192
198
|
*/
|
|
193
199
|
eslintPlugin?: boolean | ConfigESLintPluginOptions
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* disabled by default
|
|
197
|
-
*
|
|
198
|
-
* require `@stylistic/eslint-plugin` installed mannally
|
|
199
|
-
*/
|
|
200
|
-
stylistic?: boolean | ConfigStylisticOptions
|
|
201
200
|
}
|
|
202
201
|
```
|
|
203
202
|
|