@zayne-labs/eslint-config 0.0.0 → 0.0.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 +567 -43
- package/dist/index.d.ts +13842 -8861
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,50 +1,574 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @zayne-labs/eslint-config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://npmjs.com/package/@zayne-labs/eslint-config) [![code style]](https://github.com/zayne-/eslint-config)
|
|
4
|
+
|
|
5
|
+
- Reasonable defaults, best practices, only one line of config
|
|
6
|
+
- Designed to work with TypeScript, JSX, Vue, JSON, YAML, Toml, Markdown, etc. Out-of-box.
|
|
7
|
+
- Opinionated, but [very customizable](#customization)
|
|
8
|
+
- [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new), compose easily!
|
|
9
|
+
- Optional [React](#react), [Svelte](#svelte), [UnoCSS](#unocss), [Astro](#astro), [Solid](#solid) support
|
|
10
|
+
- Respects `.gitignore` by default
|
|
11
|
+
- Requires ESLint v9.5.0+
|
|
4
12
|
|
|
5
13
|
|
|
6
14
|
## Usage
|
|
7
15
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
16
|
+
### Manual Install
|
|
17
|
+
|
|
18
|
+
If you prefer to set up manually:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pnpm i -D eslint @zayne-labs/eslint-config
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
And create `eslint.config.js` in your project root:
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
// eslint.config.js
|
|
28
|
+
import zayne from '@zayne-labs/eslint-config'
|
|
29
|
+
|
|
30
|
+
export default zayne()
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
<details>
|
|
34
|
+
<summary>
|
|
35
|
+
Combined with legacy config:
|
|
36
|
+
</summary>
|
|
37
|
+
|
|
38
|
+
If you still use some configs from the legacy eslintrc format, you can use the [`@eslint/eslintrc`](https://www.npmjs.com/package/@eslint/eslintrc) package to convert them to the flat config.
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
// eslint.config.mjs
|
|
42
|
+
import zayne from '@zayne-labs/eslint-config'
|
|
43
|
+
import { FlatCompat } from '@eslint/eslintrc'
|
|
44
|
+
|
|
45
|
+
const compat = new FlatCompat()
|
|
46
|
+
|
|
47
|
+
export default zayne(
|
|
48
|
+
{
|
|
49
|
+
ignores: [],
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
// Legacy config
|
|
53
|
+
[
|
|
54
|
+
...compat.config({
|
|
55
|
+
extends: [
|
|
56
|
+
'eslint:recommended',
|
|
57
|
+
// Other extends...
|
|
58
|
+
],
|
|
59
|
+
}),
|
|
60
|
+
|
|
61
|
+
// Other flat configs...
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
> Note that `.eslintignore` no longer works in Flat config, see [customization](#customization) for more details.
|
|
68
|
+
|
|
69
|
+
</details>
|
|
70
|
+
|
|
71
|
+
### Add script for package.json
|
|
72
|
+
|
|
73
|
+
For example:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"scripts": {
|
|
78
|
+
"lint:eslint": "eslint .",
|
|
79
|
+
"lint:eslint-fix": "eslint . --fix"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## IDE Support (auto fix on save)
|
|
85
|
+
|
|
86
|
+
<details>
|
|
87
|
+
<summary>🟦 VS Code support</summary>
|
|
88
|
+
|
|
89
|
+
<br>
|
|
90
|
+
|
|
91
|
+
Install [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
92
|
+
|
|
93
|
+
Add the following settings to your `.vscode/settings.json`:
|
|
94
|
+
|
|
95
|
+
```jsonc
|
|
96
|
+
{
|
|
97
|
+
// Auto fix
|
|
98
|
+
"editor.codeActionsOnSave": {
|
|
99
|
+
"source.fixAll.eslint": "explicit",
|
|
100
|
+
"source.organizeImports": "never"
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
// Enable eslint for all supported languages
|
|
104
|
+
"eslint.validate": [
|
|
105
|
+
"javascript",
|
|
106
|
+
"javascriptreact",
|
|
107
|
+
"typescript",
|
|
108
|
+
"typescriptreact",
|
|
109
|
+
"vue",
|
|
110
|
+
"html",
|
|
111
|
+
"markdown",
|
|
112
|
+
"json",
|
|
113
|
+
"jsonc",
|
|
114
|
+
"yaml",
|
|
115
|
+
"toml",
|
|
116
|
+
"xml",
|
|
117
|
+
"gql",
|
|
118
|
+
"graphql",
|
|
119
|
+
"astro",
|
|
120
|
+
"svelte",
|
|
121
|
+
"css",
|
|
122
|
+
"less",
|
|
123
|
+
"scss",
|
|
124
|
+
"pcss",
|
|
125
|
+
"postcss"
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
</details>
|
|
131
|
+
|
|
132
|
+
<details>
|
|
133
|
+
<summary>🟩 Neovim Support</summary>
|
|
134
|
+
|
|
135
|
+
<br>
|
|
136
|
+
|
|
137
|
+
Update your configuration to use the following:
|
|
138
|
+
|
|
139
|
+
```lua
|
|
140
|
+
local lspconfig = require('lspconfig')
|
|
141
|
+
-- Enable eslint for all supported languages
|
|
142
|
+
lspconfig.eslint.setup(
|
|
143
|
+
{
|
|
144
|
+
filetypes = {
|
|
145
|
+
"javascript",
|
|
146
|
+
"javascriptreact",
|
|
147
|
+
"javascript.jsx",
|
|
148
|
+
"typescript",
|
|
149
|
+
"typescriptreact",
|
|
150
|
+
"typescript.tsx",
|
|
151
|
+
"vue",
|
|
152
|
+
"html",
|
|
153
|
+
"markdown",
|
|
154
|
+
"json",
|
|
155
|
+
"jsonc",
|
|
156
|
+
"yaml",
|
|
157
|
+
"toml",
|
|
158
|
+
"xml",
|
|
159
|
+
"gql",
|
|
160
|
+
"graphql",
|
|
161
|
+
"astro",
|
|
162
|
+
"svelte",
|
|
163
|
+
"css",
|
|
164
|
+
"less",
|
|
165
|
+
"scss",
|
|
166
|
+
"pcss",
|
|
167
|
+
"postcss"
|
|
168
|
+
},
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Neovim format on save
|
|
174
|
+
|
|
175
|
+
There's few ways you can achieve format on save in neovim:
|
|
176
|
+
|
|
177
|
+
- `nvim-lspconfig` has a `EslintFixAll` command predefined, you can create a autocmd to call this command after saving file.
|
|
178
|
+
|
|
179
|
+
```lua
|
|
180
|
+
lspconfig.eslint.setup({
|
|
181
|
+
--- ...
|
|
182
|
+
on_attach = function(client, bufnr)
|
|
183
|
+
vim.api.nvim_create_autocmd("BufWritePre", {
|
|
184
|
+
buffer = bufnr,
|
|
185
|
+
command = "EslintFixAll",
|
|
186
|
+
})
|
|
187
|
+
end,
|
|
188
|
+
})
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
- Use [conform.nvim](https://github.com/stevearc/conform.nvim).
|
|
192
|
+
- Use [none-ls](https://github.com/nvimtools/none-ls.nvim)
|
|
193
|
+
- Use [nvim-lint](https://github.com/mfussenegger/nvim-lint)
|
|
194
|
+
|
|
195
|
+
</details>
|
|
196
|
+
|
|
197
|
+
## Customization
|
|
198
|
+
|
|
199
|
+
Normally you only need to import the `zayne` preset:
|
|
200
|
+
|
|
201
|
+
```js
|
|
202
|
+
// eslint.config.js
|
|
203
|
+
import zayne from '@zayne-labs/eslint-config'
|
|
204
|
+
|
|
205
|
+
export default zayne()
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
And that's it! Or you can configure each integration individually, for example:
|
|
209
|
+
|
|
210
|
+
```js
|
|
211
|
+
// eslint.config.js
|
|
212
|
+
import zayne from '@zayne-labs/eslint-config'
|
|
213
|
+
|
|
214
|
+
export default zayne({
|
|
215
|
+
// Enable stylistic formatting rules
|
|
216
|
+
stylistic: true,
|
|
217
|
+
|
|
218
|
+
// TypeScript is autodetected, you can also explicitly enable it:
|
|
219
|
+
typescript: true,
|
|
220
|
+
|
|
221
|
+
// Disable jsonc and yaml support
|
|
222
|
+
jsonc: false,
|
|
223
|
+
yaml: false,
|
|
224
|
+
|
|
225
|
+
// `.eslintignore` is no longer supported in Flat config, use `ignores` instead
|
|
226
|
+
ignores: [
|
|
227
|
+
'build/**',
|
|
228
|
+
// ...globs
|
|
229
|
+
]
|
|
230
|
+
})
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
The `zayne` factory function also accepts an array of arbitrary custom config overrides as the second argument:
|
|
234
|
+
|
|
235
|
+
```js
|
|
236
|
+
// eslint.config.js
|
|
237
|
+
import zayne from '@zayne-labs/eslint-config'
|
|
238
|
+
|
|
239
|
+
export default zayne(
|
|
240
|
+
{
|
|
241
|
+
// Configures for zayne labs' config
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
// The second arguments is an array of ESLint Configs
|
|
245
|
+
[ {
|
|
246
|
+
files: ['**/*.ts'],
|
|
247
|
+
rules: {},
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
rules: {},
|
|
251
|
+
}],
|
|
252
|
+
)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Going more advanced, you can also import fine-grained configs and compose them as you wish:
|
|
256
|
+
|
|
257
|
+
<details>
|
|
258
|
+
<summary>Advanced Example</summary>
|
|
259
|
+
|
|
260
|
+
We wouldn't recommend using this style in general unless you know exactly what they are doing, as there are shared options between configs and might need extra care to make them consistent.
|
|
261
|
+
|
|
262
|
+
```js
|
|
263
|
+
// eslint.config.js
|
|
264
|
+
import {
|
|
265
|
+
combine,
|
|
266
|
+
comments,
|
|
267
|
+
ignores,
|
|
268
|
+
imports,
|
|
269
|
+
javascript,
|
|
270
|
+
jsdoc,
|
|
271
|
+
jsonc,
|
|
272
|
+
markdown,
|
|
273
|
+
node,
|
|
274
|
+
sortPackageJson,
|
|
275
|
+
sortTsconfig,
|
|
276
|
+
stylistic,
|
|
277
|
+
toml,
|
|
278
|
+
typescript,
|
|
279
|
+
unicorn,
|
|
280
|
+
vue,
|
|
281
|
+
yaml,
|
|
282
|
+
} from '@zayne-labs/eslint-config'
|
|
283
|
+
|
|
284
|
+
export default combine(
|
|
285
|
+
ignores(),
|
|
286
|
+
javascript(/* Options */),
|
|
287
|
+
comments(),
|
|
288
|
+
node(),
|
|
289
|
+
jsdoc(),
|
|
290
|
+
imports(),
|
|
291
|
+
unicorn(),
|
|
292
|
+
typescript(/* Options */),
|
|
293
|
+
stylistic(),
|
|
294
|
+
vue(),
|
|
295
|
+
jsonc(),
|
|
296
|
+
yaml(),
|
|
297
|
+
toml(),
|
|
298
|
+
markdown(),
|
|
299
|
+
)
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
</details>
|
|
303
|
+
|
|
304
|
+
Check out the [configs](https://github.com/zayne-labs/eslint-config/blob/main/src/configs) and [factory](https://github.com/zayne-labs/eslint-config/blob/main/src/factory.ts) for more details.
|
|
305
|
+
|
|
306
|
+
> Thanks to [zayne/eslint-config](https://github.com/zayne/eslint-config) for the inspiration and reference.
|
|
307
|
+
|
|
308
|
+
### Plugins Renaming
|
|
309
|
+
|
|
310
|
+
Since flat config requires us to explicitly provide the plugin names (instead of the mandatory convention from npm package name), we renamed some plugins to make the overall scope more consistent and easier to write.
|
|
311
|
+
|
|
312
|
+
| New Prefix | Original Prefix | Source Plugin |
|
|
313
|
+
| ---------- | ---------------------- | ------------------------------------------------------------------------------------------ |
|
|
314
|
+
| `import/*` | `import-x/*` | [eslint-plugin-import-x](https://github.com/un-es/eslint-plugin-import-x) |
|
|
315
|
+
| `node/*` | `n/*` | [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) |
|
|
316
|
+
| `yaml/*` | `yml/*` | [eslint-plugin-yml](https://github.com/ota-meshi/eslint-plugin-yml) |
|
|
317
|
+
| `ts-eslint/*` | `@typescript-eslint/*` | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) |
|
|
318
|
+
| `stylistic/*` | `@stylistic/*` | [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic) |
|
|
319
|
+
|
|
320
|
+
When you want to override rules, or disable them inline, you need to update to the new prefix:
|
|
321
|
+
|
|
322
|
+
```diff
|
|
323
|
+
-// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
324
|
+
+// eslint-disable-next-line ts/consistent-type-definitions
|
|
325
|
+
type foo = { bar: 2 }
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
<details>
|
|
330
|
+
<summary>Change back to original prefix</summary>
|
|
331
|
+
|
|
332
|
+
If you really want to use the original prefix, you can revert the plugin renaming by:
|
|
333
|
+
|
|
334
|
+
```ts
|
|
335
|
+
import zayne from '@zayne-labs/eslint-config'
|
|
336
|
+
|
|
337
|
+
export default zayne()
|
|
338
|
+
.renamePlugins({
|
|
339
|
+
"ts-eslint": '@typescript-eslint',
|
|
340
|
+
// ...
|
|
341
|
+
})
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
</details>
|
|
345
|
+
|
|
346
|
+
### Rules Overrides
|
|
347
|
+
|
|
348
|
+
Certain rules would only be enabled in specific files, for example, `ts/*` rules would only be enabled in `.ts` files and `vue/*` rules would only be enabled in `.vue` files. If you want to override the rules, you need to specify the file extension:
|
|
349
|
+
|
|
350
|
+
```js
|
|
351
|
+
// eslint.config.js
|
|
352
|
+
import zayne from '@zayne-labs/eslint-config'
|
|
353
|
+
|
|
354
|
+
export default zayne(
|
|
355
|
+
{
|
|
356
|
+
vue: true,
|
|
357
|
+
typescript: true
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
// Remember to specify the file glob here, otherwise it might cause the vue plugin to handle non-vue files
|
|
361
|
+
files: ['**/*.vue'],
|
|
362
|
+
rules: {
|
|
363
|
+
'vue/operator-linebreak': ['error', 'before'],
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
// Without `files`, they are general rules for all files
|
|
368
|
+
rules: {
|
|
369
|
+
'stylistic/semi': ['error', 'never'],
|
|
370
|
+
},
|
|
371
|
+
}
|
|
372
|
+
)
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
We also provided the `overrides` options in each integration to make it easier:
|
|
376
|
+
|
|
377
|
+
```js
|
|
378
|
+
// eslint.config.js
|
|
379
|
+
import zayne from '@zayne-labs/eslint-config'
|
|
380
|
+
|
|
381
|
+
export default zayne({
|
|
382
|
+
vue: {
|
|
383
|
+
overrides: {
|
|
384
|
+
'vue/operator-linebreak': ['error', 'before'],
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
typescript: {
|
|
388
|
+
overrides: {
|
|
389
|
+
'ts/consistent-type-definitions': ['error', 'interface'],
|
|
390
|
+
},
|
|
391
|
+
},
|
|
392
|
+
yaml: {
|
|
393
|
+
overrides: {
|
|
394
|
+
// ...
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
})
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### Config Composer
|
|
401
|
+
|
|
402
|
+
The factory function `zayne()` returns a [`FlatConfigComposer` object from `eslint-flat-config-utils`](https://github.com/zayne/eslint-flat-config-utils#composer) where you can chain the methods to compose the config even more flexibly.
|
|
403
|
+
|
|
404
|
+
```js
|
|
405
|
+
// eslint.config.js
|
|
406
|
+
import zayne from '@zayne-labs/eslint-config'
|
|
407
|
+
|
|
408
|
+
export default zayne()
|
|
409
|
+
.prepend(
|
|
410
|
+
// some configs before the main config
|
|
411
|
+
)
|
|
412
|
+
// overrides any named configs
|
|
413
|
+
.override(
|
|
414
|
+
'zayne/imports',
|
|
415
|
+
{
|
|
416
|
+
rules: {
|
|
417
|
+
'import/order': ['error', { 'newlines-between': 'always' }],
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
)
|
|
421
|
+
// rename plugin prefixes
|
|
422
|
+
.renamePlugins({
|
|
423
|
+
'old-prefix': 'new-prefix',
|
|
424
|
+
// ...
|
|
425
|
+
})
|
|
426
|
+
// ...
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
#### React
|
|
431
|
+
|
|
432
|
+
To enable React support, you need to explicitly turn it on:
|
|
433
|
+
|
|
434
|
+
```js
|
|
435
|
+
// eslint.config.js
|
|
436
|
+
import zayne from '@zayne-labs/eslint-config'
|
|
437
|
+
|
|
438
|
+
export default zayne({
|
|
439
|
+
react: true,
|
|
440
|
+
})
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
444
|
+
|
|
445
|
+
```bash
|
|
446
|
+
npm i -D @eslint-react/eslint-plugin eslint-plugin-react-hooks eslint-plugin-react-refresh
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
#### Svelte
|
|
450
|
+
|
|
451
|
+
To enable svelte support, you need to explicitly turn it on:
|
|
452
|
+
|
|
453
|
+
```js
|
|
454
|
+
// eslint.config.js
|
|
455
|
+
import zayne from '@zayne-labs/eslint-config'
|
|
456
|
+
|
|
457
|
+
export default zayne({
|
|
458
|
+
svelte: true,
|
|
459
|
+
})
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
npm i -D eslint-plugin-svelte
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
#### Astro
|
|
469
|
+
|
|
470
|
+
To enable astro support, you need to explicitly turn it on:
|
|
471
|
+
|
|
472
|
+
```js
|
|
473
|
+
// eslint.config.js
|
|
474
|
+
import zayne from '@zayne-labs/eslint-config'
|
|
475
|
+
|
|
476
|
+
export default zayne({
|
|
477
|
+
astro: true,
|
|
478
|
+
})
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
482
|
+
|
|
483
|
+
```bash
|
|
484
|
+
npm i -D eslint-plugin-astro
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
#### Solid
|
|
488
|
+
|
|
489
|
+
To enable Solid support, you need to explicitly turn it on:
|
|
490
|
+
|
|
491
|
+
```js
|
|
492
|
+
// eslint.config.js
|
|
493
|
+
import zayne from '@zayne-labs/eslint-config'
|
|
494
|
+
|
|
495
|
+
export default zayne({
|
|
496
|
+
solid: true,
|
|
497
|
+
})
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
501
|
+
|
|
502
|
+
```bash
|
|
503
|
+
npm i -D eslint-plugin-solid
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
#### tailwindcss
|
|
507
|
+
|
|
508
|
+
To enable Tailwindcss support, you need to explicitly turn it on:
|
|
509
|
+
|
|
510
|
+
```js
|
|
511
|
+
// eslint.config.js
|
|
512
|
+
import zayne from '@zayne-labs/eslint-config'
|
|
513
|
+
|
|
514
|
+
export default zayne({
|
|
515
|
+
tailwindcss: true,
|
|
516
|
+
})
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
520
|
+
|
|
521
|
+
```bash
|
|
522
|
+
npm i -D eslint-plugin-tailwindcss
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
### Type Aware Rules
|
|
527
|
+
|
|
528
|
+
You can optionally enable the [type aware rules](https://typescript-eslint.io/linting/typed-linting/) by passing the options object to the `typescript` config:
|
|
529
|
+
|
|
530
|
+
```js
|
|
531
|
+
// eslint.config.js
|
|
532
|
+
import zayne from '@zayne-labs/eslint-config'
|
|
533
|
+
|
|
534
|
+
export default zayne({
|
|
535
|
+
typescript: {
|
|
536
|
+
tsconfigPath: 'tsconfig.json',
|
|
537
|
+
},
|
|
538
|
+
})
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
## View what rules are enabled
|
|
543
|
+
|
|
544
|
+
Eslint config inspecctor is visual tool to help you view what rules are enabled in your project and apply them to what files, [@eslint/config-inspector](https://github.com/eslint/config-inspector).
|
|
545
|
+
It was built by the legendary Anthony Fu.
|
|
546
|
+
|
|
547
|
+
Go to your project root that contains `eslint.config.js` and run:
|
|
548
|
+
|
|
549
|
+
```bash
|
|
550
|
+
npx @eslint/config-inspector
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
## Versioning Policy
|
|
554
|
+
|
|
555
|
+
This project follows [Semantic Versioning](https://semver.org/) for releases. However, since this is just a config and involves opinions and many moving parts, we don't treat rules changes as breaking changes.
|
|
556
|
+
|
|
557
|
+
### Changes Considered as Breaking Changes
|
|
558
|
+
|
|
559
|
+
- Node.js version requirement changes
|
|
560
|
+
- Huge refactors that might break the config
|
|
561
|
+
- Plugins made major changes that might break the config
|
|
562
|
+
- Changes that might affect most of the codebases
|
|
563
|
+
|
|
564
|
+
### Changes Considered as Non-breaking Changes
|
|
565
|
+
|
|
566
|
+
- Enable/disable rules and plugins (that might become stricter)
|
|
567
|
+
- Rules options changes
|
|
568
|
+
- Version bumps of dependencies
|
|
569
|
+
|
|
570
|
+
## FAQ
|
|
49
571
|
|
|
572
|
+
### I prefer XXX...
|
|
50
573
|
|
|
574
|
+
Sure, you can configure and override rules locally in your project to fit your needs. If that still does not work for you, you can always fork this repo and maintain your own.
|