@ntnyq/eslint-config 3.0.0-beta.9 → 3.0.0
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 +112 -8
- package/dist/index.cjs +469 -346
- package/dist/index.d.cts +6404 -3061
- package/dist/index.d.ts +6404 -3061
- package/dist/index.js +506 -387
- package/package.json +30 -28
package/README.md
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
[](https://www.npmjs.com/package/@ntnyq/eslint-config)
|
|
7
7
|
[](https://www.npmjs.com/package/@ntnyq/eslint-config/v/latest)
|
|
8
8
|
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- 🚦 Designed to work alongside with Prettier
|
|
12
|
+
|
|
9
13
|
## Install
|
|
10
14
|
|
|
11
15
|
```bash
|
|
@@ -14,20 +18,23 @@ pnpm add eslint prettier typescript @ntnyq/eslint-config @ntnyq/prettier-config
|
|
|
14
18
|
|
|
15
19
|
## Usage
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
Highly recommended using **`eslint.config.mjs`** as the config file :
|
|
18
22
|
|
|
19
23
|
```js
|
|
20
|
-
import {
|
|
24
|
+
import { defineESLintConfig } from '@ntnyq/eslint-config'
|
|
21
25
|
|
|
22
|
-
export default
|
|
26
|
+
export default defineESLintConfig()
|
|
23
27
|
```
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
```js
|
|
28
|
-
const ntnyq = require('@ntnyq/eslint-config')
|
|
29
|
+
Add scripts `lint` in `package.json`:
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"scripts": {
|
|
34
|
+
"lint": "eslint .",
|
|
35
|
+
"lint:fix": "eslint . --fix"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
31
38
|
```
|
|
32
39
|
|
|
33
40
|
## VSCode Config
|
|
@@ -57,6 +64,103 @@ module.exports = ntnyq()
|
|
|
57
64
|
}
|
|
58
65
|
```
|
|
59
66
|
|
|
67
|
+
## Lint changed files only
|
|
68
|
+
|
|
69
|
+
### 1. Add dependencies
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pnpm add husky nano-staged -D
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 2. Config `package.json`
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"scripts": {
|
|
80
|
+
"prepare": "husky"
|
|
81
|
+
},
|
|
82
|
+
"nano-staged": {
|
|
83
|
+
"*.{js,ts,cjs,mjs,vue,md,yml,yaml,json,html}": "eslint --fix"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 3. Add a hook
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
echo "nano-staged" > .husky/pre-commit
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Advanced config
|
|
95
|
+
|
|
96
|
+
Check for detail in:
|
|
97
|
+
|
|
98
|
+
- [./src/types/config.ts](https://github.com/ntnyq/eslint-config/blob/main/src/types/config.ts)
|
|
99
|
+
- [./src/core.ts](https://github.com/ntnyq/eslint-config/blob/main/src/core.ts)
|
|
100
|
+
|
|
101
|
+
### Config interface
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
export interface ConfigOptions {
|
|
105
|
+
ignores?: ConfigIgnoresOptions
|
|
106
|
+
|
|
107
|
+
sort?: boolean | ConfigSortOptions
|
|
108
|
+
|
|
109
|
+
command?: boolean | ConfigCommandOptions
|
|
110
|
+
|
|
111
|
+
gitignore?: boolean | ConfigGitIgnoreOptions
|
|
112
|
+
|
|
113
|
+
imports?: ConfigImportsOptions
|
|
114
|
+
|
|
115
|
+
node?: ConfigNodeOptions
|
|
116
|
+
|
|
117
|
+
javascript?: ConfigJavaScriptOptions
|
|
118
|
+
|
|
119
|
+
typescript?: boolean | ConfigTypeScriptOptions
|
|
120
|
+
|
|
121
|
+
unicorn?: boolean | ConfigUnicornOptions
|
|
122
|
+
|
|
123
|
+
prettier?: boolean | ConfigPrettierOptions
|
|
124
|
+
|
|
125
|
+
perfectionist?: boolean | ConfigPerfectionistOptions
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
unusedImports?: boolean | ConfigUnusedImportsOptions
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @internal
|
|
134
|
+
*/
|
|
135
|
+
antfu?: boolean | ConfigAntfuOptions
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @internal
|
|
139
|
+
*/
|
|
140
|
+
ntnyq?: boolean | ConfigNtnyqOptions
|
|
141
|
+
|
|
142
|
+
comments?: boolean | ConfigCommentsOptions
|
|
143
|
+
|
|
144
|
+
jsdoc?: boolean | ConfigJsdocOptions
|
|
145
|
+
|
|
146
|
+
unocss?: boolean | ConfigUnoCSSOptions
|
|
147
|
+
|
|
148
|
+
regexp?: boolean | ConfigRegexpOptions
|
|
149
|
+
|
|
150
|
+
jsonc?: boolean | ConfigJsoncOptions
|
|
151
|
+
|
|
152
|
+
yml?: boolean | ConfigYmlOptions
|
|
153
|
+
|
|
154
|
+
markdown?: boolean | ConfigMarkdownOptions
|
|
155
|
+
|
|
156
|
+
toml?: boolean | ConfigTomlOptions
|
|
157
|
+
|
|
158
|
+
vue?: boolean | ConfigVueOptions
|
|
159
|
+
|
|
160
|
+
test?: boolean | ConfigTestOptions
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
60
164
|
## Credits
|
|
61
165
|
|
|
62
166
|
- [@sxzz/eslint-config](https://github.com/sxzz/eslint-config)
|