@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.js CHANGED
@@ -1,12 +1,13 @@
1
1
  // src/factory.ts
2
- import process3 from "process";
3
- import fs from "fs";
2
+ import process3 from "node:process";
3
+ import fs from "node:fs";
4
4
  import { isPackageExists as isPackageExists4 } from "local-pkg";
5
+ import { FlatConfigComposer } from "eslint-flat-config-utils";
5
6
 
6
7
  // src/plugins.ts
7
8
  import { default as default2 } from "eslint-plugin-kirklin";
8
9
  import { default as default3 } from "eslint-plugin-eslint-comments";
9
- import * as pluginImport from "eslint-plugin-i";
10
+ import * as pluginImport from "eslint-plugin-import-x";
10
11
  import { default as default4 } from "eslint-plugin-n";
11
12
  import { default as default5 } from "eslint-plugin-unicorn";
12
13
  import { default as default6 } from "eslint-plugin-unused-imports";
@@ -16,7 +17,7 @@ import { default as default7 } from "eslint-plugin-perfectionist";
16
17
  async function comments() {
17
18
  return [
18
19
  {
19
- name: "kirklin:eslint-comments",
20
+ name: "kirklin/eslint-comments/rules",
20
21
  plugins: {
21
22
  "eslint-comments": default3
22
23
  },
@@ -53,6 +54,7 @@ var GLOB_YAML = "**/*.y?(a)ml";
53
54
  var GLOB_TOML = "**/*.toml";
54
55
  var GLOB_HTML = "**/*.htm?(l)";
55
56
  var GLOB_ASTRO = "**/*.astro";
57
+ var GLOB_GRAPHQL = "**/*.{g,graph}ql";
56
58
  var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
57
59
  var GLOB_TESTS = [
58
60
  `**/__tests__/**/*.${GLOB_SRC_EXT}`,
@@ -109,6 +111,8 @@ async function ignores() {
109
111
  return [
110
112
  {
111
113
  ignores: GLOB_EXCLUDE
114
+ // Awaits https://github.com/humanwhocodes/config-array/pull/131
115
+ // name: 'kirklin/ignores',
112
116
  }
113
117
  ];
114
118
  }
@@ -120,7 +124,7 @@ async function imports(options = {}) {
120
124
  } = options;
121
125
  return [
122
126
  {
123
- name: "kirklin:imports",
127
+ name: "kirklin/imports/rules",
124
128
  plugins: {
125
129
  import: pluginImport,
126
130
  kirklin: default2
@@ -143,7 +147,7 @@ async function imports(options = {}) {
143
147
  },
144
148
  {
145
149
  files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
146
- name: "kirklin:imports:bin",
150
+ name: "kirklin/imports/disables/bin",
147
151
  rules: {
148
152
  "kirklin/no-import-dist": "off",
149
153
  "kirklin/no-import-node-modules-by-path": "off"
@@ -183,7 +187,7 @@ async function javascript(options = {}) {
183
187
  linterOptions: {
184
188
  reportUnusedDisableDirectives: true
185
189
  },
186
- name: "kirklin:javascript",
190
+ name: "kirklin/javascript/rules",
187
191
  plugins: {
188
192
  "kirklin": default2,
189
193
  "unused-imports": default6
@@ -237,7 +241,7 @@ async function javascript(options = {}) {
237
241
  "no-multi-str": "error",
238
242
  "no-new": "error",
239
243
  "no-new-func": "error",
240
- "no-new-symbol": "error",
244
+ "no-new-native-nonconstructor": "error",
241
245
  "no-new-wrappers": "error",
242
246
  "no-obj-calls": "error",
243
247
  "no-octal": "error",
@@ -349,7 +353,13 @@ async function javascript(options = {}) {
349
353
  "unused-imports/no-unused-imports": isInEditor ? "off" : "error",
350
354
  "unused-imports/no-unused-vars": [
351
355
  "error",
352
- { args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^_" }
356
+ {
357
+ args: "after-used",
358
+ argsIgnorePattern: "^_",
359
+ ignoreRestSiblings: true,
360
+ vars: "all",
361
+ varsIgnorePattern: "^_"
362
+ }
353
363
  ],
354
364
  "use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
355
365
  "valid-typeof": ["error", { requireStringLiterals: true }],
@@ -360,7 +370,7 @@ async function javascript(options = {}) {
360
370
  },
361
371
  {
362
372
  files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
363
- name: "kirklin:scripts-overrides",
373
+ name: "kirklin/javascript/disables/cli",
364
374
  rules: {
365
375
  "no-console": "off"
366
376
  }
@@ -369,7 +379,7 @@ async function javascript(options = {}) {
369
379
  }
370
380
 
371
381
  // src/utils.ts
372
- import process from "process";
382
+ import process from "node:process";
373
383
  import { isPackageExists } from "local-pkg";
374
384
  var parserPlain = {
375
385
  meta: {
@@ -395,16 +405,37 @@ async function combine(...configs) {
395
405
  const resolved = await Promise.all(configs);
396
406
  return resolved.flat();
397
407
  }
398
- function renameRules(rules, from, to) {
408
+ function renameRules(rules, map) {
399
409
  return Object.fromEntries(
400
410
  Object.entries(rules).map(([key, value]) => {
401
- if (key.startsWith(from)) {
402
- return [to + key.slice(from.length), value];
411
+ for (const [from, to] of Object.entries(map)) {
412
+ if (key.startsWith(`${from}/`)) {
413
+ return [to + key.slice(from.length), value];
414
+ }
403
415
  }
404
416
  return [key, value];
405
417
  })
406
418
  );
407
419
  }
420
+ function renamePluginInConfigs(configs, map) {
421
+ return configs.map((i) => {
422
+ const clone = { ...i };
423
+ if (clone.rules) {
424
+ clone.rules = renameRules(clone.rules, map);
425
+ }
426
+ if (clone.plugins) {
427
+ clone.plugins = Object.fromEntries(
428
+ Object.entries(clone.plugins).map(([key, value]) => {
429
+ if (key in map) {
430
+ return [map[key], value];
431
+ }
432
+ return [key, value];
433
+ })
434
+ );
435
+ }
436
+ return clone;
437
+ });
438
+ }
408
439
  function toArray(value) {
409
440
  return Array.isArray(value) ? value : [value];
410
441
  }
@@ -436,7 +467,7 @@ async function jsdoc(options = {}) {
436
467
  } = options;
437
468
  return [
438
469
  {
439
- name: "kirklin:jsdoc",
470
+ name: "kirklin/jsdoc/rules",
440
471
  plugins: {
441
472
  jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
442
473
  },
@@ -484,7 +515,7 @@ async function jsonc(options = {}) {
484
515
  ]);
485
516
  return [
486
517
  {
487
- name: "kirklin:jsonc:setup",
518
+ name: "kirklin/jsonc/setup",
488
519
  plugins: {
489
520
  jsonc: pluginJsonc
490
521
  }
@@ -494,7 +525,7 @@ async function jsonc(options = {}) {
494
525
  languageOptions: {
495
526
  parser: parserJsonc
496
527
  },
497
- name: "kirklin:jsonc:rules",
528
+ name: "kirklin/jsonc/rules",
498
529
  rules: {
499
530
  "jsonc/no-bigint-literals": "error",
500
531
  "jsonc/no-binary-expression": "error",
@@ -551,7 +582,7 @@ async function markdown(options = {}) {
551
582
  const markdown2 = await interopDefault(import("eslint-plugin-markdown"));
552
583
  return [
553
584
  {
554
- name: "kirklin:markdown:setup",
585
+ name: "kirklin/markdown/setup",
555
586
  plugins: {
556
587
  markdown: markdown2
557
588
  }
@@ -559,7 +590,7 @@ async function markdown(options = {}) {
559
590
  {
560
591
  files,
561
592
  ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
562
- name: "kirklin:markdown:processor",
593
+ name: "kirklin/markdown/processor",
563
594
  // `eslint-plugin-markdown` only creates virtual files for code blocks,
564
595
  // but not the markdown file itself. We use `eslint-merge-processors` to
565
596
  // add a pass-through processor for the markdown file itself.
@@ -573,7 +604,7 @@ async function markdown(options = {}) {
573
604
  languageOptions: {
574
605
  parser: parserPlain
575
606
  },
576
- name: "kirklin:markdown:parser"
607
+ name: "kirklin/markdown/parser"
577
608
  },
578
609
  {
579
610
  files: [
@@ -587,7 +618,7 @@ async function markdown(options = {}) {
587
618
  }
588
619
  }
589
620
  },
590
- name: "kirklin:markdown:disables",
621
+ name: "kirklin/markdown/disables",
591
622
  rules: {
592
623
  "import/newline-after-import": "off",
593
624
  "no-alert": "off",
@@ -641,7 +672,7 @@ async function markdown(options = {}) {
641
672
  async function node() {
642
673
  return [
643
674
  {
644
- name: "kirklin:node",
675
+ name: "kirklin/node/rules",
645
676
  plugins: {
646
677
  node: default4
647
678
  },
@@ -663,7 +694,7 @@ async function node() {
663
694
  async function perfectionist() {
664
695
  return [
665
696
  {
666
- name: "kirklin:perfectionist",
697
+ name: "kirklin/perfectionist/setup",
667
698
  plugins: {
668
699
  perfectionist: default7
669
700
  }
@@ -685,6 +716,7 @@ async function stylistic(options = {}) {
685
716
  const {
686
717
  indent,
687
718
  jsx,
719
+ lessOpinionated = false,
688
720
  overrides = {},
689
721
  quotes,
690
722
  semi
@@ -703,19 +735,23 @@ async function stylistic(options = {}) {
703
735
  });
704
736
  return [
705
737
  {
706
- name: "kirklin:stylistic",
738
+ name: "kirklin/stylistic/rules",
707
739
  plugins: {
708
740
  kirklin: default2,
709
741
  style: pluginStylistic
710
742
  },
711
743
  rules: {
712
744
  ...config.rules,
713
- "curly": ["error", "all"],
714
745
  "kirklin/consistent-list-newline": "error",
715
- "kirklin/if-newline": "error",
716
- "kirklin/top-level-function": "error",
717
746
  "style/brace-style": ["error", "1tbs", { allowSingleLine: false }],
718
747
  "style/member-delimiter-style": ["error", { multiline: { delimiter: "semi" } }],
748
+ ...lessOpinionated ? {
749
+ curly: ["error", "multi-or-nest", "consistent"]
750
+ } : {
751
+ "curly": ["error", "all"],
752
+ "kirklin/if-newline": "error",
753
+ "kirklin/top-level-function": "error"
754
+ },
719
755
  ...overrides
720
756
  }
721
757
  }
@@ -772,7 +808,7 @@ async function formatters(options = {}, stylistic2 = {}) {
772
808
  const pluginFormat = await interopDefault(import("eslint-plugin-format"));
773
809
  const configs = [
774
810
  {
775
- name: "kirklin:formatters:setup",
811
+ name: "kirklin/formatter/setup",
776
812
  plugins: {
777
813
  format: pluginFormat
778
814
  }
@@ -785,7 +821,7 @@ async function formatters(options = {}, stylistic2 = {}) {
785
821
  languageOptions: {
786
822
  parser: parserPlain
787
823
  },
788
- name: "kirklin:formatter:css",
824
+ name: "kirklin/formatter/css",
789
825
  rules: {
790
826
  "format/prettier": [
791
827
  "error",
@@ -801,7 +837,7 @@ async function formatters(options = {}, stylistic2 = {}) {
801
837
  languageOptions: {
802
838
  parser: parserPlain
803
839
  },
804
- name: "kirklin:formatter:scss",
840
+ name: "kirklin/formatter/scss",
805
841
  rules: {
806
842
  "format/prettier": [
807
843
  "error",
@@ -817,7 +853,7 @@ async function formatters(options = {}, stylistic2 = {}) {
817
853
  languageOptions: {
818
854
  parser: parserPlain
819
855
  },
820
- name: "kirklin:formatter:less",
856
+ name: "kirklin/formatter/less",
821
857
  rules: {
822
858
  "format/prettier": [
823
859
  "error",
@@ -832,11 +868,11 @@ async function formatters(options = {}, stylistic2 = {}) {
832
868
  }
833
869
  if (options.html) {
834
870
  configs.push({
835
- files: ["**/*.html"],
871
+ files: [GLOB_HTML],
836
872
  languageOptions: {
837
873
  parser: parserPlain
838
874
  },
839
- name: "kirklin:formatter:html",
875
+ name: "kirklin/formatter/html",
840
876
  rules: {
841
877
  "format/prettier": [
842
878
  "error",
@@ -857,7 +893,7 @@ async function formatters(options = {}, stylistic2 = {}) {
857
893
  languageOptions: {
858
894
  parser: parserPlain
859
895
  },
860
- name: "kirklin:formatter:markdown",
896
+ name: "kirklin/formatter/markdown",
861
897
  rules: {
862
898
  [`format/${formater}`]: [
863
899
  "error",
@@ -879,7 +915,7 @@ async function formatters(options = {}, stylistic2 = {}) {
879
915
  languageOptions: {
880
916
  parser: parserPlain
881
917
  },
882
- name: "kirklin:formatter:slidev",
918
+ name: "kirklin/formatter/slidev",
883
919
  rules: {
884
920
  "format/prettier": [
885
921
  "error",
@@ -903,7 +939,7 @@ async function formatters(options = {}, stylistic2 = {}) {
903
939
  languageOptions: {
904
940
  parser: parserPlain
905
941
  },
906
- name: "kirklin:formatter:astro",
942
+ name: "kirklin/formatter/astro",
907
943
  rules: {
908
944
  "format/prettier": [
909
945
  "error",
@@ -920,11 +956,11 @@ async function formatters(options = {}, stylistic2 = {}) {
920
956
  }
921
957
  if (options.graphql) {
922
958
  configs.push({
923
- files: ["**/*.graphql"],
959
+ files: [GLOB_GRAPHQL],
924
960
  languageOptions: {
925
961
  parser: parserPlain
926
962
  },
927
- name: "kirklin:formatter:graphql",
963
+ name: "kirklin/formatter/graphql",
928
964
  rules: {
929
965
  "format/prettier": [
930
966
  "error",
@@ -969,7 +1005,7 @@ async function react(options = {}) {
969
1005
  );
970
1006
  return [
971
1007
  {
972
- name: "kirklin:react:setup",
1008
+ name: "kirklin/react/setup",
973
1009
  plugins: {
974
1010
  "react": pluginReact,
975
1011
  "react-hooks": pluginReactHooks,
@@ -990,7 +1026,7 @@ async function react(options = {}) {
990
1026
  }
991
1027
  }
992
1028
  },
993
- name: "kirklin:react:rules",
1029
+ name: "kirklin/react/rules",
994
1030
  rules: {
995
1031
  // recommended rules react-hooks
996
1032
  "react-hooks/exhaustive-deps": "warn",
@@ -1039,7 +1075,7 @@ async function sortPackageJson() {
1039
1075
  return [
1040
1076
  {
1041
1077
  files: ["**/package.json"],
1042
- name: "kirklin:sort-package-json",
1078
+ name: "kirklin/sort/package-json",
1043
1079
  rules: {
1044
1080
  "jsonc/sort-array-values": [
1045
1081
  "error",
@@ -1114,6 +1150,22 @@ async function sortPackageJson() {
1114
1150
  "default"
1115
1151
  ],
1116
1152
  pathPattern: "^exports.*$"
1153
+ },
1154
+ {
1155
+ order: [
1156
+ // client hooks only
1157
+ "pre-commit",
1158
+ "prepare-commit-msg",
1159
+ "commit-msg",
1160
+ "post-commit",
1161
+ "pre-rebase",
1162
+ "post-rewrite",
1163
+ "post-checkout",
1164
+ "post-merge",
1165
+ "pre-push",
1166
+ "pre-auto-gc"
1167
+ ],
1168
+ pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
1117
1169
  }
1118
1170
  ]
1119
1171
  }
@@ -1124,7 +1176,7 @@ function sortTsconfig() {
1124
1176
  return [
1125
1177
  {
1126
1178
  files: ["**/tsconfig.json", "**/tsconfig.*.json"],
1127
- name: "kirklin:sort-tsconfig",
1179
+ name: "kirklin/sort/tsconfig-json",
1128
1180
  rules: {
1129
1181
  "jsonc/sort-keys": [
1130
1182
  "error",
@@ -1255,7 +1307,7 @@ async function svelte(options = {}) {
1255
1307
  } = options;
1256
1308
  const {
1257
1309
  indent = 2,
1258
- quotes = "single"
1310
+ quotes = "double"
1259
1311
  } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1260
1312
  await ensurePackages([
1261
1313
  "eslint-plugin-svelte"
@@ -1269,7 +1321,7 @@ async function svelte(options = {}) {
1269
1321
  ]);
1270
1322
  return [
1271
1323
  {
1272
- name: "kirklin:svelte:setup",
1324
+ name: "kirklin/svelte/setup",
1273
1325
  plugins: {
1274
1326
  svelte: pluginSvelte
1275
1327
  }
@@ -1283,7 +1335,7 @@ async function svelte(options = {}) {
1283
1335
  parser: options.typescript ? await interopDefault(import("@typescript-eslint/parser")) : null
1284
1336
  }
1285
1337
  },
1286
- name: "kirklin:svelte:rules",
1338
+ name: "kirklin/svelte/rules",
1287
1339
  processor: pluginSvelte.processors[".svelte"],
1288
1340
  rules: {
1289
1341
  "import/no-mutable-exports": "off",
@@ -1294,7 +1346,7 @@ async function svelte(options = {}) {
1294
1346
  caughtErrors: "none",
1295
1347
  ignoreRestSiblings: true,
1296
1348
  vars: "all",
1297
- varsIgnorePattern: "^\\$\\$Props$"
1349
+ varsIgnorePattern: "^(\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
1298
1350
  }],
1299
1351
  "svelte/comment-directive": "error",
1300
1352
  "svelte/no-at-debug-tags": "warn",
@@ -1319,7 +1371,7 @@ async function svelte(options = {}) {
1319
1371
  "svelte/valid-each-key": "error",
1320
1372
  "unused-imports/no-unused-vars": [
1321
1373
  "error",
1322
- { args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^(_|\\$\\$Props$)" }
1374
+ { args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^(_|\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)" }
1323
1375
  ],
1324
1376
  ...stylistic2 ? {
1325
1377
  "style/indent": "off",
@@ -1342,6 +1394,7 @@ async function svelte(options = {}) {
1342
1394
  }
1343
1395
 
1344
1396
  // src/configs/test.ts
1397
+ var _pluginTest;
1345
1398
  async function test(options = {}) {
1346
1399
  const {
1347
1400
  files = GLOB_TESTS,
@@ -1356,23 +1409,24 @@ async function test(options = {}) {
1356
1409
  // @ts-expect-error missing types
1357
1410
  interopDefault(import("eslint-plugin-no-only-tests"))
1358
1411
  ]);
1412
+ _pluginTest = _pluginTest || {
1413
+ ...pluginVitest,
1414
+ rules: {
1415
+ ...pluginVitest.rules,
1416
+ // extend `test/no-only-tests` rule
1417
+ ...pluginNoOnlyTests.rules
1418
+ }
1419
+ };
1359
1420
  return [
1360
1421
  {
1361
- name: "kirklin:test:setup",
1422
+ name: "kirklin/test/setup",
1362
1423
  plugins: {
1363
- test: {
1364
- ...pluginVitest,
1365
- rules: {
1366
- ...pluginVitest.rules,
1367
- // extend `test/no-only-tests` rule
1368
- ...pluginNoOnlyTests.rules
1369
- }
1370
- }
1424
+ test: _pluginTest
1371
1425
  }
1372
1426
  },
1373
1427
  {
1374
1428
  files,
1375
- name: "kirklin:test:rules",
1429
+ name: "kirklin/test/rules",
1376
1430
  rules: {
1377
1431
  "node/prefer-global/process": "off",
1378
1432
  "test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
@@ -1388,7 +1442,7 @@ async function test(options = {}) {
1388
1442
  }
1389
1443
 
1390
1444
  // src/configs/typescript.ts
1391
- import process2 from "process";
1445
+ import process2 from "node:process";
1392
1446
  async function typescript(options = {}) {
1393
1447
  const {
1394
1448
  componentExts = [],
@@ -1446,13 +1500,13 @@ async function typescript(options = {}) {
1446
1500
  ...parserOptions
1447
1501
  }
1448
1502
  },
1449
- name: `kirklin:typescript:${typeAware ? "type-aware-parser" : "parser"}`
1503
+ name: `kirklin/typescript/${typeAware ? "type-aware-parser" : "parser"}`
1450
1504
  };
1451
1505
  }
1452
1506
  return [
1453
1507
  {
1454
1508
  // Install the plugins without globs, so they can be configured separately.
1455
- name: "kirklin:typescript:setup",
1509
+ name: "kirklin/typescript/setup",
1456
1510
  plugins: {
1457
1511
  kirklin: default2,
1458
1512
  ts: pluginTs
@@ -1465,17 +1519,15 @@ async function typescript(options = {}) {
1465
1519
  ] : [makeParser(false, files)],
1466
1520
  {
1467
1521
  files,
1468
- name: "kirklin:typescript:rules",
1522
+ name: "kirklin/typescript/rules",
1469
1523
  rules: {
1470
1524
  ...renameRules(
1471
1525
  pluginTs.configs["eslint-recommended"].overrides[0].rules,
1472
- "@typescript-eslint/",
1473
- "ts/"
1526
+ { "@typescript-eslint": "ts" }
1474
1527
  ),
1475
1528
  ...renameRules(
1476
1529
  pluginTs.configs.strict.rules,
1477
- "@typescript-eslint/",
1478
- "ts/"
1530
+ { "@typescript-eslint": "ts" }
1479
1531
  ),
1480
1532
  "no-dupe-class-members": "off",
1481
1533
  "no-loss-of-precision": "off",
@@ -1507,17 +1559,17 @@ async function typescript(options = {}) {
1507
1559
  ...overrides
1508
1560
  }
1509
1561
  },
1510
- {
1562
+ ...isTypeAware ? [{
1511
1563
  files: filesTypeAware,
1512
- name: "kirklin:typescript:rules-type-aware",
1564
+ name: "kirklin/typescript/rules-type-aware",
1513
1565
  rules: {
1514
1566
  ...tsconfigPath ? typeAwareRules : {},
1515
1567
  ...overrides
1516
1568
  }
1517
- },
1569
+ }] : [],
1518
1570
  {
1519
1571
  files: ["**/*.d.ts"],
1520
- name: "kirklin:typescript:dts-overrides",
1572
+ name: "kirklin/typescript/disables/dts",
1521
1573
  rules: {
1522
1574
  "eslint-comments/no-unlimited-disable": "off",
1523
1575
  "import/no-duplicates": "off",
@@ -1527,14 +1579,14 @@ async function typescript(options = {}) {
1527
1579
  },
1528
1580
  {
1529
1581
  files: ["**/*.{test,spec}.ts?(x)"],
1530
- name: "kirklin:typescript:tests-overrides",
1582
+ name: "kirklin/typescript/disables/test",
1531
1583
  rules: {
1532
1584
  "no-unused-expressions": "off"
1533
1585
  }
1534
1586
  },
1535
1587
  {
1536
1588
  files: ["**/*.js", "**/*.cjs"],
1537
- name: "kirklin:typescript:javascript-overrides",
1589
+ name: "kirklin/typescript/disables/cjs",
1538
1590
  rules: {
1539
1591
  "ts/no-require-imports": "off",
1540
1592
  "ts/no-var-requires": "off"
@@ -1547,7 +1599,7 @@ async function typescript(options = {}) {
1547
1599
  async function unicorn() {
1548
1600
  return [
1549
1601
  {
1550
- name: "kirklin:unicorn",
1602
+ name: "kirklin/unicorn/rules",
1551
1603
  plugins: {
1552
1604
  unicorn: default5
1553
1605
  },
@@ -1599,7 +1651,7 @@ async function unocss(options = {}) {
1599
1651
  ]);
1600
1652
  return [
1601
1653
  {
1602
- name: "kirklin:unocss",
1654
+ name: "kirklin/unocss",
1603
1655
  plugins: {
1604
1656
  unocss: pluginUnoCSS
1605
1657
  },
@@ -1661,7 +1713,7 @@ async function vue(options = {}) {
1661
1713
  watchEffect: "readonly"
1662
1714
  }
1663
1715
  },
1664
- name: "kirklin:vue:setup",
1716
+ name: "kirklin/vue/setup",
1665
1717
  plugins: {
1666
1718
  vue: pluginVue
1667
1719
  }
@@ -1679,7 +1731,7 @@ async function vue(options = {}) {
1679
1731
  sourceType: "module"
1680
1732
  }
1681
1733
  },
1682
- name: "kirklin:vue:rules",
1734
+ name: "kirklin/vue/rules",
1683
1735
  processor: sfcBlocks === false ? pluginVue.processors[".vue"] : mergeProcessors2([
1684
1736
  pluginVue.processors[".vue"],
1685
1737
  processorVueBlocks({
@@ -1808,7 +1860,7 @@ async function yaml(options = {}) {
1808
1860
  ]);
1809
1861
  return [
1810
1862
  {
1811
- name: "kirklin:yaml:setup",
1863
+ name: "kirklin/yaml/setup",
1812
1864
  plugins: {
1813
1865
  yaml: pluginYaml
1814
1866
  }
@@ -1818,7 +1870,7 @@ async function yaml(options = {}) {
1818
1870
  languageOptions: {
1819
1871
  parser: parserYaml
1820
1872
  },
1821
- name: "kirklin:yaml:rules",
1873
+ name: "kirklin/yaml/rules",
1822
1874
  rules: {
1823
1875
  "style/spaced-comment": "off",
1824
1876
  "yaml/block-mapping": "error",
@@ -1866,7 +1918,7 @@ async function toml(options = {}) {
1866
1918
  ]);
1867
1919
  return [
1868
1920
  {
1869
- name: "kirklin:toml:setup",
1921
+ name: "kirklin/toml/setup",
1870
1922
  plugins: {
1871
1923
  toml: pluginToml
1872
1924
  }
@@ -1876,7 +1928,7 @@ async function toml(options = {}) {
1876
1928
  languageOptions: {
1877
1929
  parser: parserToml
1878
1930
  },
1879
- name: "kirklin:toml:rules",
1931
+ name: "kirklin/toml/rules",
1880
1932
  rules: {
1881
1933
  "style/spaced-comment": "off",
1882
1934
  "toml/comma-style": "error",
@@ -1924,7 +1976,7 @@ async function astro(options = {}) {
1924
1976
  ]);
1925
1977
  return [
1926
1978
  {
1927
- name: "kirklin:astro:setup",
1979
+ name: "kirklin/astro/setup",
1928
1980
  plugins: {
1929
1981
  astro: pluginAstro
1930
1982
  }
@@ -1938,7 +1990,7 @@ async function astro(options = {}) {
1938
1990
  parser: parserTs
1939
1991
  }
1940
1992
  },
1941
- name: "kirklin:astro:rules",
1993
+ name: "kirklin/astro/rules",
1942
1994
  rules: {
1943
1995
  "astro/no-set-html-directive": "off",
1944
1996
  ...stylistic2 ? {
@@ -1954,6 +2006,82 @@ async function astro(options = {}) {
1954
2006
  ];
1955
2007
  }
1956
2008
 
2009
+ // src/configs/solid.ts
2010
+ async function solid(options = {}) {
2011
+ const {
2012
+ files = [GLOB_JSX, GLOB_TSX],
2013
+ overrides = {},
2014
+ typescript: typescript2 = true
2015
+ } = options;
2016
+ await ensurePackages([
2017
+ "eslint-plugin-solid"
2018
+ ]);
2019
+ const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
2020
+ const isTypeAware = !!tsconfigPath;
2021
+ const [
2022
+ pluginSolid,
2023
+ parserTs
2024
+ ] = await Promise.all([
2025
+ interopDefault(import("eslint-plugin-solid")),
2026
+ interopDefault(import("@typescript-eslint/parser"))
2027
+ ]);
2028
+ return [
2029
+ {
2030
+ name: "kirklin/solid/setup",
2031
+ plugins: {
2032
+ solid: pluginSolid
2033
+ }
2034
+ },
2035
+ {
2036
+ files,
2037
+ languageOptions: {
2038
+ parser: parserTs,
2039
+ parserOptions: {
2040
+ ecmaFeatures: {
2041
+ jsx: true
2042
+ },
2043
+ ...isTypeAware ? { project: tsconfigPath } : {}
2044
+ },
2045
+ sourceType: "module"
2046
+ },
2047
+ name: "kirklin/solid/rules",
2048
+ rules: {
2049
+ // reactivity
2050
+ "solid/components-return-once": "warn",
2051
+ "solid/event-handlers": ["error", {
2052
+ // if true, don't warn on ambiguously named event handlers like `onclick` or `onchange`
2053
+ ignoreCase: false,
2054
+ // if true, warn when spreading event handlers onto JSX. Enable for Solid < v1.6.
2055
+ warnOnSpread: false
2056
+ }],
2057
+ // these rules are mostly style suggestions
2058
+ "solid/imports": "error",
2059
+ // identifier usage is important
2060
+ "solid/jsx-no-duplicate-props": "error",
2061
+ "solid/jsx-no-script-url": "error",
2062
+ "solid/jsx-no-undef": "error",
2063
+ "solid/jsx-uses-vars": "error",
2064
+ "solid/no-destructure": "error",
2065
+ // security problems
2066
+ "solid/no-innerhtml": ["error", { allowStatic: true }],
2067
+ "solid/no-react-deps": "error",
2068
+ "solid/no-react-specific-props": "error",
2069
+ "solid/no-unknown-namespaces": "error",
2070
+ "solid/prefer-for": "error",
2071
+ "solid/reactivity": "warn",
2072
+ "solid/self-closing-comp": "error",
2073
+ "solid/style-prop": ["error", { styleProps: ["style", "css"] }],
2074
+ ...typescript2 ? {
2075
+ "solid/jsx-no-undef": ["error", { typescriptEnabled: true }],
2076
+ "solid/no-unknown-namespaces": "off"
2077
+ } : {},
2078
+ // overrides
2079
+ ...overrides
2080
+ }
2081
+ }
2082
+ ];
2083
+ }
2084
+
1957
2085
  // src/factory.ts
1958
2086
  var flatConfigProps = [
1959
2087
  "name",
@@ -1972,13 +2100,23 @@ var VuePackages = [
1972
2100
  "vitepress",
1973
2101
  "@slidev/cli"
1974
2102
  ];
1975
- async function kirklin(options = {}, ...userConfigs) {
2103
+ var defaultPluginRenaming = {
2104
+ "@stylistic": "style",
2105
+ "@typescript-eslint": "ts",
2106
+ "import-x": "import",
2107
+ "n": "node",
2108
+ "vitest": "test",
2109
+ "yml": "yaml"
2110
+ };
2111
+ function kirklin(options = {}, ...userConfigs) {
1976
2112
  const {
1977
2113
  astro: enableAstro = false,
2114
+ autoRenamePlugins = true,
1978
2115
  componentExts = [],
1979
2116
  gitignore: enableGitignore = true,
1980
2117
  isInEditor = !!((process3.env.VSCODE_PID || process3.env.VSCODE_CWD || process3.env.JETBRAINS_IDE || process3.env.VIM) && !process3.env.CI),
1981
2118
  react: enableReact = false,
2119
+ solid: enableSolid = false,
1982
2120
  svelte: enableSvelte = false,
1983
2121
  typescript: enableTypeScript = isPackageExists4("typescript"),
1984
2122
  unocss: enableUnoCSS = false,
@@ -2029,6 +2167,7 @@ async function kirklin(options = {}, ...userConfigs) {
2029
2167
  if (stylisticOptions) {
2030
2168
  configs.push(stylistic({
2031
2169
  ...stylisticOptions,
2170
+ lessOpinionated: options.lessOpinionated,
2032
2171
  overrides: getOverrides(options, "stylistic")
2033
2172
  }));
2034
2173
  }
@@ -2052,6 +2191,13 @@ async function kirklin(options = {}, ...userConfigs) {
2052
2191
  typescript: !!enableTypeScript
2053
2192
  }));
2054
2193
  }
2194
+ if (enableSolid) {
2195
+ configs.push(solid({
2196
+ overrides: getOverrides(options, "solid"),
2197
+ tsconfigPath: getOverrides(options, "typescript").tsconfigPath,
2198
+ typescript: !!enableTypeScript
2199
+ }));
2200
+ }
2055
2201
  if (enableSvelte) {
2056
2202
  configs.push(svelte({
2057
2203
  overrides: getOverrides(options, "svelte"),
@@ -2118,11 +2264,15 @@ async function kirklin(options = {}, ...userConfigs) {
2118
2264
  if (Object.keys(fusedConfig).length) {
2119
2265
  configs.push([fusedConfig]);
2120
2266
  }
2121
- const merged = combine(
2267
+ let composer = new FlatConfigComposer();
2268
+ composer = composer.append(
2122
2269
  ...configs,
2123
2270
  ...userConfigs
2124
2271
  );
2125
- return merged;
2272
+ if (autoRenamePlugins) {
2273
+ composer = composer.renamePlugins(defaultPluginRenaming);
2274
+ }
2275
+ return composer;
2126
2276
  }
2127
2277
  function resolveSubOptions(options, key) {
2128
2278
  return typeof options[key] === "boolean" ? {} : options[key] || {};
@@ -2142,6 +2292,7 @@ export {
2142
2292
  GLOB_ASTRO,
2143
2293
  GLOB_CSS,
2144
2294
  GLOB_EXCLUDE,
2295
+ GLOB_GRAPHQL,
2145
2296
  GLOB_HTML,
2146
2297
  GLOB_JS,
2147
2298
  GLOB_JSON,
@@ -2169,6 +2320,7 @@ export {
2169
2320
  combine,
2170
2321
  comments,
2171
2322
  src_default as default,
2323
+ defaultPluginRenaming,
2172
2324
  ensurePackages,
2173
2325
  formatters,
2174
2326
  getOverrides,
@@ -2184,8 +2336,10 @@ export {
2184
2336
  parserPlain,
2185
2337
  perfectionist,
2186
2338
  react,
2339
+ renamePluginInConfigs,
2187
2340
  renameRules,
2188
2341
  resolveSubOptions,
2342
+ solid,
2189
2343
  sortPackageJson,
2190
2344
  sortTsconfig,
2191
2345
  stylistic,