@ntnyq/eslint-config 3.6.0 → 3.7.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/dist/index.js CHANGED
@@ -72,6 +72,7 @@ var GLOB_JSX = `${GLOB_JS}x`;
72
72
  var GLOB_TS = "**/*.?([cm])ts";
73
73
  var GLOB_TSX = `${GLOB_TS}x`;
74
74
  var GLOB_DTS = "**/*.d.?([cm])ts";
75
+ var GLOB_TYPES = [GLOB_DTS, `**/types/${GLOB_TS}`, `**/types.ts`];
75
76
  var GLOB_TEST = [
76
77
  `**/*.test.${GLOB_SRC_EXT}`,
77
78
  `**/*.spec.${GLOB_SRC_EXT}`,
@@ -254,12 +255,12 @@ var unCategorizedRules = {
254
255
  "vue/no-multiple-objects-in-class": "error",
255
256
  "vue/prefer-separate-static-class": "error",
256
257
  "vue/no-ref-object-reactivity-loss": "error",
257
- "vue/no-duplicate-attr-inheritance": "error",
258
258
  "vue/prefer-prop-type-boolean-first": "error",
259
259
  "vue/html-comment-indent": ["error", 2],
260
260
  "vue/next-tick-style": ["error", "promise"],
261
261
  "vue/v-for-delimiter-style": ["error", "in"],
262
262
  "vue/no-restricted-v-bind": ["error", "/^v-/"],
263
+ "vue/slot-name-casing": ["error", "camelCase"],
263
264
  "vue/custom-event-name-casing": ["error", "camelCase"],
264
265
  "vue/define-props-declaration": ["error", "type-based"],
265
266
  "vue/define-emits-declaration": ["error", "type-literal"],
@@ -274,6 +275,12 @@ var unCategorizedRules = {
274
275
  reset: true
275
276
  }
276
277
  ],
278
+ "vue/no-duplicate-attr-inheritance": [
279
+ "error",
280
+ {
281
+ checkMultiRootNodes: true
282
+ }
283
+ ],
277
284
  "vue/block-order": [
278
285
  "error",
279
286
  {
@@ -557,7 +564,13 @@ var node = (options = {}) => [
557
564
  // src/configs/sort.ts
558
565
  var sort = (options = {}) => {
559
566
  const configs2 = [];
560
- if (options.tsconfig ?? true) {
567
+ const {
568
+ tsconfig: enableSortTsconfig = true,
569
+ packageJson: enableSortPackageJson = true,
570
+ i18nLocale: enableSortI18nLocale = true,
571
+ pnpmWorkspace: enableSortPnpmWorkspace = true
572
+ } = options;
573
+ if (enableSortTsconfig) {
561
574
  configs2.push({
562
575
  name: "ntnyq/sort/tsconfig",
563
576
  files: ["**/tsconfig.json", "**/tsconfig.*.json"],
@@ -673,7 +686,7 @@ var sort = (options = {}) => {
673
686
  }
674
687
  });
675
688
  }
676
- if (options.packageJson ?? true) {
689
+ if (enableSortPackageJson) {
677
690
  configs2.push({
678
691
  name: "ntnyq/sort/package-json",
679
692
  files: ["**/package.json"],
@@ -841,7 +854,7 @@ var sort = (options = {}) => {
841
854
  }
842
855
  });
843
856
  }
844
- if (options.i18nLocale ?? true) {
857
+ if (enableSortI18nLocale) {
845
858
  configs2.push(
846
859
  {
847
860
  name: "ntnyq/sort/i18n-locale/json",
@@ -871,7 +884,7 @@ var sort = (options = {}) => {
871
884
  }
872
885
  );
873
886
  }
874
- if (options.pnpmWorkspace ?? true) {
887
+ if (enableSortPnpmWorkspace) {
875
888
  configs2.push({
876
889
  name: "ntnyq/sort/pnpm-workspace",
877
890
  files: ["**/pnpm-workspace.yaml"],
@@ -1297,51 +1310,51 @@ var unocss = (options = {}) => [
1297
1310
 
1298
1311
  // src/constants.ts
1299
1312
  var DEFAULT_PRETTIER_OPTIONS = {
1313
+ // Include parentheses around a sole arrow function parameter
1314
+ arrowParens: "avoid",
1315
+ // Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being alone on the next line (does not apply to self closing elements)
1316
+ bracketSameLine: false,
1317
+ // Print spaces between brackets in object literals.
1318
+ bracketSpacing: true,
1319
+ // Control whether Prettier formats quoted code embedded in the file
1320
+ embeddedLanguageFormatting: "auto",
1321
+ // End of line
1322
+ endOfLine: "lf",
1323
+ // Specify the global whitespace sensitivity for HTML files
1324
+ htmlWhitespaceSensitivity: "css",
1325
+ // Prettier can insert a special @format marker at the top of files specifying that the file has been formatted with prettier.
1326
+ insertPragma: false,
1327
+ // Use single quotes instead of double quotes in JSX
1328
+ jsxSingleQuote: true,
1300
1329
  // Maximum line length
1301
1330
  printWidth: 100,
1302
- // Specify the number of spaces per indentation-level
1303
- tabWidth: 2,
1304
- // Indent lines with tabs instead of spaces
1305
- useTabs: false,
1306
- // Use semicolons or not
1307
- semi: false,
1308
- // Use single quotes instead of double quotes
1309
- singleQuote: true,
1331
+ // By default, Prettier will wrap markdown text as-is since some services use a line-break-sensitive renderer, e.g. GitHub comment and Bitbucket.
1332
+ proseWrap: "preserve",
1310
1333
  // Change when properties in objects are quoted
1311
1334
  quoteProps: "as-needed",
1312
- // Use single quotes instead of double quotes in JSX
1313
- jsxSingleQuote: true,
1314
- // Print trailing commas wherever possible when multi-line
1315
- trailingComma: "all",
1316
- // Print spaces between brackets in object literals.
1317
- bracketSpacing: true,
1318
- // Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being alone on the next line (does not apply to self closing elements)
1319
- bracketSameLine: false,
1320
- // Include parentheses around a sole arrow function parameter
1321
- arrowParens: "avoid",
1335
+ rangeEnd: Number.POSITIVE_INFINITY,
1322
1336
  // Format only a segment of a file.
1323
1337
  rangeStart: 0,
1324
- rangeEnd: Number.POSITIVE_INFINITY,
1325
1338
  // Specify which parser to use.
1326
1339
  // parser: undefined,
1327
1340
  // Specify the file name to use to infer which parser to use.
1328
1341
  // filepath: undefined,
1329
1342
  // Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file.
1330
1343
  requirePragma: false,
1331
- // Prettier can insert a special @format marker at the top of files specifying that the file has been formatted with prettier.
1332
- insertPragma: false,
1333
- // By default, Prettier will wrap markdown text as-is since some services use a line-break-sensitive renderer, e.g. GitHub comment and Bitbucket.
1334
- proseWrap: "preserve",
1335
- // Specify the global whitespace sensitivity for HTML files
1336
- htmlWhitespaceSensitivity: "css",
1337
- // Whether or not to indent the code inside <script> and <style> tags in Vue files
1338
- vueIndentScriptAndStyle: false,
1339
- // End of line
1340
- endOfLine: "lf",
1341
- // Control whether Prettier formats quoted code embedded in the file
1342
- embeddedLanguageFormatting: "auto",
1344
+ // Use semicolons or not
1345
+ semi: false,
1343
1346
  // Enforce single attribute per line in HTML, Vue and JSX
1344
- singleAttributePerLine: true
1347
+ singleAttributePerLine: true,
1348
+ // Use single quotes instead of double quotes
1349
+ singleQuote: true,
1350
+ // Specify the number of spaces per indentation-level
1351
+ tabWidth: 2,
1352
+ // Print trailing commas wherever possible when multi-line
1353
+ trailingComma: "all",
1354
+ // Indent lines with tabs instead of spaces
1355
+ useTabs: false,
1356
+ // Whether or not to indent the code inside <script> and <style> tags in Vue files
1357
+ vueIndentScriptAndStyle: false
1345
1358
  };
1346
1359
 
1347
1360
  // src/utils/env.ts
@@ -1676,6 +1689,27 @@ var specials = (options = {}) => [
1676
1689
  ...options.overridesUserScriptsRules
1677
1690
  }
1678
1691
  },
1692
+ {
1693
+ name: "ntnyq/specials/config-file",
1694
+ files: [`**/*.config*.${GLOB_SRC_EXT}`],
1695
+ plugins: {
1696
+ import: default14,
1697
+ perfectionist: default19
1698
+ },
1699
+ rules: {
1700
+ "no-console": "off",
1701
+ "import/no-default-export": "off",
1702
+ "@typescript-eslint/explicit-function-return-type": "off",
1703
+ "perfectionist/sort-objects": [
1704
+ "error",
1705
+ {
1706
+ type: "alphabetical",
1707
+ order: "asc"
1708
+ }
1709
+ ],
1710
+ ...options.overridesConfigFileRules
1711
+ }
1712
+ },
1679
1713
  // More special case configs
1680
1714
  // So don't need to append configs to composer
1681
1715
  ...options.specialCaseConfigs ? options.specialCaseConfigs : []
@@ -2285,7 +2319,7 @@ var typescript = (options = {}) => {
2285
2319
  ] : [],
2286
2320
  {
2287
2321
  name: "ntnyq/ts/types",
2288
- files: [GLOB_DTS, "**/types/**/*.ts"],
2322
+ files: [...GLOB_TYPES],
2289
2323
  rules: {
2290
2324
  "no-use-before-define": "off",
2291
2325
  "no-restricted-syntax": "off",
@@ -2314,90 +2348,238 @@ var githubAction = (options = {}) => [
2314
2348
  ];
2315
2349
 
2316
2350
  // src/configs/perfectionist.ts
2317
- var perfectionist = (options = {}) => [
2318
- {
2319
- name: "ntnyq/perfectionist",
2320
- plugins: {
2321
- perfectionist: default19
2322
- },
2323
- rules: {
2324
- "perfectionist/sort-imports": [
2325
- "error",
2326
- {
2327
- groups: [
2328
- // Side effect style imports (e.g. 'normalize.css')
2329
- "side-effect-style",
2330
- // Styles (e.g. *.{css,scss,less})
2331
- "style",
2332
- // Node.js built-in modules. (e.g. fs, path)
2333
- "builtin",
2334
- // External modules installed in the project (e.g. vue, lodash)
2335
- "external",
2336
- // Internal modules (e.g. @/utils, @/components)
2337
- "internal",
2338
- // Modules from parent directory (e.g. ../utils)
2339
- "parent",
2340
- // Modules from the same directory (e.g. ./utils)
2341
- "sibling",
2342
- // Main file from the current directory (e.g. ./index)
2343
- "index",
2344
- // TypeScript object-imports (e.g. import log = console.log)
2345
- "object",
2346
- // Side effect imports (e.g. import 'babel-polyfill')
2347
- "side-effect",
2348
- /**
2349
- * Type import at the end
2350
- */
2351
- "builtin-type",
2352
- "external-type",
2353
- "internal-type",
2354
- "parent-type",
2355
- "sibling-type",
2356
- "index-type",
2357
- "type",
2358
- /**
2359
- * Imports that don’t fit into any other group
2360
- */
2361
- "unknown"
2362
- ],
2363
- order: options.imports?.order || "asc",
2364
- type: options.imports?.type || "natural",
2365
- ignoreCase: true,
2366
- internalPattern: ["^~/.+", "^@/.+", "^#.+"],
2367
- newlinesBetween: "ignore"
2368
- }
2369
- ],
2370
- "perfectionist/sort-exports": [
2371
- "error",
2372
- {
2373
- order: options.exports?.order || "asc",
2374
- type: options.exports?.type || "line-length"
2375
- }
2376
- ],
2377
- "perfectionist/sort-named-exports": [
2378
- "error",
2379
- {
2380
- type: options.namedExports?.type || "alphabetical",
2381
- order: options.namedExports?.order || "asc",
2382
- ignoreCase: true,
2383
- groupKind: "values-first"
2384
- }
2385
- ],
2386
- "perfectionist/sort-named-imports": [
2387
- "error",
2388
- {
2389
- type: options.namedImports?.type || "alphabetical",
2390
- order: options.namedImports?.order || "asc",
2391
- ignoreCase: true,
2392
- ignoreAlias: false,
2393
- groupKind: "values-first"
2394
- }
2395
- ],
2396
- // Overrides rules
2397
- ...options.overrides
2351
+ var perfectionist = (options = {}) => {
2352
+ const {
2353
+ sortEnums: enableSortEnums = true,
2354
+ sortTypes: enableSortTypes = true,
2355
+ sortConstants: enableSortConstants = true
2356
+ } = options;
2357
+ const configs2 = [
2358
+ {
2359
+ name: "ntnyq/perfectionist/common",
2360
+ plugins: {
2361
+ perfectionist: default19
2362
+ },
2363
+ rules: {
2364
+ "perfectionist/sort-imports": [
2365
+ "error",
2366
+ {
2367
+ groups: [
2368
+ // Side effect style imports (e.g. 'normalize.css')
2369
+ "side-effect-style",
2370
+ // Styles (e.g. *.{css,scss,less})
2371
+ "style",
2372
+ // Node.js built-in modules. (e.g. fs, path)
2373
+ "builtin",
2374
+ // External modules installed in the project (e.g. vue, lodash)
2375
+ "external",
2376
+ // Internal modules (e.g. @/utils, @/components)
2377
+ "internal",
2378
+ // Modules from parent directory (e.g. ../utils)
2379
+ "parent",
2380
+ // Modules from the same directory (e.g. ./utils)
2381
+ "sibling",
2382
+ // Main file from the current directory (e.g. ./index)
2383
+ "index",
2384
+ // TypeScript object-imports (e.g. import log = console.log)
2385
+ "object",
2386
+ // Side effect imports (e.g. import 'babel-polyfill')
2387
+ "side-effect",
2388
+ /**
2389
+ * Type import at the end
2390
+ */
2391
+ "builtin-type",
2392
+ "external-type",
2393
+ "internal-type",
2394
+ "parent-type",
2395
+ "sibling-type",
2396
+ "index-type",
2397
+ "type",
2398
+ /**
2399
+ * Imports that don’t fit into any other group
2400
+ */
2401
+ "unknown"
2402
+ ],
2403
+ order: "asc",
2404
+ type: "natural",
2405
+ ignoreCase: true,
2406
+ internalPattern: ["^~/.+", "^@/.+", "^#.+"],
2407
+ newlinesBetween: "ignore"
2408
+ }
2409
+ ],
2410
+ "perfectionist/sort-exports": [
2411
+ "error",
2412
+ {
2413
+ order: "asc",
2414
+ type: "line-length"
2415
+ }
2416
+ ],
2417
+ "perfectionist/sort-named-exports": [
2418
+ "error",
2419
+ {
2420
+ type: "alphabetical",
2421
+ order: "asc",
2422
+ ignoreCase: true,
2423
+ groupKind: "values-first"
2424
+ }
2425
+ ],
2426
+ "perfectionist/sort-named-imports": [
2427
+ "error",
2428
+ {
2429
+ type: "alphabetical",
2430
+ order: "asc",
2431
+ ignoreCase: true,
2432
+ ignoreAlias: false,
2433
+ groupKind: "values-first"
2434
+ }
2435
+ ],
2436
+ // Overrides rules
2437
+ ...options.overrides
2438
+ }
2398
2439
  }
2440
+ ];
2441
+ if (enableSortEnums) {
2442
+ configs2.push({
2443
+ name: "ntnyq/perfectionist/enums",
2444
+ files: [`**/enums/${GLOB_SRC}`, `**/enums.${GLOB_SRC_EXT}`],
2445
+ plugins: {
2446
+ perfectionist: default19
2447
+ },
2448
+ rules: {
2449
+ "perfectionist/sort-enums": [
2450
+ "error",
2451
+ {
2452
+ type: "alphabetical",
2453
+ order: "asc"
2454
+ }
2455
+ ],
2456
+ "perfectionist/sort-modules": [
2457
+ "error",
2458
+ {
2459
+ type: "alphabetical",
2460
+ order: "asc",
2461
+ partitionByComment: true
2462
+ }
2463
+ ],
2464
+ // Overrides rules
2465
+ ...options.overridesEnumsRules
2466
+ }
2467
+ });
2399
2468
  }
2400
- ];
2469
+ if (enableSortTypes) {
2470
+ configs2.push({
2471
+ name: "ntnyq/perfectionist/types",
2472
+ files: [...GLOB_TYPES],
2473
+ plugins: {
2474
+ perfectionist: default19
2475
+ },
2476
+ rules: {
2477
+ "perfectionist/sort-heritage-clauses": [
2478
+ "error",
2479
+ {
2480
+ type: "alphabetical",
2481
+ order: "asc"
2482
+ }
2483
+ ],
2484
+ // 'perfectionist/sort-interfaces': [
2485
+ // 'error',
2486
+ // {
2487
+ // type: 'alphabetical',
2488
+ // order: 'asc',
2489
+ // },
2490
+ // ],
2491
+ "perfectionist/sort-intersection-types": [
2492
+ "error",
2493
+ {
2494
+ type: "alphabetical",
2495
+ order: "asc",
2496
+ groups: [
2497
+ "intersection",
2498
+ "named",
2499
+ "conditional",
2500
+ "function",
2501
+ "import",
2502
+ "keyword",
2503
+ "literal",
2504
+ "object",
2505
+ "operator",
2506
+ "tuple",
2507
+ "union",
2508
+ "nullish"
2509
+ ]
2510
+ }
2511
+ ],
2512
+ "perfectionist/sort-modules": [
2513
+ "error",
2514
+ {
2515
+ type: "alphabetical",
2516
+ order: "asc",
2517
+ partitionByComment: true
2518
+ }
2519
+ ],
2520
+ "perfectionist/sort-object-types": [
2521
+ "error",
2522
+ {
2523
+ type: "alphabetical",
2524
+ order: "asc"
2525
+ }
2526
+ ],
2527
+ "perfectionist/sort-union-types": [
2528
+ "error",
2529
+ {
2530
+ type: "alphabetical",
2531
+ order: "asc"
2532
+ }
2533
+ ],
2534
+ // Overrides rules
2535
+ ...options.overridesTypesRules
2536
+ }
2537
+ });
2538
+ }
2539
+ if (enableSortConstants) {
2540
+ configs2.push({
2541
+ name: "ntnyq/perfectionist/constants",
2542
+ files: [`**/constants/${GLOB_SRC}`, `**/constants.${GLOB_SRC_EXT}`],
2543
+ plugins: {
2544
+ perfectionist: default19
2545
+ },
2546
+ rules: {
2547
+ "perfectionist/sort-maps": [
2548
+ "error",
2549
+ {
2550
+ type: "alphabetical",
2551
+ order: "asc"
2552
+ }
2553
+ ],
2554
+ "perfectionist/sort-objects": [
2555
+ "error",
2556
+ {
2557
+ type: "alphabetical",
2558
+ order: "asc"
2559
+ }
2560
+ ],
2561
+ "perfectionist/sort-sets": [
2562
+ "error",
2563
+ {
2564
+ type: "alphabetical",
2565
+ order: "asc"
2566
+ }
2567
+ ],
2568
+ "perfectionist/sort-modules": [
2569
+ "error",
2570
+ {
2571
+ type: "alphabetical",
2572
+ order: "asc",
2573
+ partitionByComment: true
2574
+ }
2575
+ ],
2576
+ // Overrides rules
2577
+ ...options.overridesConstantsRules
2578
+ }
2579
+ });
2580
+ }
2581
+ return configs2;
2582
+ };
2401
2583
 
2402
2584
  // src/configs/unusedImports.ts
2403
2585
  var unusedImports = (options = {}) => [
@@ -2656,6 +2838,7 @@ export {
2656
2838
  GLOB_TOML,
2657
2839
  GLOB_TS,
2658
2840
  GLOB_TSX,
2841
+ GLOB_TYPES,
2659
2842
  GLOB_VUE,
2660
2843
  GLOB_YAML,
2661
2844
  antfu,
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@ntnyq/eslint-config",
3
3
  "type": "module",
4
- "version": "3.6.0",
5
- "packageManager": "pnpm@9.14.2",
4
+ "version": "3.7.1",
5
+ "packageManager": "pnpm@9.14.4",
6
6
  "description": "An opinionated ESLint config preset of ntnyq",
7
7
  "keywords": [
8
8
  "eslint",
@@ -57,7 +57,7 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
60
- "@eslint/js": "^9.15.0",
60
+ "@eslint/js": "^9.16.0",
61
61
  "@eslint/markdown": "^6.2.1",
62
62
  "@stylistic/eslint-plugin": "^2.11.0",
63
63
  "@unocss/eslint-plugin": "^0.64.1",
@@ -67,20 +67,20 @@
67
67
  "eslint-merge-processors": "^0.1.0",
68
68
  "eslint-plugin-antfu": "^2.7.0",
69
69
  "eslint-plugin-command": "^0.2.6",
70
- "eslint-plugin-format": "^0.1.2",
71
- "eslint-plugin-github-action": "^0.0.4",
70
+ "eslint-plugin-format": "^0.1.3",
71
+ "eslint-plugin-github-action": "^0.0.6",
72
72
  "eslint-plugin-import-x": "^4.4.3",
73
73
  "eslint-plugin-jsdoc": "^50.6.0",
74
74
  "eslint-plugin-jsonc": "^2.18.2",
75
75
  "eslint-plugin-n": "^17.14.0",
76
- "eslint-plugin-ntnyq": "^0.7.0",
76
+ "eslint-plugin-ntnyq": "^0.7.1",
77
77
  "eslint-plugin-perfectionist": "^4.1.2",
78
78
  "eslint-plugin-prettier": "^5.2.1",
79
79
  "eslint-plugin-regexp": "^2.7.0",
80
80
  "eslint-plugin-toml": "^0.11.1",
81
81
  "eslint-plugin-unicorn": "^56.0.1",
82
82
  "eslint-plugin-unused-imports": "^4.1.4",
83
- "eslint-plugin-vue": "^9.31.0",
83
+ "eslint-plugin-vue": "^9.32.0",
84
84
  "eslint-plugin-yml": "^1.15.0",
85
85
  "eslint-processor-vue-blocks": "^0.1.2",
86
86
  "globals": "^15.12.0",
@@ -96,10 +96,10 @@
96
96
  "@ntnyq/prettier-config": "^1.22.0",
97
97
  "@types/node": "^22.10.1",
98
98
  "bumpp": "^9.8.1",
99
- "eslint": "^9.15.0",
99
+ "eslint": "^9.16.0",
100
100
  "eslint-typegen": "^0.3.2",
101
101
  "husky": "^9.1.7",
102
- "jiti": "^2.4.0",
102
+ "jiti": "^2.4.1",
103
103
  "nano-staged": "^0.8.0",
104
104
  "npm-run-all2": "^7.0.1",
105
105
  "rimraf": "^6.0.1",
@@ -107,7 +107,7 @@
107
107
  "tsx": "^4.19.2",
108
108
  "typescript": "^5.7.2",
109
109
  "vitest": "^2.1.6",
110
- "zx": "^8.2.3"
110
+ "zx": "^8.2.4"
111
111
  },
112
112
  "engines": {
113
113
  "node": ">=18.18.0"