@ntnyq/eslint-config 5.9.0 → 6.0.0-beta.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/README.md +47 -37
- package/dist/index.d.mts +7621 -6946
- package/dist/index.mjs +106 -23
- package/package.json +35 -33
package/README.md
CHANGED
|
@@ -1,34 +1,37 @@
|
|
|
1
1
|
# @ntnyq/eslint-config
|
|
2
2
|
|
|
3
|
-
> ESLint config for JavaScript, TypeScript, Vue, JSON, Markdown, YAML, TOML, SVG and etc.
|
|
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)
|
|
7
|
+
[](https://www.npmjs.com/package/@ntnyq/eslint-config/v/next)
|
|
7
8
|
[](https://www.npmjs.com/package/@ntnyq/eslint-config)
|
|
8
9
|
[](https://github.com/ntnyq/eslint-config/blob/main/LICENSE)
|
|
9
10
|
|
|
10
11
|
> [!IMPORTANT]
|
|
11
|
-
> Feel free to create and maintain your own fork if you think this is too
|
|
12
|
+
> Feel free to create and maintain your own fork if you think this is too opinionated.
|
|
12
13
|
|
|
13
|
-
##
|
|
14
|
+
## 📋 Requirements
|
|
14
15
|
|
|
15
|
-
-
|
|
16
|
-
- ESLint
|
|
16
|
+
- Node.js ^20.19.0 || ^22.13.0 || >=24
|
|
17
|
+
- ESLint ^9.38.0
|
|
17
18
|
|
|
18
19
|
> [!TIP]
|
|
19
|
-
> For
|
|
20
|
+
> For Node.js v18 support, please use [v4](https://github.com/ntnyq/eslint-config/tree/v4).
|
|
21
|
+
>
|
|
22
|
+
> For Node.js versions below 20.19.0, please use [v5](https://github.com/ntnyq/eslint-config/tree/v5).
|
|
20
23
|
|
|
21
|
-
## Features
|
|
24
|
+
## ✨ Features
|
|
22
25
|
|
|
23
|
-
- Designed to work alongside
|
|
24
|
-
-
|
|
25
|
-
- Respect `.gitignore` via [eslint-config-flat-gitignore](https://github.com/antfu/eslint-config-flat-gitignore)
|
|
26
|
-
- Out-of-box support for TypeScript, Vue, JSON, Markdown, YAML, TOML, SVG
|
|
27
|
-
- Strict but provides useful rules to guard your codebase
|
|
28
|
-
- Custom ESLint commands for [eslint-plugin-command](https://github.com/antfu/eslint-plugin-command)
|
|
29
|
-
- [ESLint flat config](https://eslint.org/docs/latest/use/configure/configuration-files) for ESLint v9.
|
|
26
|
+
- ✅ Designed to work alongside [Prettier](https://prettier.io) and [TypeScript](https://www.typescriptlang.org/)
|
|
27
|
+
- 🎯 Opinionated: single quote, no semi, trailing comma, etc
|
|
28
|
+
- 🪄 Respect `.gitignore` via [eslint-config-flat-gitignore](https://github.com/antfu/eslint-config-flat-gitignore)
|
|
29
|
+
- 📦 Out-of-the-box support for TypeScript, Vue, JSON, Markdown, YAML, TOML, SVG, Astro, Svelte, etc
|
|
30
|
+
- 🛡️ Strict but provides useful rules to guard your codebase
|
|
31
|
+
- 🔧 Custom ESLint commands for [eslint-plugin-command](https://github.com/antfu/eslint-plugin-command)
|
|
32
|
+
- 🎪 [ESLint flat config](https://eslint.org/docs/latest/use/configure/configuration-files) for ESLint v9.38.0+
|
|
30
33
|
|
|
31
|
-
## Install
|
|
34
|
+
## 📦 Install
|
|
32
35
|
|
|
33
36
|
```shell
|
|
34
37
|
npm i eslint typescript @ntnyq/eslint-config -D
|
|
@@ -46,9 +49,9 @@ pnpm add eslint typescript @ntnyq/eslint-config -D
|
|
|
46
49
|
bun add eslint typescript @ntnyq/eslint-config -D
|
|
47
50
|
```
|
|
48
51
|
|
|
49
|
-
## Usage
|
|
52
|
+
## 🚀 Usage
|
|
50
53
|
|
|
51
|
-
Highly
|
|
54
|
+
Highly recommend using **`eslint.config.mjs`** as the config file:
|
|
52
55
|
|
|
53
56
|
```js
|
|
54
57
|
// @ts-check
|
|
@@ -81,7 +84,7 @@ export default defineESLintConfig(
|
|
|
81
84
|
)
|
|
82
85
|
```
|
|
83
86
|
|
|
84
|
-
Add
|
|
87
|
+
Add a `lint` script to `package.json`:
|
|
85
88
|
|
|
86
89
|
```json
|
|
87
90
|
{
|
|
@@ -93,15 +96,15 @@ Add scripts `lint` in `package.json`:
|
|
|
93
96
|
```
|
|
94
97
|
|
|
95
98
|
<details>
|
|
96
|
-
<summary>💼
|
|
99
|
+
<summary>💼 Integration: Prettier, VS Code, husky and nano-staged</summary>
|
|
97
100
|
|
|
98
101
|
<br>
|
|
99
102
|
|
|
100
|
-
## Prettier config
|
|
103
|
+
## 🎨 Prettier config
|
|
101
104
|
|
|
102
105
|
> Feel free to use your own prettier config.
|
|
103
106
|
|
|
104
|
-
Install `prettier` and
|
|
107
|
+
Install `prettier` and set up your Prettier config:
|
|
105
108
|
|
|
106
109
|
```shell
|
|
107
110
|
npm i prettier @ntnyq/prettier-config -D
|
|
@@ -146,7 +149,7 @@ export default defineConfig({
|
|
|
146
149
|
})
|
|
147
150
|
```
|
|
148
151
|
|
|
149
|
-
## VSCode
|
|
152
|
+
## 💻 VSCode config
|
|
150
153
|
|
|
151
154
|
```json
|
|
152
155
|
{
|
|
@@ -176,7 +179,7 @@ export default defineConfig({
|
|
|
176
179
|
}
|
|
177
180
|
```
|
|
178
181
|
|
|
179
|
-
## Lint changed files only
|
|
182
|
+
## 🎯 Lint changed files only
|
|
180
183
|
|
|
181
184
|
### 1. Add dependencies
|
|
182
185
|
|
|
@@ -206,18 +209,25 @@ echo "nano-staged" > .husky/pre-commit
|
|
|
206
209
|
|
|
207
210
|
</details>
|
|
208
211
|
|
|
209
|
-
## View what rules are enabled
|
|
212
|
+
## 🔍 View what rules are enabled
|
|
210
213
|
|
|
211
214
|
Please check [eslint-config-inspector](https://eslint-config-inspector.ntnyq.com/) powered by [@eslint/config-inspector](https://github.com/eslint/config-inspector).
|
|
212
215
|
|
|
213
|
-
## Advanced config
|
|
216
|
+
## ⚙️ Advanced config
|
|
214
217
|
|
|
215
|
-
|
|
218
|
+
For details, see:
|
|
216
219
|
|
|
217
220
|
- [./src/types/config.ts](https://github.com/ntnyq/eslint-config/blob/main/src/types/config.ts)
|
|
218
221
|
- [./src/core.ts](https://github.com/ntnyq/eslint-config/blob/main/src/core.ts)
|
|
219
222
|
|
|
220
|
-
|
|
223
|
+
## ⚙️ Advanced config
|
|
224
|
+
|
|
225
|
+
For details, see:
|
|
226
|
+
|
|
227
|
+
- [./src/types/config.ts](https://github.com/ntnyq/eslint-config/blob/main/src/types/config.ts)
|
|
228
|
+
- [./src/core.ts](https://github.com/ntnyq/eslint-config/blob/main/src/core.ts)
|
|
229
|
+
|
|
230
|
+
### 📝 Config interface
|
|
221
231
|
|
|
222
232
|
```ts
|
|
223
233
|
export interface ConfigOptions {
|
|
@@ -228,7 +238,6 @@ export interface ConfigOptions {
|
|
|
228
238
|
|
|
229
239
|
/**
|
|
230
240
|
* Configs enabled by default
|
|
231
|
-
* @pg
|
|
232
241
|
*/
|
|
233
242
|
command?: ConfigCommandOptions
|
|
234
243
|
eslintComments?: ConfigESLintCommentsOptions
|
|
@@ -237,7 +246,7 @@ export interface ConfigOptions {
|
|
|
237
246
|
node?: ConfigNodeOptions
|
|
238
247
|
|
|
239
248
|
/**
|
|
240
|
-
* Configs
|
|
249
|
+
* Configs below can be disabled
|
|
241
250
|
*/
|
|
242
251
|
antfu?: boolean | ConfigAntfuOptions
|
|
243
252
|
deMorgan?: boolean | ConfigDeMorganOptions
|
|
@@ -264,39 +273,40 @@ export interface ConfigOptions {
|
|
|
264
273
|
yml?: boolean | ConfigYmlOptions
|
|
265
274
|
|
|
266
275
|
/**
|
|
267
|
-
* Configs
|
|
276
|
+
* Configs below are disabled by default
|
|
268
277
|
*/
|
|
269
278
|
astro?: boolean | ConfigAstroOptions
|
|
270
279
|
html?: boolean | ConfigHtmlOptions
|
|
271
280
|
pnpm?: boolean | ConfigPnpmOptions
|
|
281
|
+
oxfmt?: boolean | ConfigOxfmtOptions
|
|
272
282
|
svelte?: boolean | ConfigSvelteOptions
|
|
273
283
|
svgo?: boolean | ConfigSVGOOptions
|
|
274
284
|
eslintPlugin?: boolean | ConfigESLintPluginOptions
|
|
275
285
|
}
|
|
276
286
|
```
|
|
277
287
|
|
|
278
|
-
## Versioning policy
|
|
288
|
+
## 📌 Versioning policy
|
|
279
289
|
|
|
280
|
-
This project aims to
|
|
290
|
+
This project aims to follow [Semantic Versioning](https://semver.org/) for releases.
|
|
281
291
|
|
|
282
|
-
### Changes
|
|
292
|
+
### 🔴 Changes treated as Breaking Changes
|
|
283
293
|
|
|
284
294
|
- Node.js version requirement changes
|
|
285
295
|
- Huge refactors that might break the config
|
|
286
296
|
- Plugins made major changes that might break the config
|
|
287
297
|
- Changes that might affect most of the codebases
|
|
288
298
|
|
|
289
|
-
### Changes
|
|
299
|
+
### 🟢 Changes treated as Non-Breaking Changes
|
|
290
300
|
|
|
291
301
|
- Enable/disable rules and plugins (that might become stricter)
|
|
292
|
-
-
|
|
302
|
+
- Rule option changes
|
|
293
303
|
- Version bumps of dependencies
|
|
294
304
|
|
|
295
|
-
## Credits
|
|
305
|
+
## 🙏 Credits
|
|
296
306
|
|
|
297
307
|
- [@sxzz/eslint-config](https://github.com/sxzz/eslint-config)
|
|
298
308
|
- [@antfu/eslint-config](https://github.com/antfu/eslint-config)
|
|
299
309
|
|
|
300
|
-
## License
|
|
310
|
+
## 📄 License
|
|
301
311
|
|
|
302
312
|
[MIT](./LICENSE) License © 2023-PRESENT [ntnyq](https://github.com/ntnyq)
|