@kirklin/eslint-config 2.2.0 → 2.3.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/dist/index.cjs CHANGED
@@ -34,6 +34,7 @@ __export(src_exports, {
34
34
  GLOB_ASTRO: () => GLOB_ASTRO,
35
35
  GLOB_CSS: () => GLOB_CSS,
36
36
  GLOB_EXCLUDE: () => GLOB_EXCLUDE,
37
+ GLOB_GRAPHQL: () => GLOB_GRAPHQL,
37
38
  GLOB_HTML: () => GLOB_HTML,
38
39
  GLOB_JS: () => GLOB_JS,
39
40
  GLOB_JSON: () => GLOB_JSON,
@@ -61,6 +62,7 @@ __export(src_exports, {
61
62
  combine: () => combine,
62
63
  comments: () => comments,
63
64
  default: () => src_default,
65
+ defaultPluginRenaming: () => defaultPluginRenaming,
64
66
  ensurePackages: () => ensurePackages,
65
67
  formatters: () => formatters,
66
68
  getOverrides: () => getOverrides,
@@ -76,8 +78,10 @@ __export(src_exports, {
76
78
  parserPlain: () => parserPlain,
77
79
  perfectionist: () => perfectionist,
78
80
  react: () => react,
81
+ renamePluginInConfigs: () => renamePluginInConfigs,
79
82
  renameRules: () => renameRules,
80
83
  resolveSubOptions: () => resolveSubOptions,
84
+ solid: () => solid,
81
85
  sortPackageJson: () => sortPackageJson,
82
86
  sortTsconfig: () => sortTsconfig,
83
87
  stylistic: () => stylistic,
@@ -97,11 +101,12 @@ module.exports = __toCommonJS(src_exports);
97
101
  var import_node_process3 = __toESM(require("process"), 1);
98
102
  var import_node_fs = __toESM(require("fs"), 1);
99
103
  var import_local_pkg4 = require("local-pkg");
104
+ var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
100
105
 
101
106
  // src/plugins.ts
102
107
  var import_eslint_plugin_kirklin = __toESM(require("eslint-plugin-kirklin"), 1);
103
108
  var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
104
- var pluginImport = __toESM(require("eslint-plugin-i"), 1);
109
+ var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
105
110
  var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
106
111
  var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
107
112
  var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
@@ -111,7 +116,7 @@ var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfecti
111
116
  async function comments() {
112
117
  return [
113
118
  {
114
- name: "kirklin:eslint-comments",
119
+ name: "kirklin/eslint-comments/rules",
115
120
  plugins: {
116
121
  "eslint-comments": import_eslint_plugin_eslint_comments.default
117
122
  },
@@ -148,6 +153,7 @@ var GLOB_YAML = "**/*.y?(a)ml";
148
153
  var GLOB_TOML = "**/*.toml";
149
154
  var GLOB_HTML = "**/*.htm?(l)";
150
155
  var GLOB_ASTRO = "**/*.astro";
156
+ var GLOB_GRAPHQL = "**/*.{g,graph}ql";
151
157
  var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
152
158
  var GLOB_TESTS = [
153
159
  `**/__tests__/**/*.${GLOB_SRC_EXT}`,
@@ -204,6 +210,8 @@ async function ignores() {
204
210
  return [
205
211
  {
206
212
  ignores: GLOB_EXCLUDE
213
+ // Awaits https://github.com/humanwhocodes/config-array/pull/131
214
+ // name: 'kirklin/ignores',
207
215
  }
208
216
  ];
209
217
  }
@@ -215,7 +223,7 @@ async function imports(options = {}) {
215
223
  } = options;
216
224
  return [
217
225
  {
218
- name: "kirklin:imports",
226
+ name: "kirklin/imports/rules",
219
227
  plugins: {
220
228
  import: pluginImport,
221
229
  kirklin: import_eslint_plugin_kirklin.default
@@ -238,7 +246,7 @@ async function imports(options = {}) {
238
246
  },
239
247
  {
240
248
  files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
241
- name: "kirklin:imports:bin",
249
+ name: "kirklin/imports/disables/bin",
242
250
  rules: {
243
251
  "kirklin/no-import-dist": "off",
244
252
  "kirklin/no-import-node-modules-by-path": "off"
@@ -278,7 +286,7 @@ async function javascript(options = {}) {
278
286
  linterOptions: {
279
287
  reportUnusedDisableDirectives: true
280
288
  },
281
- name: "kirklin:javascript",
289
+ name: "kirklin/javascript/rules",
282
290
  plugins: {
283
291
  "kirklin": import_eslint_plugin_kirklin.default,
284
292
  "unused-imports": import_eslint_plugin_unused_imports.default
@@ -332,7 +340,7 @@ async function javascript(options = {}) {
332
340
  "no-multi-str": "error",
333
341
  "no-new": "error",
334
342
  "no-new-func": "error",
335
- "no-new-symbol": "error",
343
+ "no-new-native-nonconstructor": "error",
336
344
  "no-new-wrappers": "error",
337
345
  "no-obj-calls": "error",
338
346
  "no-octal": "error",
@@ -444,7 +452,13 @@ async function javascript(options = {}) {
444
452
  "unused-imports/no-unused-imports": isInEditor ? "off" : "error",
445
453
  "unused-imports/no-unused-vars": [
446
454
  "error",
447
- { args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^_" }
455
+ {
456
+ args: "after-used",
457
+ argsIgnorePattern: "^_",
458
+ ignoreRestSiblings: true,
459
+ vars: "all",
460
+ varsIgnorePattern: "^_"
461
+ }
448
462
  ],
449
463
  "use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
450
464
  "valid-typeof": ["error", { requireStringLiterals: true }],
@@ -455,7 +469,7 @@ async function javascript(options = {}) {
455
469
  },
456
470
  {
457
471
  files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
458
- name: "kirklin:scripts-overrides",
472
+ name: "kirklin/javascript/disables/cli",
459
473
  rules: {
460
474
  "no-console": "off"
461
475
  }
@@ -490,16 +504,37 @@ async function combine(...configs) {
490
504
  const resolved = await Promise.all(configs);
491
505
  return resolved.flat();
492
506
  }
493
- function renameRules(rules, from, to) {
507
+ function renameRules(rules, map) {
494
508
  return Object.fromEntries(
495
509
  Object.entries(rules).map(([key, value]) => {
496
- if (key.startsWith(from)) {
497
- return [to + key.slice(from.length), value];
510
+ for (const [from, to] of Object.entries(map)) {
511
+ if (key.startsWith(`${from}/`)) {
512
+ return [to + key.slice(from.length), value];
513
+ }
498
514
  }
499
515
  return [key, value];
500
516
  })
501
517
  );
502
518
  }
519
+ function renamePluginInConfigs(configs, map) {
520
+ return configs.map((i) => {
521
+ const clone = { ...i };
522
+ if (clone.rules) {
523
+ clone.rules = renameRules(clone.rules, map);
524
+ }
525
+ if (clone.plugins) {
526
+ clone.plugins = Object.fromEntries(
527
+ Object.entries(clone.plugins).map(([key, value]) => {
528
+ if (key in map) {
529
+ return [map[key], value];
530
+ }
531
+ return [key, value];
532
+ })
533
+ );
534
+ }
535
+ return clone;
536
+ });
537
+ }
503
538
  function toArray(value) {
504
539
  return Array.isArray(value) ? value : [value];
505
540
  }
@@ -531,7 +566,7 @@ async function jsdoc(options = {}) {
531
566
  } = options;
532
567
  return [
533
568
  {
534
- name: "kirklin:jsdoc",
569
+ name: "kirklin/jsdoc/rules",
535
570
  plugins: {
536
571
  jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
537
572
  },
@@ -579,7 +614,7 @@ async function jsonc(options = {}) {
579
614
  ]);
580
615
  return [
581
616
  {
582
- name: "kirklin:jsonc:setup",
617
+ name: "kirklin/jsonc/setup",
583
618
  plugins: {
584
619
  jsonc: pluginJsonc
585
620
  }
@@ -589,7 +624,7 @@ async function jsonc(options = {}) {
589
624
  languageOptions: {
590
625
  parser: parserJsonc
591
626
  },
592
- name: "kirklin:jsonc:rules",
627
+ name: "kirklin/jsonc/rules",
593
628
  rules: {
594
629
  "jsonc/no-bigint-literals": "error",
595
630
  "jsonc/no-binary-expression": "error",
@@ -646,7 +681,7 @@ async function markdown(options = {}) {
646
681
  const markdown2 = await interopDefault(import("eslint-plugin-markdown"));
647
682
  return [
648
683
  {
649
- name: "kirklin:markdown:setup",
684
+ name: "kirklin/markdown/setup",
650
685
  plugins: {
651
686
  markdown: markdown2
652
687
  }
@@ -654,7 +689,7 @@ async function markdown(options = {}) {
654
689
  {
655
690
  files,
656
691
  ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
657
- name: "kirklin:markdown:processor",
692
+ name: "kirklin/markdown/processor",
658
693
  // `eslint-plugin-markdown` only creates virtual files for code blocks,
659
694
  // but not the markdown file itself. We use `eslint-merge-processors` to
660
695
  // add a pass-through processor for the markdown file itself.
@@ -668,7 +703,7 @@ async function markdown(options = {}) {
668
703
  languageOptions: {
669
704
  parser: parserPlain
670
705
  },
671
- name: "kirklin:markdown:parser"
706
+ name: "kirklin/markdown/parser"
672
707
  },
673
708
  {
674
709
  files: [
@@ -682,7 +717,7 @@ async function markdown(options = {}) {
682
717
  }
683
718
  }
684
719
  },
685
- name: "kirklin:markdown:disables",
720
+ name: "kirklin/markdown/disables",
686
721
  rules: {
687
722
  "import/newline-after-import": "off",
688
723
  "no-alert": "off",
@@ -736,7 +771,7 @@ async function markdown(options = {}) {
736
771
  async function node() {
737
772
  return [
738
773
  {
739
- name: "kirklin:node",
774
+ name: "kirklin/node/rules",
740
775
  plugins: {
741
776
  node: import_eslint_plugin_n.default
742
777
  },
@@ -758,7 +793,7 @@ async function node() {
758
793
  async function perfectionist() {
759
794
  return [
760
795
  {
761
- name: "kirklin:perfectionist",
796
+ name: "kirklin/perfectionist/setup",
762
797
  plugins: {
763
798
  perfectionist: import_eslint_plugin_perfectionist.default
764
799
  }
@@ -780,6 +815,7 @@ async function stylistic(options = {}) {
780
815
  const {
781
816
  indent,
782
817
  jsx,
818
+ lessOpinionated = false,
783
819
  overrides = {},
784
820
  quotes,
785
821
  semi
@@ -798,19 +834,23 @@ async function stylistic(options = {}) {
798
834
  });
799
835
  return [
800
836
  {
801
- name: "kirklin:stylistic",
837
+ name: "kirklin/stylistic/rules",
802
838
  plugins: {
803
839
  kirklin: import_eslint_plugin_kirklin.default,
804
840
  style: pluginStylistic
805
841
  },
806
842
  rules: {
807
843
  ...config.rules,
808
- "curly": ["error", "all"],
809
844
  "kirklin/consistent-list-newline": "error",
810
- "kirklin/if-newline": "error",
811
- "kirklin/top-level-function": "error",
812
845
  "style/brace-style": ["error", "1tbs", { allowSingleLine: false }],
813
846
  "style/member-delimiter-style": ["error", { multiline: { delimiter: "semi" } }],
847
+ ...lessOpinionated ? {
848
+ curly: ["error", "multi-or-nest", "consistent"]
849
+ } : {
850
+ "curly": ["error", "all"],
851
+ "kirklin/if-newline": "error",
852
+ "kirklin/top-level-function": "error"
853
+ },
814
854
  ...overrides
815
855
  }
816
856
  }
@@ -867,7 +907,7 @@ async function formatters(options = {}, stylistic2 = {}) {
867
907
  const pluginFormat = await interopDefault(import("eslint-plugin-format"));
868
908
  const configs = [
869
909
  {
870
- name: "kirklin:formatters:setup",
910
+ name: "kirklin/formatter/setup",
871
911
  plugins: {
872
912
  format: pluginFormat
873
913
  }
@@ -880,7 +920,7 @@ async function formatters(options = {}, stylistic2 = {}) {
880
920
  languageOptions: {
881
921
  parser: parserPlain
882
922
  },
883
- name: "kirklin:formatter:css",
923
+ name: "kirklin/formatter/css",
884
924
  rules: {
885
925
  "format/prettier": [
886
926
  "error",
@@ -896,7 +936,7 @@ async function formatters(options = {}, stylistic2 = {}) {
896
936
  languageOptions: {
897
937
  parser: parserPlain
898
938
  },
899
- name: "kirklin:formatter:scss",
939
+ name: "kirklin/formatter/scss",
900
940
  rules: {
901
941
  "format/prettier": [
902
942
  "error",
@@ -912,7 +952,7 @@ async function formatters(options = {}, stylistic2 = {}) {
912
952
  languageOptions: {
913
953
  parser: parserPlain
914
954
  },
915
- name: "kirklin:formatter:less",
955
+ name: "kirklin/formatter/less",
916
956
  rules: {
917
957
  "format/prettier": [
918
958
  "error",
@@ -927,11 +967,11 @@ async function formatters(options = {}, stylistic2 = {}) {
927
967
  }
928
968
  if (options.html) {
929
969
  configs.push({
930
- files: ["**/*.html"],
970
+ files: [GLOB_HTML],
931
971
  languageOptions: {
932
972
  parser: parserPlain
933
973
  },
934
- name: "kirklin:formatter:html",
974
+ name: "kirklin/formatter/html",
935
975
  rules: {
936
976
  "format/prettier": [
937
977
  "error",
@@ -952,7 +992,7 @@ async function formatters(options = {}, stylistic2 = {}) {
952
992
  languageOptions: {
953
993
  parser: parserPlain
954
994
  },
955
- name: "kirklin:formatter:markdown",
995
+ name: "kirklin/formatter/markdown",
956
996
  rules: {
957
997
  [`format/${formater}`]: [
958
998
  "error",
@@ -974,7 +1014,7 @@ async function formatters(options = {}, stylistic2 = {}) {
974
1014
  languageOptions: {
975
1015
  parser: parserPlain
976
1016
  },
977
- name: "kirklin:formatter:slidev",
1017
+ name: "kirklin/formatter/slidev",
978
1018
  rules: {
979
1019
  "format/prettier": [
980
1020
  "error",
@@ -998,7 +1038,7 @@ async function formatters(options = {}, stylistic2 = {}) {
998
1038
  languageOptions: {
999
1039
  parser: parserPlain
1000
1040
  },
1001
- name: "kirklin:formatter:astro",
1041
+ name: "kirklin/formatter/astro",
1002
1042
  rules: {
1003
1043
  "format/prettier": [
1004
1044
  "error",
@@ -1015,11 +1055,11 @@ async function formatters(options = {}, stylistic2 = {}) {
1015
1055
  }
1016
1056
  if (options.graphql) {
1017
1057
  configs.push({
1018
- files: ["**/*.graphql"],
1058
+ files: [GLOB_GRAPHQL],
1019
1059
  languageOptions: {
1020
1060
  parser: parserPlain
1021
1061
  },
1022
- name: "kirklin:formatter:graphql",
1062
+ name: "kirklin/formatter/graphql",
1023
1063
  rules: {
1024
1064
  "format/prettier": [
1025
1065
  "error",
@@ -1064,7 +1104,7 @@ async function react(options = {}) {
1064
1104
  );
1065
1105
  return [
1066
1106
  {
1067
- name: "kirklin:react:setup",
1107
+ name: "kirklin/react/setup",
1068
1108
  plugins: {
1069
1109
  "react": pluginReact,
1070
1110
  "react-hooks": pluginReactHooks,
@@ -1085,7 +1125,7 @@ async function react(options = {}) {
1085
1125
  }
1086
1126
  }
1087
1127
  },
1088
- name: "kirklin:react:rules",
1128
+ name: "kirklin/react/rules",
1089
1129
  rules: {
1090
1130
  // recommended rules react-hooks
1091
1131
  "react-hooks/exhaustive-deps": "warn",
@@ -1134,7 +1174,7 @@ async function sortPackageJson() {
1134
1174
  return [
1135
1175
  {
1136
1176
  files: ["**/package.json"],
1137
- name: "kirklin:sort-package-json",
1177
+ name: "kirklin/sort/package-json",
1138
1178
  rules: {
1139
1179
  "jsonc/sort-array-values": [
1140
1180
  "error",
@@ -1209,6 +1249,22 @@ async function sortPackageJson() {
1209
1249
  "default"
1210
1250
  ],
1211
1251
  pathPattern: "^exports.*$"
1252
+ },
1253
+ {
1254
+ order: [
1255
+ // client hooks only
1256
+ "pre-commit",
1257
+ "prepare-commit-msg",
1258
+ "commit-msg",
1259
+ "post-commit",
1260
+ "pre-rebase",
1261
+ "post-rewrite",
1262
+ "post-checkout",
1263
+ "post-merge",
1264
+ "pre-push",
1265
+ "pre-auto-gc"
1266
+ ],
1267
+ pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
1212
1268
  }
1213
1269
  ]
1214
1270
  }
@@ -1219,7 +1275,7 @@ function sortTsconfig() {
1219
1275
  return [
1220
1276
  {
1221
1277
  files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1222
- name: "kirklin:sort-tsconfig",
1278
+ name: "kirklin/sort/tsconfig-json",
1223
1279
  rules: {
1224
1280
  "jsonc/sort-keys": [
1225
1281
  "error",
@@ -1350,7 +1406,7 @@ async function svelte(options = {}) {
1350
1406
  } = options;
1351
1407
  const {
1352
1408
  indent = 2,
1353
- quotes = "single"
1409
+ quotes = "double"
1354
1410
  } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1355
1411
  await ensurePackages([
1356
1412
  "eslint-plugin-svelte"
@@ -1364,7 +1420,7 @@ async function svelte(options = {}) {
1364
1420
  ]);
1365
1421
  return [
1366
1422
  {
1367
- name: "kirklin:svelte:setup",
1423
+ name: "kirklin/svelte/setup",
1368
1424
  plugins: {
1369
1425
  svelte: pluginSvelte
1370
1426
  }
@@ -1378,7 +1434,7 @@ async function svelte(options = {}) {
1378
1434
  parser: options.typescript ? await interopDefault(import("@typescript-eslint/parser")) : null
1379
1435
  }
1380
1436
  },
1381
- name: "kirklin:svelte:rules",
1437
+ name: "kirklin/svelte/rules",
1382
1438
  processor: pluginSvelte.processors[".svelte"],
1383
1439
  rules: {
1384
1440
  "import/no-mutable-exports": "off",
@@ -1389,7 +1445,7 @@ async function svelte(options = {}) {
1389
1445
  caughtErrors: "none",
1390
1446
  ignoreRestSiblings: true,
1391
1447
  vars: "all",
1392
- varsIgnorePattern: "^\\$\\$Props$"
1448
+ varsIgnorePattern: "^(\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
1393
1449
  }],
1394
1450
  "svelte/comment-directive": "error",
1395
1451
  "svelte/no-at-debug-tags": "warn",
@@ -1414,7 +1470,7 @@ async function svelte(options = {}) {
1414
1470
  "svelte/valid-each-key": "error",
1415
1471
  "unused-imports/no-unused-vars": [
1416
1472
  "error",
1417
- { args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^(_|\\$\\$Props$)" }
1473
+ { args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^(_|\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)" }
1418
1474
  ],
1419
1475
  ...stylistic2 ? {
1420
1476
  "style/indent": "off",
@@ -1437,6 +1493,7 @@ async function svelte(options = {}) {
1437
1493
  }
1438
1494
 
1439
1495
  // src/configs/test.ts
1496
+ var _pluginTest;
1440
1497
  async function test(options = {}) {
1441
1498
  const {
1442
1499
  files = GLOB_TESTS,
@@ -1451,23 +1508,24 @@ async function test(options = {}) {
1451
1508
  // @ts-expect-error missing types
1452
1509
  interopDefault(import("eslint-plugin-no-only-tests"))
1453
1510
  ]);
1511
+ _pluginTest = _pluginTest || {
1512
+ ...pluginVitest,
1513
+ rules: {
1514
+ ...pluginVitest.rules,
1515
+ // extend `test/no-only-tests` rule
1516
+ ...pluginNoOnlyTests.rules
1517
+ }
1518
+ };
1454
1519
  return [
1455
1520
  {
1456
- name: "kirklin:test:setup",
1521
+ name: "kirklin/test/setup",
1457
1522
  plugins: {
1458
- test: {
1459
- ...pluginVitest,
1460
- rules: {
1461
- ...pluginVitest.rules,
1462
- // extend `test/no-only-tests` rule
1463
- ...pluginNoOnlyTests.rules
1464
- }
1465
- }
1523
+ test: _pluginTest
1466
1524
  }
1467
1525
  },
1468
1526
  {
1469
1527
  files,
1470
- name: "kirklin:test:rules",
1528
+ name: "kirklin/test/rules",
1471
1529
  rules: {
1472
1530
  "node/prefer-global/process": "off",
1473
1531
  "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
@@ -1541,13 +1599,13 @@ async function typescript(options = {}) {
1541
1599
  ...parserOptions
1542
1600
  }
1543
1601
  },
1544
- name: `kirklin:typescript:${typeAware ? "type-aware-parser" : "parser"}`
1602
+ name: `kirklin/typescript/${typeAware ? "type-aware-parser" : "parser"}`
1545
1603
  };
1546
1604
  }
1547
1605
  return [
1548
1606
  {
1549
1607
  // Install the plugins without globs, so they can be configured separately.
1550
- name: "kirklin:typescript:setup",
1608
+ name: "kirklin/typescript/setup",
1551
1609
  plugins: {
1552
1610
  kirklin: import_eslint_plugin_kirklin.default,
1553
1611
  ts: pluginTs
@@ -1560,17 +1618,15 @@ async function typescript(options = {}) {
1560
1618
  ] : [makeParser(false, files)],
1561
1619
  {
1562
1620
  files,
1563
- name: "kirklin:typescript:rules",
1621
+ name: "kirklin/typescript/rules",
1564
1622
  rules: {
1565
1623
  ...renameRules(
1566
1624
  pluginTs.configs["eslint-recommended"].overrides[0].rules,
1567
- "@typescript-eslint/",
1568
- "ts/"
1625
+ { "@typescript-eslint": "ts" }
1569
1626
  ),
1570
1627
  ...renameRules(
1571
1628
  pluginTs.configs.strict.rules,
1572
- "@typescript-eslint/",
1573
- "ts/"
1629
+ { "@typescript-eslint": "ts" }
1574
1630
  ),
1575
1631
  "no-dupe-class-members": "off",
1576
1632
  "no-loss-of-precision": "off",
@@ -1602,17 +1658,17 @@ async function typescript(options = {}) {
1602
1658
  ...overrides
1603
1659
  }
1604
1660
  },
1605
- {
1661
+ ...isTypeAware ? [{
1606
1662
  files: filesTypeAware,
1607
- name: "kirklin:typescript:rules-type-aware",
1663
+ name: "kirklin/typescript/rules-type-aware",
1608
1664
  rules: {
1609
1665
  ...tsconfigPath ? typeAwareRules : {},
1610
1666
  ...overrides
1611
1667
  }
1612
- },
1668
+ }] : [],
1613
1669
  {
1614
1670
  files: ["**/*.d.ts"],
1615
- name: "kirklin:typescript:dts-overrides",
1671
+ name: "kirklin/typescript/disables/dts",
1616
1672
  rules: {
1617
1673
  "eslint-comments/no-unlimited-disable": "off",
1618
1674
  "import/no-duplicates": "off",
@@ -1622,14 +1678,14 @@ async function typescript(options = {}) {
1622
1678
  },
1623
1679
  {
1624
1680
  files: ["**/*.{test,spec}.ts?(x)"],
1625
- name: "kirklin:typescript:tests-overrides",
1681
+ name: "kirklin/typescript/disables/test",
1626
1682
  rules: {
1627
1683
  "no-unused-expressions": "off"
1628
1684
  }
1629
1685
  },
1630
1686
  {
1631
1687
  files: ["**/*.js", "**/*.cjs"],
1632
- name: "kirklin:typescript:javascript-overrides",
1688
+ name: "kirklin/typescript/disables/cjs",
1633
1689
  rules: {
1634
1690
  "ts/no-require-imports": "off",
1635
1691
  "ts/no-var-requires": "off"
@@ -1642,7 +1698,7 @@ async function typescript(options = {}) {
1642
1698
  async function unicorn() {
1643
1699
  return [
1644
1700
  {
1645
- name: "kirklin:unicorn",
1701
+ name: "kirklin/unicorn/rules",
1646
1702
  plugins: {
1647
1703
  unicorn: import_eslint_plugin_unicorn.default
1648
1704
  },
@@ -1694,7 +1750,7 @@ async function unocss(options = {}) {
1694
1750
  ]);
1695
1751
  return [
1696
1752
  {
1697
- name: "kirklin:unocss",
1753
+ name: "kirklin/unocss",
1698
1754
  plugins: {
1699
1755
  unocss: pluginUnoCSS
1700
1756
  },
@@ -1756,7 +1812,7 @@ async function vue(options = {}) {
1756
1812
  watchEffect: "readonly"
1757
1813
  }
1758
1814
  },
1759
- name: "kirklin:vue:setup",
1815
+ name: "kirklin/vue/setup",
1760
1816
  plugins: {
1761
1817
  vue: pluginVue
1762
1818
  }
@@ -1774,7 +1830,7 @@ async function vue(options = {}) {
1774
1830
  sourceType: "module"
1775
1831
  }
1776
1832
  },
1777
- name: "kirklin:vue:rules",
1833
+ name: "kirklin/vue/rules",
1778
1834
  processor: sfcBlocks === false ? pluginVue.processors[".vue"] : (0, import_eslint_merge_processors2.mergeProcessors)([
1779
1835
  pluginVue.processors[".vue"],
1780
1836
  processorVueBlocks({
@@ -1903,7 +1959,7 @@ async function yaml(options = {}) {
1903
1959
  ]);
1904
1960
  return [
1905
1961
  {
1906
- name: "kirklin:yaml:setup",
1962
+ name: "kirklin/yaml/setup",
1907
1963
  plugins: {
1908
1964
  yaml: pluginYaml
1909
1965
  }
@@ -1913,7 +1969,7 @@ async function yaml(options = {}) {
1913
1969
  languageOptions: {
1914
1970
  parser: parserYaml
1915
1971
  },
1916
- name: "kirklin:yaml:rules",
1972
+ name: "kirklin/yaml/rules",
1917
1973
  rules: {
1918
1974
  "style/spaced-comment": "off",
1919
1975
  "yaml/block-mapping": "error",
@@ -1961,7 +2017,7 @@ async function toml(options = {}) {
1961
2017
  ]);
1962
2018
  return [
1963
2019
  {
1964
- name: "kirklin:toml:setup",
2020
+ name: "kirklin/toml/setup",
1965
2021
  plugins: {
1966
2022
  toml: pluginToml
1967
2023
  }
@@ -1971,7 +2027,7 @@ async function toml(options = {}) {
1971
2027
  languageOptions: {
1972
2028
  parser: parserToml
1973
2029
  },
1974
- name: "kirklin:toml:rules",
2030
+ name: "kirklin/toml/rules",
1975
2031
  rules: {
1976
2032
  "style/spaced-comment": "off",
1977
2033
  "toml/comma-style": "error",
@@ -2019,7 +2075,7 @@ async function astro(options = {}) {
2019
2075
  ]);
2020
2076
  return [
2021
2077
  {
2022
- name: "kirklin:astro:setup",
2078
+ name: "kirklin/astro/setup",
2023
2079
  plugins: {
2024
2080
  astro: pluginAstro
2025
2081
  }
@@ -2033,7 +2089,7 @@ async function astro(options = {}) {
2033
2089
  parser: parserTs
2034
2090
  }
2035
2091
  },
2036
- name: "kirklin:astro:rules",
2092
+ name: "kirklin/astro/rules",
2037
2093
  rules: {
2038
2094
  "astro/no-set-html-directive": "off",
2039
2095
  ...stylistic2 ? {
@@ -2049,6 +2105,82 @@ async function astro(options = {}) {
2049
2105
  ];
2050
2106
  }
2051
2107
 
2108
+ // src/configs/solid.ts
2109
+ async function solid(options = {}) {
2110
+ const {
2111
+ files = [GLOB_JSX, GLOB_TSX],
2112
+ overrides = {},
2113
+ typescript: typescript2 = true
2114
+ } = options;
2115
+ await ensurePackages([
2116
+ "eslint-plugin-solid"
2117
+ ]);
2118
+ const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
2119
+ const isTypeAware = !!tsconfigPath;
2120
+ const [
2121
+ pluginSolid,
2122
+ parserTs
2123
+ ] = await Promise.all([
2124
+ interopDefault(import("eslint-plugin-solid")),
2125
+ interopDefault(import("@typescript-eslint/parser"))
2126
+ ]);
2127
+ return [
2128
+ {
2129
+ name: "kirklin/solid/setup",
2130
+ plugins: {
2131
+ solid: pluginSolid
2132
+ }
2133
+ },
2134
+ {
2135
+ files,
2136
+ languageOptions: {
2137
+ parser: parserTs,
2138
+ parserOptions: {
2139
+ ecmaFeatures: {
2140
+ jsx: true
2141
+ },
2142
+ ...isTypeAware ? { project: tsconfigPath } : {}
2143
+ },
2144
+ sourceType: "module"
2145
+ },
2146
+ name: "kirklin/solid/rules",
2147
+ rules: {
2148
+ // reactivity
2149
+ "solid/components-return-once": "warn",
2150
+ "solid/event-handlers": ["error", {
2151
+ // if true, don't warn on ambiguously named event handlers like `onclick` or `onchange`
2152
+ ignoreCase: false,
2153
+ // if true, warn when spreading event handlers onto JSX. Enable for Solid < v1.6.
2154
+ warnOnSpread: false
2155
+ }],
2156
+ // these rules are mostly style suggestions
2157
+ "solid/imports": "error",
2158
+ // identifier usage is important
2159
+ "solid/jsx-no-duplicate-props": "error",
2160
+ "solid/jsx-no-script-url": "error",
2161
+ "solid/jsx-no-undef": "error",
2162
+ "solid/jsx-uses-vars": "error",
2163
+ "solid/no-destructure": "error",
2164
+ // security problems
2165
+ "solid/no-innerhtml": ["error", { allowStatic: true }],
2166
+ "solid/no-react-deps": "error",
2167
+ "solid/no-react-specific-props": "error",
2168
+ "solid/no-unknown-namespaces": "error",
2169
+ "solid/prefer-for": "error",
2170
+ "solid/reactivity": "warn",
2171
+ "solid/self-closing-comp": "error",
2172
+ "solid/style-prop": ["error", { styleProps: ["style", "css"] }],
2173
+ ...typescript2 ? {
2174
+ "solid/jsx-no-undef": ["error", { typescriptEnabled: true }],
2175
+ "solid/no-unknown-namespaces": "off"
2176
+ } : {},
2177
+ // overrides
2178
+ ...overrides
2179
+ }
2180
+ }
2181
+ ];
2182
+ }
2183
+
2052
2184
  // src/factory.ts
2053
2185
  var flatConfigProps = [
2054
2186
  "name",
@@ -2067,13 +2199,23 @@ var VuePackages = [
2067
2199
  "vitepress",
2068
2200
  "@slidev/cli"
2069
2201
  ];
2070
- async function kirklin(options = {}, ...userConfigs) {
2202
+ var defaultPluginRenaming = {
2203
+ "@stylistic": "style",
2204
+ "@typescript-eslint": "ts",
2205
+ "import-x": "import",
2206
+ "n": "node",
2207
+ "vitest": "test",
2208
+ "yml": "yaml"
2209
+ };
2210
+ function kirklin(options = {}, ...userConfigs) {
2071
2211
  const {
2072
2212
  astro: enableAstro = false,
2213
+ autoRenamePlugins = true,
2073
2214
  componentExts = [],
2074
2215
  gitignore: enableGitignore = true,
2075
2216
  isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.VSCODE_CWD || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM) && !import_node_process3.default.env.CI),
2076
2217
  react: enableReact = false,
2218
+ solid: enableSolid = false,
2077
2219
  svelte: enableSvelte = false,
2078
2220
  typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
2079
2221
  unocss: enableUnoCSS = false,
@@ -2124,6 +2266,7 @@ async function kirklin(options = {}, ...userConfigs) {
2124
2266
  if (stylisticOptions) {
2125
2267
  configs.push(stylistic({
2126
2268
  ...stylisticOptions,
2269
+ lessOpinionated: options.lessOpinionated,
2127
2270
  overrides: getOverrides(options, "stylistic")
2128
2271
  }));
2129
2272
  }
@@ -2147,6 +2290,13 @@ async function kirklin(options = {}, ...userConfigs) {
2147
2290
  typescript: !!enableTypeScript
2148
2291
  }));
2149
2292
  }
2293
+ if (enableSolid) {
2294
+ configs.push(solid({
2295
+ overrides: getOverrides(options, "solid"),
2296
+ tsconfigPath: getOverrides(options, "typescript").tsconfigPath,
2297
+ typescript: !!enableTypeScript
2298
+ }));
2299
+ }
2150
2300
  if (enableSvelte) {
2151
2301
  configs.push(svelte({
2152
2302
  overrides: getOverrides(options, "svelte"),
@@ -2213,11 +2363,15 @@ async function kirklin(options = {}, ...userConfigs) {
2213
2363
  if (Object.keys(fusedConfig).length) {
2214
2364
  configs.push([fusedConfig]);
2215
2365
  }
2216
- const merged = combine(
2366
+ let composer = new import_eslint_flat_config_utils.FlatConfigComposer();
2367
+ composer = composer.append(
2217
2368
  ...configs,
2218
2369
  ...userConfigs
2219
2370
  );
2220
- return merged;
2371
+ if (autoRenamePlugins) {
2372
+ composer = composer.renamePlugins(defaultPluginRenaming);
2373
+ }
2374
+ return composer;
2221
2375
  }
2222
2376
  function resolveSubOptions(options, key) {
2223
2377
  return typeof options[key] === "boolean" ? {} : options[key] || {};
@@ -2238,6 +2392,7 @@ var src_default = kirklin;
2238
2392
  GLOB_ASTRO,
2239
2393
  GLOB_CSS,
2240
2394
  GLOB_EXCLUDE,
2395
+ GLOB_GRAPHQL,
2241
2396
  GLOB_HTML,
2242
2397
  GLOB_JS,
2243
2398
  GLOB_JSON,
@@ -2264,6 +2419,7 @@ var src_default = kirklin;
2264
2419
  astro,
2265
2420
  combine,
2266
2421
  comments,
2422
+ defaultPluginRenaming,
2267
2423
  ensurePackages,
2268
2424
  formatters,
2269
2425
  getOverrides,
@@ -2279,8 +2435,10 @@ var src_default = kirklin;
2279
2435
  parserPlain,
2280
2436
  perfectionist,
2281
2437
  react,
2438
+ renamePluginInConfigs,
2282
2439
  renameRules,
2283
2440
  resolveSubOptions,
2441
+ solid,
2284
2442
  sortPackageJson,
2285
2443
  sortTsconfig,
2286
2444
  stylistic,