@zayne-labs/eslint-config 0.11.5 → 0.11.7

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 CHANGED
@@ -38,9 +38,9 @@ pnpm add -D eslint @zayne-labs/eslint-config
38
38
  Create `eslint.config.js` in your project root:
39
39
 
40
40
  ```js
41
- import { zayne } from '@zayne-labs/eslint-config'
41
+ import { zayne } from "@zayne-labs/eslint-config";
42
42
 
43
- export default zayne()
43
+ export default zayne();
44
44
  ```
45
45
 
46
46
  Done! Check out [customization](#customization) for more options.
@@ -51,23 +51,23 @@ Done! Check out [customization](#customization) for more options.
51
51
  If you have existing eslintrc configs, use [`@eslint/eslintrc`](https://www.npmjs.com/package/@eslint/eslintrc) to convert them:
52
52
 
53
53
  ```js
54
- import { zayne } from '@zayne-labs/eslint-config'
55
- import { FlatCompat } from '@eslint/eslintrc'
54
+ import { FlatCompat } from "@eslint/eslintrc";
55
+ import { zayne } from "@zayne-labs/eslint-config";
56
56
 
57
- const compat = new FlatCompat()
57
+ const compat = new FlatCompat();
58
58
 
59
59
  export default zayne(
60
- {
61
- ignores: [],
62
- },
63
- ...compat.config({
64
- extends: [
65
- 'eslint:recommended',
66
- // Other extends...
67
- ],
68
- }),
69
- // Other flat configs...
70
- )
60
+ {
61
+ ignores: [],
62
+ },
63
+ ...compat.config({
64
+ extends: [
65
+ "eslint:recommended",
66
+ // Other extends...
67
+ ],
68
+ })
69
+ // Other flat configs...
70
+ );
71
71
  ```
72
72
 
73
73
  Note: `.eslintignore` no longer works in flat config. Use the `ignores` option instead (see [customization](#customization)).
@@ -80,10 +80,10 @@ Add these scripts to your `package.json`:
80
80
 
81
81
  ```json
82
82
  {
83
- "scripts": {
84
- "lint:eslint": "eslint .",
85
- "lint:eslint-fix": "eslint . --fix"
86
- }
83
+ "scripts": {
84
+ "lint:eslint": "eslint .",
85
+ "lint:eslint-fix": "eslint . --fix"
86
+ }
87
87
  }
88
88
  ```
89
89
 
@@ -96,38 +96,38 @@ Configure your editor to auto-fix ESLint issues on save:
96
96
 
97
97
  Install the [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and add to `.vscode/settings.json`:
98
98
 
99
- ```jsonc
99
+ ```json
100
100
  {
101
- // Auto fix
102
- "editor.codeActionsOnSave": {
103
- "source.fixAll.eslint": "explicit",
104
- "source.organizeImports": "never"
105
- },
106
-
107
- // Enable eslint for all supported languages
108
- "eslint.validate": [
109
- "javascript",
110
- "javascriptreact",
111
- "typescript",
112
- "typescriptreact",
113
- "vue",
114
- "html",
115
- "markdown",
116
- "json",
117
- "jsonc",
118
- "yaml",
119
- "toml",
120
- "xml",
121
- "gql",
122
- "graphql",
123
- "astro",
124
- "svelte",
125
- "css",
126
- "less",
127
- "scss",
128
- "pcss",
129
- "postcss"
130
- ]
101
+ // Auto fix
102
+ "editor.codeActionsOnSave": {
103
+ "source.fixAll.eslint": "explicit",
104
+ "source.organizeImports": "never"
105
+ },
106
+
107
+ // Enable eslint for all supported languages
108
+ "eslint.validate": [
109
+ "javascript",
110
+ "javascriptreact",
111
+ "typescript",
112
+ "typescriptreact",
113
+ "vue",
114
+ "html",
115
+ "markdown",
116
+ "json",
117
+ "jsonc",
118
+ "yaml",
119
+ "toml",
120
+ "xml",
121
+ "gql",
122
+ "graphql",
123
+ "astro",
124
+ "svelte",
125
+ "css",
126
+ "less",
127
+ "scss",
128
+ "pcss",
129
+ "postcss"
130
+ ]
131
131
  }
132
132
  ```
133
133
 
@@ -176,16 +176,16 @@ lspconfig.eslint.setup(
176
176
 
177
177
  - Use the built-in `EslintFixAll` command with an autocmd:
178
178
 
179
- ```lua
180
- lspconfig.eslint.setup({
181
- on_attach = function(client, bufnr)
182
- vim.api.nvim_create_autocmd("BufWritePre", {
183
- buffer = bufnr,
184
- command = "EslintFixAll",
185
- })
186
- end,
187
- })
188
- ```
179
+ ```lua
180
+ lspconfig.eslint.setup({
181
+ on_attach = function(client, bufnr)
182
+ vim.api.nvim_create_autocmd("BufWritePre", {
183
+ buffer = bufnr,
184
+ command = "EslintFixAll",
185
+ })
186
+ end,
187
+ })
188
+ ```
189
189
 
190
190
  - Or use [conform.nvim](https://github.com/stevearc/conform.nvim), [none-ls](https://github.com/nvimtools/none-ls.nvim), or [nvim-lint](https://github.com/mfussenegger/nvim-lint)
191
191
 
@@ -196,32 +196,44 @@ lspconfig.eslint.setup(
196
196
  This config works out of the box with zero configuration. Customize it when needed:
197
197
 
198
198
  ```js
199
- import { zayne } from '@zayne-labs/eslint-config'
199
+ import { zayne } from "@zayne-labs/eslint-config";
200
200
 
201
201
  export default zayne({
202
- // Project type: 'app' (default) or 'lib'
203
- type: 'app',
202
+ // `.eslintignore` is no longer supported in Flat config, use `ignores` instead
203
+ // The `ignores` option in the option (first argument) is specifically treated to always be global ignores
204
+ // And will **extend** the config's default ignores, not override them
205
+ // You can also pass a function to modify the default ignores
206
+ ignores: [
207
+ "**/fixtures",
208
+ // ...globs
209
+ ],
204
210
 
205
- // Disable all optional configs at once (keeps only essentials)
206
- withDefaults: false,
211
+ // Parse the `.gitignore` file to get the ignores, on by default
212
+ gitignore: true,
207
213
 
208
- // Enable stylistic formatting rules
209
- stylistic: true,
214
+ // Project type: 'app' (default) or 'lib'
215
+ type: "app",
210
216
 
211
- // TypeScript and React are auto-detected, but can be explicit
212
- typescript: true,
213
- react: true,
217
+ // Disable all optional configs at once (keeps only essentials)
218
+ withDefaults: false,
214
219
 
215
- // Disable specific language support
216
- jsonc: false,
217
- yaml: false,
220
+ // Enable stylistic formatting rules
221
+ stylistic: true,
218
222
 
219
- // Custom ignores (replaces .eslintignore)
220
- ignores: [
221
- 'build/**',
222
- 'dist/**',
223
- ]
224
- })
223
+ // Or customize the stylistic rules
224
+ stylistic: {
225
+ jsx: true,
226
+ quotes: "single", // or 'double'
227
+ },
228
+
229
+ // TypeScript and React are auto-detected, but can be explicit
230
+ typescript: true,
231
+ react: true,
232
+
233
+ // Disable specific language support
234
+ jsonc: false,
235
+ yaml: false,
236
+ });
225
237
  ```
226
238
 
227
239
  ### Custom Rules
@@ -229,25 +241,27 @@ export default zayne({
229
241
  Pass additional configs as extra arguments:
230
242
 
231
243
  ```ts
232
- import { zayne } from '@zayne-labs/eslint-config'
244
+ import { zayne } from "@zayne-labs/eslint-config";
233
245
 
234
246
  export default zayne(
235
- {
236
- // Base config
237
- },
238
- // Custom overrides
239
- {
240
- files: ['**/*.ts'],
241
- rules: {
242
- '@typescript-eslint/no-explicit-any': 'off',
243
- },
244
- },
245
- {
246
- rules: {
247
- 'no-console': 'warn',
248
- },
249
- },
250
- )
247
+ {
248
+ // Configures for zayne's config
249
+ },
250
+
251
+ // From the second arguments they are ESLint Flat Configs
252
+ // you can have multiple configs
253
+ {
254
+ files: ["**/*.ts"],
255
+ rules: {
256
+ "@typescript-eslint/no-explicit-any": "off",
257
+ },
258
+ },
259
+ {
260
+ rules: {
261
+ "no-console": "warn",
262
+ },
263
+ }
264
+ );
251
265
  ```
252
266
 
253
267
  ### Advanced Composition
@@ -261,61 +275,62 @@ Import and compose fine-grained configs directly:
261
275
 
262
276
  ```js
263
277
  import {
264
- astro,
265
- comments,
266
- depend,
267
- expo,
268
- ignores,
269
- imports,
270
- javascript,
271
- jsdoc,
272
- jsonc,
273
- jsx,
274
- markdown,
275
- node,
276
- perfectionist,
277
- pnpm,
278
- react,
279
- solid,
280
- sortPackageJson,
281
- sortTsconfig,
282
- stylistic,
283
- tailwindcssBetter,
284
- tanstack,
285
- toml,
286
- typescript,
287
- unicorn,
288
- vue,
289
- yaml,
290
- } from '@zayne-labs/eslint-config'
291
- import { FlatConfigComposer } from 'eslint-flat-config-utils'
292
-
293
- export default new FlatConfigComposer()
294
- .append(
295
- ignores(),
296
- javascript(),
297
- typescript(),
298
- jsx(),
299
- comments(),
300
- node(),
301
- jsdoc(),
302
- imports(),
303
- unicorn(),
304
- perfectionist(),
305
- stylistic(),
306
- react(),
307
- vue(),
308
- jsonc(),
309
- yaml(),
310
- toml(),
311
- markdown(),
312
- )
278
+ astro,
279
+ comments,
280
+ depend,
281
+ expo,
282
+ ignores,
283
+ imports,
284
+ javascript,
285
+ jsdoc,
286
+ jsonc,
287
+ jsx,
288
+ markdown,
289
+ node,
290
+ perfectionist,
291
+ pnpm,
292
+ react,
293
+ solid,
294
+ sortPackageJson,
295
+ sortTsconfig,
296
+ stylistic,
297
+ tailwindcssBetter,
298
+ tanstack,
299
+ toml,
300
+ typescript,
301
+ unicorn,
302
+ vue,
303
+ yaml,
304
+ } from "@zayne-labs/eslint-config";
305
+ import { FlatConfigComposer } from "eslint-flat-config-utils";
306
+
307
+ export default new FlatConfigComposer().append(
308
+ ignores(),
309
+ javascript(),
310
+ typescript(),
311
+ jsx(),
312
+ comments(),
313
+ node(),
314
+ jsdoc(),
315
+ imports(),
316
+ unicorn(),
317
+ perfectionist(),
318
+ stylistic(),
319
+ react(),
320
+ vue(),
321
+ jsonc(),
322
+ yaml(),
323
+ toml(),
324
+ markdown()
325
+ );
313
326
  ```
314
327
 
315
328
  </details>
316
329
 
317
330
  See [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 implementation details.
318
331
 
332
+ > Thanks to [antfu/eslint-config](https://github.com/antfu/eslint-config) for the inspiration and reference.
333
+
319
334
  ## Framework & Integration Support
320
335
 
321
336
  Enable framework-specific linting rules and integrations:
@@ -323,11 +338,11 @@ Enable framework-specific linting rules and integrations:
323
338
  ### Vue
324
339
 
325
340
  ```js
326
- import { zayne } from '@zayne-labs/eslint-config'
341
+ import { zayne } from "@zayne-labs/eslint-config";
327
342
 
328
343
  export default zayne({
329
- vue: true,
330
- })
344
+ vue: true,
345
+ });
331
346
  ```
332
347
 
333
348
  Install peer dependencies:
@@ -341,11 +356,11 @@ pnpm i -D eslint-plugin-vue vue-eslint-parser
341
356
  Auto-detected in most cases, or enable explicitly:
342
357
 
343
358
  ```js
344
- import { zayne } from '@zayne-labs/eslint-config'
359
+ import { zayne } from "@zayne-labs/eslint-config";
345
360
 
346
361
  export default zayne({
347
- react: true,
348
- })
362
+ react: true,
363
+ });
349
364
  ```
350
365
 
351
366
  Install peer dependencies (prompted automatically when running ESLint):
@@ -357,11 +372,11 @@ pnpm i -D @eslint-react/eslint-plugin eslint-plugin-react-hooks eslint-plugin-re
357
372
  ### Svelte
358
373
 
359
374
  ```js
360
- import { zayne } from '@zayne-labs/eslint-config'
375
+ import { zayne } from "@zayne-labs/eslint-config";
361
376
 
362
377
  export default zayne({
363
- svelte: true,
364
- })
378
+ svelte: true,
379
+ });
365
380
  ```
366
381
 
367
382
  Install peer dependencies:
@@ -373,11 +388,11 @@ pnpm i -D eslint-plugin-svelte
373
388
  ### Astro
374
389
 
375
390
  ```js
376
- import { zayne } from '@zayne-labs/eslint-config'
391
+ import { zayne } from "@zayne-labs/eslint-config";
377
392
 
378
393
  export default zayne({
379
- astro: true,
380
- })
394
+ astro: true,
395
+ });
381
396
  ```
382
397
 
383
398
  Install peer dependencies:
@@ -389,11 +404,11 @@ pnpm i -D eslint-plugin-astro
389
404
  ### Solid
390
405
 
391
406
  ```js
392
- import { zayne } from '@zayne-labs/eslint-config'
407
+ import { zayne } from "@zayne-labs/eslint-config";
393
408
 
394
409
  export default zayne({
395
- solid: true,
396
- })
410
+ solid: true,
411
+ });
397
412
  ```
398
413
 
399
414
  Install peer dependencies:
@@ -407,11 +422,11 @@ pnpm i -D eslint-plugin-solid
407
422
  Uses the enhanced `eslint-plugin-better-tailwindcss` for improved class sorting and validation:
408
423
 
409
424
  ```js
410
- import { zayne } from '@zayne-labs/eslint-config'
425
+ import { zayne } from "@zayne-labs/eslint-config";
411
426
 
412
427
  export default zayne({
413
- tailwindcssBetter: true,
414
- })
428
+ tailwindcssBetter: true,
429
+ });
415
430
  ```
416
431
 
417
432
  Install peer dependencies:
@@ -423,11 +438,11 @@ pnpm i -D eslint-plugin-better-tailwindcss
423
438
  ### Expo (React Native)
424
439
 
425
440
  ```js
426
- import { zayne } from '@zayne-labs/eslint-config'
441
+ import { zayne } from "@zayne-labs/eslint-config";
427
442
 
428
443
  export default zayne({
429
- expo: true,
430
- })
444
+ expo: true,
445
+ });
431
446
  ```
432
447
 
433
448
  Install peer dependencies:
@@ -441,14 +456,14 @@ pnpm i -D eslint-config-expo
441
456
  Support for TanStack Query and Router:
442
457
 
443
458
  ```js
444
- import { zayne } from '@zayne-labs/eslint-config'
459
+ import { zayne } from "@zayne-labs/eslint-config";
445
460
 
446
461
  export default zayne({
447
- tanstack: {
448
- query: true,
449
- router: true,
450
- },
451
- })
462
+ tanstack: {
463
+ query: true,
464
+ router: true,
465
+ },
466
+ });
452
467
  ```
453
468
 
454
469
  Install peer dependencies:
@@ -462,11 +477,11 @@ pnpm i -D @tanstack/eslint-plugin-query @tanstack/eslint-plugin-router
462
477
  Lint PNPM catalog protocol usage:
463
478
 
464
479
  ```js
465
- import { zayne } from '@zayne-labs/eslint-config'
480
+ import { zayne } from "@zayne-labs/eslint-config";
466
481
 
467
482
  export default zayne({
468
- pnpm: true,
469
- })
483
+ pnpm: true,
484
+ });
470
485
  ```
471
486
 
472
487
  Install peer dependencies:
@@ -480,11 +495,11 @@ pnpm i -D eslint-plugin-pnpm
480
495
  Enforce dependency rules with `eslint-plugin-depend`:
481
496
 
482
497
  ```js
483
- import { zayne } from '@zayne-labs/eslint-config'
498
+ import { zayne } from "@zayne-labs/eslint-config";
484
499
 
485
500
  export default zayne({
486
- depend: true,
487
- })
501
+ depend: true,
502
+ });
488
503
  ```
489
504
 
490
505
  Install peer dependencies:
@@ -505,25 +520,25 @@ Only specify `tsconfigPath` when you need to:
505
520
  Single custom tsconfig location:
506
521
 
507
522
  ```js
508
- import { zayne } from '@zayne-labs/eslint-config'
523
+ import { zayne } from "@zayne-labs/eslint-config";
509
524
 
510
525
  export default zayne({
511
- typescript: {
512
- tsconfigPath: './config/tsconfig.json',
513
- },
514
- })
526
+ typescript: {
527
+ tsconfigPath: "./config/tsconfig.json",
528
+ },
529
+ });
515
530
  ```
516
531
 
517
532
  Multiple tsconfigs:
518
533
 
519
534
  ```js
520
- import { zayne } from '@zayne-labs/eslint-config'
535
+ import { zayne } from "@zayne-labs/eslint-config";
521
536
 
522
537
  export default zayne({
523
- typescript: {
524
- tsconfigPath: ['./tsconfig.json', './tsconfig.node.json'],
525
- },
526
- })
538
+ typescript: {
539
+ tsconfigPath: ["./tsconfig.json", "./tsconfig.node.json"],
540
+ },
541
+ });
527
542
  ```
528
543
 
529
544
  ## Inspecting Config
package/dist/cli/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import { defineEnum, defineEnumDeep } from "@zayne-labs/toolkit-type-helpers";
2
2
  import process from "node:process";
3
+ import fsp from "node:fs/promises";
4
+ import fs from "node:fs";
5
+ import path from "node:path";
3
6
  import * as p from "@clack/prompts";
4
7
  import c, { green } from "ansis";
5
8
  import { cac } from "cac";
6
- import fs from "node:fs";
7
- import path from "node:path";
8
- import fsp from "node:fs/promises";
9
9
  import parse from "parse-gitignore";
10
10
  import { execSync } from "node:child_process";
11
11
 
12
12
  //#region package.json
13
- var version = "0.11.5";
13
+ var version = "0.11.7";
14
14
 
15
15
  //#endregion
16
16
  //#region src/cli/constants.ts
@@ -140,16 +140,16 @@ const updateEslintFiles = async (result) => {
140
140
  //#endregion
141
141
  //#region src/cli/constants-generated.ts
142
142
  const versionsMap = defineEnum({
143
- "@eslint-react/eslint-plugin": "^2.1.1",
144
- "astro-eslint-parser": "^1.2.2",
145
- eslint: "^9.37.0",
146
- "eslint-plugin-astro": "^1.3.1",
147
- "eslint-plugin-better-tailwindcss": "^3.7.9",
148
- "eslint-plugin-react-hooks": "^7.0.0",
149
- "eslint-plugin-react-refresh": "^0.4.23",
150
- "eslint-plugin-solid": "^0.14.5",
151
- "eslint-plugin-svelte": "^3.12.4",
152
- "svelte-eslint-parser": "^1.1.0"
143
+ "@eslint-react/eslint-plugin": "2.4.0",
144
+ "astro-eslint-parser": "1.2.2",
145
+ eslint: "9.39.2",
146
+ "eslint-plugin-astro": "1.5.0",
147
+ "eslint-plugin-better-tailwindcss": "3.8.0",
148
+ "eslint-plugin-react-hooks": "7.0.1",
149
+ "eslint-plugin-react-refresh": "0.4.26",
150
+ "eslint-plugin-solid": "0.14.5",
151
+ "eslint-plugin-svelte": "3.13.1",
152
+ "svelte-eslint-parser": "1.1.0"
153
153
  });
154
154
 
155
155
  //#endregion