@svifty7/eslint-config 0.0.1 → 0.0.4

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.
@@ -1,5 +1,5 @@
1
1
  import { FlatConfigComposer } from "eslint-flat-config-utils";
2
- import { isPackageExists } from "local-pkg";
2
+ import { isPackageExists, resolveModule } from "local-pkg";
3
3
  import createCommand from "eslint-plugin-command/config";
4
4
  import pluginComments from "@eslint-community/eslint-plugin-eslint-comments";
5
5
  import pluginAntfu from "eslint-plugin-antfu";
@@ -8,6 +8,7 @@ import pluginNode from "eslint-plugin-n";
8
8
  import pluginPerfectionist from "eslint-plugin-perfectionist";
9
9
  import pluginUnicorn from "eslint-plugin-unicorn";
10
10
  import pluginUnusedImports from "eslint-plugin-unused-imports";
11
+ import { fileURLToPath } from "node:url";
11
12
  import globals from "globals";
12
13
  import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
13
14
  import { configs } from "eslint-plugin-regexp";
@@ -326,8 +327,7 @@ const parserPlain = {
326
327
  * Combine array and non-array configs into a single array.
327
328
  */
328
329
  async function combine(...configs$1) {
329
- const resolved = await Promise.all(configs$1);
330
- return resolved.flat();
330
+ return (await Promise.all(configs$1)).flat();
331
331
  }
332
332
  /**
333
333
  * Rename plugin prefixes in a rule object.
@@ -378,7 +378,9 @@ const StylisticConfigDefaults = {
378
378
  blockSpacing: true,
379
379
  quoteProps: "consistent-as-needed",
380
380
  commaDangle: "always-multiline",
381
- pluginName: "style"
381
+ pluginName: "style",
382
+ severity: "error",
383
+ experimental: false
382
384
  };
383
385
  async function stylistic(options = {}) {
384
386
  const stylisticConfig = {
@@ -534,11 +536,23 @@ async function stylistic(options = {}) {
534
536
  //#endregion
535
537
  //#region src/configs/formatters.ts
536
538
  function mergePrettierOptions(options, overrides = {}) {
537
- return {
539
+ const config = {
538
540
  ...options,
539
541
  ...overrides,
540
542
  plugins: [...overrides.plugins || [], ...options.plugins || []]
541
543
  };
544
+ if (config.parser === "xml") return {
545
+ parser: config.parser,
546
+ plugins: config.plugins,
547
+ bracketSameLine: config.bracketSameLine,
548
+ singleAttributePerLine: config.singleAttributePerLine,
549
+ tabWidth: config.tabWidth,
550
+ xmlQuoteAttributes: config.xmlQuoteAttributes,
551
+ xmlSelfClosingSpace: config.xmlSelfClosingSpace,
552
+ xmlSortAttributesByKey: config.xmlSortAttributesByKey,
553
+ xmlWhitespaceSensitivity: config.xmlWhitespaceSensitivity
554
+ };
555
+ return config;
542
556
  }
543
557
  async function formatters(stylistic$1 = {}) {
544
558
  const { indent, quotes, semi } = {
@@ -550,7 +564,6 @@ async function formatters(stylistic$1 = {}) {
550
564
  singleQuote: quotes === "single",
551
565
  tabWidth: typeof indent === "number" ? indent : 2,
552
566
  useTabs: indent === "tab",
553
- printWidth: 80,
554
567
  quoteProps: "consistent",
555
568
  jsxSingleQuote: false,
556
569
  trailingComma: "all",
@@ -563,18 +576,10 @@ async function formatters(stylistic$1 = {}) {
563
576
  htmlWhitespaceSensitivity: "css",
564
577
  vueIndentScriptAndStyle: true,
565
578
  endOfLine: "lf",
566
- singleAttributePerLine: true,
567
- objectWrap: "preserve",
568
- experimentalTernaries: true,
569
- experimentalOperatorPosition: "start"
570
- };
571
- const prettierXmlOptions = {
572
- xmlQuoteAttributes: "double",
573
- xmlSelfClosingSpace: true,
574
- xmlSortAttributesByKey: false,
575
- xmlWhitespaceSensitivity: "ignore"
579
+ singleAttributePerLine: true
576
580
  };
577
581
  const pluginFormat = await interopDefault(import("eslint-plugin-format"));
582
+ const tailwindPluginPath = resolveModule("prettier-plugin-tailwindcss", { paths: [fileURLToPath(import.meta.url)] });
578
583
  const configs$1 = [{
579
584
  name: "svifty7/formatter/setup",
580
585
  plugins: { format: pluginFormat }
@@ -582,7 +587,7 @@ async function formatters(stylistic$1 = {}) {
582
587
  configs$1.push({
583
588
  files: [GLOB_SRC, GLOB_VUE],
584
589
  name: "svifty7/formatter/prettier",
585
- rules: { "format/prettier": ["error", prettierOptions] }
590
+ rules: { "format/prettier": ["error", tailwindPluginPath ? mergePrettierOptions(prettierOptions, { plugins: [tailwindPluginPath] }) : prettierOptions] }
586
591
  });
587
592
  configs$1.push({
588
593
  files: [GLOB_CSS, GLOB_POSTCSS],
@@ -604,30 +609,9 @@ async function formatters(stylistic$1 = {}) {
604
609
  files: [GLOB_HTML],
605
610
  languageOptions: { parser: parserPlain },
606
611
  name: "svifty7/formatter/html",
607
- rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "html" })] }
608
- });
609
- configs$1.push({
610
- files: [GLOB_XML],
611
- languageOptions: { parser: parserPlain },
612
- name: "svifty7/formatter/xml",
613
- rules: { "format/prettier": ["error", mergePrettierOptions({
614
- ...prettierXmlOptions,
615
- ...prettierOptions
616
- }, {
617
- parser: "xml",
618
- plugins: ["@prettier/plugin-xml"]
619
- })] }
620
- });
621
- configs$1.push({
622
- files: [GLOB_SVG],
623
- languageOptions: { parser: parserPlain },
624
- name: "svifty7/formatter/svg",
625
- rules: { "format/prettier": ["error", mergePrettierOptions({
626
- ...prettierXmlOptions,
627
- ...prettierOptions
628
- }, {
629
- parser: "xml",
630
- plugins: ["@prettier/plugin-xml"]
612
+ rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, {
613
+ parser: "html",
614
+ plugins: tailwindPluginPath ? [tailwindPluginPath] : void 0
631
615
  })] }
632
616
  });
633
617
  configs$1.push({
@@ -645,6 +629,40 @@ async function formatters(stylistic$1 = {}) {
645
629
  name: "svifty7/formatter/graphql",
646
630
  rules: { "format/prettier": ["error", mergePrettierOptions(prettierOptions, { parser: "graphql" })] }
647
631
  });
632
+ const prettierXmlOptions = {
633
+ xmlQuoteAttributes: "double",
634
+ xmlSelfClosingSpace: true,
635
+ xmlSortAttributesByKey: false,
636
+ xmlWhitespaceSensitivity: "ignore"
637
+ };
638
+ const xmlPluginPath = resolveModule("@prettier/plugin-xml", { paths: [fileURLToPath(import.meta.url)] });
639
+ if (!xmlPluginPath) console.warn("[@svifty7/eslint-config] Failed to resolve @prettier/plugin-xml");
640
+ else {
641
+ configs$1.push({
642
+ files: [GLOB_XML],
643
+ languageOptions: { parser: parserPlain },
644
+ name: "svifty7/formatter/xml",
645
+ rules: { "format/prettier": ["error", mergePrettierOptions({
646
+ ...prettierXmlOptions,
647
+ ...prettierOptions
648
+ }, {
649
+ parser: "xml",
650
+ plugins: [xmlPluginPath]
651
+ })] }
652
+ });
653
+ configs$1.push({
654
+ files: [GLOB_SVG],
655
+ languageOptions: { parser: parserPlain },
656
+ name: "svifty7/formatter/svg",
657
+ rules: { "format/prettier": ["error", mergePrettierOptions({
658
+ ...prettierXmlOptions,
659
+ ...prettierOptions
660
+ }, {
661
+ parser: "xml",
662
+ plugins: [xmlPluginPath]
663
+ })] }
664
+ });
665
+ }
648
666
  return configs$1;
649
667
  }
650
668
 
@@ -1121,32 +1139,50 @@ function perfectionist() {
1121
1139
  rules: {
1122
1140
  "perfectionist/sort-exports": ["error", {
1123
1141
  order: "asc",
1124
- type: "natural"
1142
+ type: "natural",
1143
+ newlinesBetween: 1,
1144
+ groups: [
1145
+ "type-export",
1146
+ {
1147
+ group: "multiline-export",
1148
+ newlinesInside: 1
1149
+ },
1150
+ "singleline-export"
1151
+ ]
1125
1152
  }],
1126
1153
  "perfectionist/sort-imports": ["error", {
1127
1154
  groups: [
1128
1155
  "builtin",
1129
1156
  "external",
1130
- "type",
1131
1157
  "internal",
1158
+ "tsconfig-path",
1159
+ "subpath",
1132
1160
  "parent",
1133
1161
  "sibling",
1134
1162
  "index",
1135
- "side-effect",
1136
1163
  "unknown",
1164
+ "type-builtin",
1165
+ "type-external",
1137
1166
  [
1138
- "parent-type",
1139
- "sibling-type",
1140
- "index-type",
1141
- "internal-type"
1167
+ "type-internal",
1168
+ "type-tsconfig-path",
1169
+ "type-subpath"
1142
1170
  ],
1143
- "object"
1171
+ [
1172
+ "type-parent",
1173
+ "type-sibling",
1174
+ "type-index"
1175
+ ],
1176
+ "side-effect",
1177
+ "side-effect-style",
1178
+ "style"
1144
1179
  ],
1145
1180
  internalPattern: ["^~/.+", "^@/.+"],
1146
- newlinesBetween: "always",
1181
+ newlinesBetween: 1,
1147
1182
  order: "asc",
1148
1183
  type: "natural",
1149
- tsconfigRootDir: process.cwd()
1184
+ tsconfig: { rootDir: process.cwd() },
1185
+ fallbackSort: { type: "unsorted" }
1150
1186
  }],
1151
1187
  "perfectionist/sort-named-exports": ["error", {
1152
1188
  order: "asc",
@@ -1869,6 +1905,7 @@ async function vue(options = {}) {
1869
1905
  "vue-a11y/label-has-for": "off",
1870
1906
  "vue-a11y/no-autofocus": "off",
1871
1907
  "vue-a11y/form-control-has-label": "off",
1908
+ "vue-a11y/no-static-element-interactions": "off",
1872
1909
  "vue-a11y/alt-text": "error",
1873
1910
  "vue-a11y/aria-props": "error",
1874
1911
  "vue-a11y/aria-role": "error",
@@ -1882,7 +1919,6 @@ async function vue(options = {}) {
1882
1919
  "vue-a11y/no-distracting-elements": "error",
1883
1920
  "vue-a11y/no-redundant-roles": "error",
1884
1921
  "vue-a11y/no-role-presentation-on-focusable": "error",
1885
- "vue-a11y/no-static-element-interactions": "error",
1886
1922
  "vue-a11y/role-has-required-aria-props": "error",
1887
1923
  "vue-a11y/tabindex-no-positive": "warn"
1888
1924
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@svifty7/eslint-config",
3
3
  "type": "module",
4
- "version": "0.0.1",
4
+ "version": "0.0.4",
5
5
  "description": "ESLint config by svifty7 based on @antfu/eslint-config",
6
6
  "author": "svifty7 (https://github.com/svifty7)",
7
7
  "license": "MIT",
@@ -34,60 +34,67 @@
34
34
  "registry": "https://registry.npmjs.org/"
35
35
  },
36
36
  "peerDependencies": {
37
- "eslint": "^9.26.0"
37
+ "eslint": "^9.26.0",
38
+ "vue": "^3.5.14"
39
+ },
40
+ "peerDependenciesMeta": {
41
+ "vue": {
42
+ "optional": true
43
+ }
38
44
  },
39
45
  "dependencies": {
40
46
  "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
41
- "@eslint/markdown": "^6.4.0",
42
- "@prettier/plugin-xml": "^3.4.1",
43
- "@stylistic/eslint-plugin": "^4.2.0",
44
- "@typescript-eslint/eslint-plugin": "^8.32.1",
45
- "@typescript-eslint/parser": "^8.32.1",
46
- "@vitest/eslint-plugin": "^1.1.44",
47
+ "@eslint/markdown": "^7.5.1",
48
+ "@prettier/plugin-xml": "^3.4.2",
49
+ "@stylistic/eslint-plugin": "^5.6.1",
50
+ "@typescript-eslint/eslint-plugin": "^8.51.0",
51
+ "@typescript-eslint/parser": "^8.51.0",
52
+ "@vitest/eslint-plugin": "^1.6.4",
47
53
  "eslint-config-flat-gitignore": "^2.1.0",
48
- "eslint-flat-config-utils": "^2.0.1",
54
+ "eslint-flat-config-utils": "^2.1.4",
49
55
  "eslint-merge-processors": "^2.0.0",
50
56
  "eslint-plugin-antfu": "^3.1.1",
51
- "eslint-plugin-command": "^3.2.0",
52
- "eslint-plugin-format": "^1.0.1",
53
- "eslint-plugin-import-x": "^4.11.1",
54
- "eslint-plugin-jsdoc": "^50.6.15",
55
- "eslint-plugin-jsonc": "^2.20.0",
56
- "eslint-plugin-n": "^17.18.0",
57
+ "eslint-plugin-command": "^3.4.0",
58
+ "eslint-plugin-format": "^1.1.0",
59
+ "eslint-plugin-import-x": "^4.16.1",
60
+ "eslint-plugin-jsdoc": "^61.5.0",
61
+ "eslint-plugin-jsonc": "^2.21.0",
62
+ "eslint-plugin-n": "^17.23.1",
57
63
  "eslint-plugin-no-only-tests": "^3.3.0",
58
- "eslint-plugin-perfectionist": "^4.13.0",
59
- "eslint-plugin-pnpm": "^0.3.1",
60
- "eslint-plugin-regexp": "^2.7.0",
64
+ "eslint-plugin-perfectionist": "^5.1.0",
65
+ "eslint-plugin-pnpm": "^1.4.3",
66
+ "eslint-plugin-regexp": "^2.10.0",
61
67
  "eslint-plugin-toml": "^0.12.0",
62
- "eslint-plugin-unicorn": "^59.0.1",
63
- "eslint-plugin-unused-imports": "^4.1.4",
64
- "eslint-plugin-vue": "^10.1.0",
68
+ "eslint-plugin-unicorn": "^62.0.0",
69
+ "eslint-plugin-unused-imports": "^4.3.0",
70
+ "eslint-plugin-vue": "^10.6.2",
65
71
  "eslint-plugin-vuejs-accessibility": "^2.4.1",
66
- "eslint-plugin-yml": "^1.18.0",
67
- "globals": "^16.1.0",
68
- "jsonc-eslint-parser": "^2.4.0",
69
- "local-pkg": "^1.1.1",
70
- "pnpm-workspace-yaml": "^0.3.1",
71
- "prettier": "^3.5.3",
72
- "toml-eslint-parser": "^0.10.0",
73
- "vue-eslint-parser": "^10.1.3",
74
- "yaml-eslint-parser": "^1.3.0"
72
+ "eslint-plugin-yml": "^1.19.1",
73
+ "globals": "^16.5.0",
74
+ "jsonc-eslint-parser": "^2.4.2",
75
+ "local-pkg": "^1.1.2",
76
+ "pnpm-workspace-yaml": "^1.4.3",
77
+ "prettier": "^3.7.4",
78
+ "toml-eslint-parser": "^0.10.1",
79
+ "vue-eslint-parser": "^10.2.0",
80
+ "yaml-eslint-parser": "^1.3.2"
75
81
  },
76
82
  "devDependencies": {
77
- "@antfu/ni": "^24.3.0",
78
- "@eslint/config-inspector": "^1.0.2",
79
- "@types/node": "^22.14.0",
80
- "bumpp": "^10.1.0",
81
- "eslint": "^9.26.0",
82
- "eslint-typegen": "^2.2.0",
83
- "jiti": "^2.4.2",
84
- "lint-staged": "^16.0.0",
85
- "simple-git-hooks": "^2.13.0",
86
- "tinyglobby": "^0.2.13",
87
- "tsdown": "^0.11.9",
88
- "tsx": "^4.19.4",
89
- "typescript": "^5.8.3",
90
- "vue": "^3.5.14"
83
+ "@antfu/ni": "^28.0.0",
84
+ "@eslint/config-inspector": "^1.4.2",
85
+ "@types/node": "^22.19.3",
86
+ "bumpp": "^10.3.2",
87
+ "eslint": "^9.39.2",
88
+ "eslint-typegen": "^2.3.0",
89
+ "jiti": "^2.6.1",
90
+ "lint-staged": "^16.2.7",
91
+ "prettier-plugin-tailwindcss": "^0.7.2",
92
+ "simple-git-hooks": "^2.13.1",
93
+ "tinyglobby": "^0.2.15",
94
+ "tsdown": "^0.18.3",
95
+ "tsx": "^4.21.0",
96
+ "typescript": "^5.9.3",
97
+ "vue": "^3.5.26"
91
98
  },
92
99
  "simple-git-hooks": {
93
100
  "pre-commit": "pnpm lint-staged"