@debbl/eslint-config 3.4.0 → 3.6.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.d.ts CHANGED
@@ -2,11 +2,6 @@ import { ParserOptions } from '@typescript-eslint/parser';
2
2
  import { Linter } from 'eslint';
3
3
  import { RequiredOptions } from 'prettier';
4
4
 
5
- type ReactConfig = (options: {
6
- next?: boolean;
7
- compiler?: boolean;
8
- } & OptionsOverrides) => ReturnType<ConfigFn>;
9
-
10
5
  declare function comments(): Promise<ConfigItem[]>;
11
6
 
12
7
  type IgnoresConfig = (options: {
@@ -34,6 +29,19 @@ declare const markdown: MarkdownConfig;
34
29
 
35
30
  declare function node(): Promise<ConfigItem[]>;
36
31
 
32
+ /**
33
+ * Perfectionist plugin for props and items sorting.
34
+ *
35
+ * @see https://github.com/azat-io/eslint-plugin-perfectionist
36
+ */
37
+ declare function perfectionist(): Promise<ConfigItem[]>;
38
+
39
+ type PrettierRequiredOptions = Partial<RequiredOptions>;
40
+ type PrettierConfig = ({ options, }: PrettierRequiredOptions & {
41
+ tailwindcss?: boolean;
42
+ }) => Promise<ConfigItem[]>;
43
+ declare const prettier: PrettierConfig;
44
+
37
45
  /**
38
46
  * Sort package.json
39
47
  *
@@ -47,6 +55,12 @@ declare function sortPackageJson(): Promise<ConfigItem[]>;
47
55
  */
48
56
  declare function sortTsconfig(): Promise<ConfigItem[]>;
49
57
 
58
+ type TestConfig = ConfigFn;
59
+ declare const test: TestConfig;
60
+
61
+ type TomlConfig = ConfigFn;
62
+ declare const toml: TomlConfig;
63
+
50
64
  type TypeScriptConfig = (options?: OptionsComponentExts & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsOverrides & {
51
65
  enableSolid?: boolean;
52
66
  }) => ReturnType<ConfigFn>;
@@ -60,28 +74,14 @@ declare const vue: VueConfig;
60
74
  type YmlConfig = (options: OptionsOverrides) => ReturnType<ConfigFn>;
61
75
  declare const yml: YmlConfig;
62
76
 
63
- type TomlConfig = ConfigFn;
64
- declare const toml: TomlConfig;
65
-
66
- type TestConfig = ConfigFn;
67
- declare const test: TestConfig;
68
-
69
- /**
70
- * Optional sort-keys plugin
71
- *
72
- * @see https://github.com/azat-io/eslint-plugin-perfectionist/
73
- */
74
- declare function perfectionist(): Promise<ConfigItem[]>;
75
-
76
- type PrettierRequiredOptions = Partial<RequiredOptions>;
77
- type PrettierConfig = ({ options, }: PrettierRequiredOptions & {
78
- tailwindcss?: boolean;
79
- }) => Promise<ConfigItem[]>;
80
- declare const prettier: PrettierConfig;
77
+ type ReactConfig = (options: {
78
+ next?: boolean;
79
+ compiler?: boolean;
80
+ } & OptionsOverrides) => ReturnType<ConfigFn>;
81
81
 
82
82
  type Awaitable<T> = T | Promise<T>;
83
83
  type GetConfigOption<T extends (...args: any) => any> = Parameters<T>[0];
84
- interface ConfigItem extends Linter.FlatConfig {
84
+ interface ConfigItem extends Linter.Config {
85
85
  /**
86
86
  * An object containing a name-value mapping of plugin names to plugin objects. When `files` is specified, these plugins are only available to the matching files.
87
87
  *
@@ -213,6 +213,31 @@ declare function defineConfig(options?: OptionsConfig): Promise<ConfigItem[]>;
213
213
  */
214
214
  declare const config: typeof defineConfig;
215
215
 
216
+ declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
217
+ declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
218
+ declare const GLOB_JS = "**/*.?([cm])js";
219
+ declare const GLOB_JSX = "**/*.?([cm])jsx";
220
+ declare const GLOB_TS = "**/*.?([cm])ts";
221
+ declare const GLOB_TSX = "**/*.?([cm])tsx";
222
+ declare const GLOB_STYLE = "**/*.{c,le,sc}ss";
223
+ declare const GLOB_CSS = "**/*.css";
224
+ declare const GLOB_POSTCSS = "**/*.{p,post}css";
225
+ declare const GLOB_LESS = "**/*.less";
226
+ declare const GLOB_SCSS = "**/*.scss";
227
+ declare const GLOB_JSON = "**/*.json";
228
+ declare const GLOB_JSON5 = "**/*.json5";
229
+ declare const GLOB_JSONC = "**/*.jsonc";
230
+ declare const GLOB_MARKDOWN = "**/*.md";
231
+ declare const GLOB_MDX = "**/*.mdx";
232
+ declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
233
+ declare const GLOB_VUE = "**/*.vue";
234
+ declare const GLOB_YAML = "**/*.y?(a)ml";
235
+ declare const GLOB_TOML = "**/*.toml";
236
+ declare const GLOB_HTML = "**/*.htm?(l)";
237
+ declare const GLOB_TESTS: string[];
238
+ declare const GLOB_ALL_SRC: string[];
239
+ declare const GLOB_EXCLUDE: string[];
240
+
216
241
  declare const parserPlain: {
217
242
  meta: {
218
243
  name: string;
@@ -246,29 +271,4 @@ declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
246
271
  default: infer U;
247
272
  } ? U : T>;
248
273
 
249
- declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
250
- declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
251
- declare const GLOB_JS = "**/*.?([cm])js";
252
- declare const GLOB_JSX = "**/*.?([cm])jsx";
253
- declare const GLOB_TS = "**/*.?([cm])ts";
254
- declare const GLOB_TSX = "**/*.?([cm])tsx";
255
- declare const GLOB_STYLE = "**/*.{c,le,sc}ss";
256
- declare const GLOB_CSS = "**/*.css";
257
- declare const GLOB_POSTCSS = "**/*.{p,post}css";
258
- declare const GLOB_LESS = "**/*.less";
259
- declare const GLOB_SCSS = "**/*.scss";
260
- declare const GLOB_JSON = "**/*.json";
261
- declare const GLOB_JSON5 = "**/*.json5";
262
- declare const GLOB_JSONC = "**/*.jsonc";
263
- declare const GLOB_MARKDOWN = "**/*.md";
264
- declare const GLOB_MDX = "**/*.mdx";
265
- declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
266
- declare const GLOB_VUE = "**/*.vue";
267
- declare const GLOB_YAML = "**/*.y?(a)ml";
268
- declare const GLOB_TOML = "**/*.toml";
269
- declare const GLOB_HTML = "**/*.htm?(l)";
270
- declare const GLOB_TESTS: string[];
271
- declare const GLOB_ALL_SRC: string[];
272
- declare const GLOB_EXCLUDE: string[];
273
-
274
274
  export { type Awaitable, type ConfigFn, type ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MDX, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type GetConfigOption, type IgnoresConfig, type JavascriptConfig, type JsoncConfig, type MarkdownConfig, type OptionsComponentExts, type OptionsConfig, type OptionsHasTypeScript, type OptionsOverrides, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PrettierConfig, type PrettierRequiredOptions, type TestConfig, type TomlConfig, type TypeScriptConfig, type VueConfig, type YmlConfig, combine, comments, config, config as default, defineConfig, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, prettier, sortPackageJson, sortTsconfig, test, toml, typescript, unicorn, vue, yml };
package/dist/index.js CHANGED
@@ -165,7 +165,6 @@ async function imports() {
165
165
  "import/no-named-default": "error",
166
166
  "import/no-self-import": "error",
167
167
  "import/no-webpack-loader-syntax": "error",
168
- "import/order": "error",
169
168
  "import/newline-after-import": [
170
169
  "error",
171
170
  { considerComments: true, count: 1 }
@@ -180,7 +179,6 @@ import globals from "globals";
180
179
  var javascript = async (options) => {
181
180
  const { overrides = {} } = options;
182
181
  const pluginUnusedImports = await interopDefault(
183
- // @ts-expect-error missing types
184
182
  import("eslint-plugin-unused-imports")
185
183
  );
186
184
  return [
@@ -306,9 +304,6 @@ var javascript = async (options) => {
306
304
  ],
307
305
  "no-restricted-syntax": [
308
306
  "error",
309
- "DebuggerStatement",
310
- "LabeledStatement",
311
- "WithStatement",
312
307
  "TSEnumDeclaration[const=true]",
313
308
  "TSExportAssignment"
314
309
  ],
@@ -636,6 +631,152 @@ async function node() {
636
631
  ];
637
632
  }
638
633
 
634
+ // src/configs/perfectionist.ts
635
+ async function perfectionist() {
636
+ const pluginPerfectionist = await interopDefault(
637
+ import("eslint-plugin-perfectionist")
638
+ );
639
+ return [
640
+ {
641
+ name: "eslint/perfectionist/setup",
642
+ plugins: {
643
+ perfectionist: pluginPerfectionist
644
+ },
645
+ rules: {
646
+ "perfectionist/sort-exports": [
647
+ "error",
648
+ { order: "asc", type: "natural" }
649
+ ],
650
+ "perfectionist/sort-imports": [
651
+ "error",
652
+ {
653
+ groups: [
654
+ "builtin",
655
+ "external",
656
+ "type",
657
+ ["internal", "internal-type"],
658
+ ["parent", "sibling", "index"],
659
+ ["parent-type", "sibling-type", "index-type"],
660
+ "side-effect",
661
+ "object",
662
+ "unknown"
663
+ ],
664
+ newlinesBetween: "ignore",
665
+ order: "asc",
666
+ type: "natural"
667
+ }
668
+ ],
669
+ "perfectionist/sort-named-exports": [
670
+ "error",
671
+ { order: "asc", type: "natural" }
672
+ ],
673
+ "perfectionist/sort-named-imports": [
674
+ "error",
675
+ { order: "asc", type: "natural" }
676
+ ]
677
+ }
678
+ }
679
+ ];
680
+ }
681
+
682
+ // src/configs/prettier.ts
683
+ var prettier = async ({ tailwindcss: tailwindcss2, ...options }) => {
684
+ const [pluginPrettier, configPrettier] = await Promise.all([
685
+ interopDefault(import("eslint-plugin-prettier")),
686
+ // @ts-expect-error missing types
687
+ interopDefault(import("eslint-config-prettier"))
688
+ ]);
689
+ const PlainFileRules = [
690
+ {
691
+ name: "eslint/prettier/markdown",
692
+ files: [GLOB_MARKDOWN],
693
+ parser: "markdown"
694
+ },
695
+ {
696
+ name: "eslint/prettier/mdx",
697
+ files: [GLOB_MDX],
698
+ parser: "mdx"
699
+ },
700
+ {
701
+ name: "eslint/prettier/html",
702
+ files: ["**/*.html"],
703
+ parser: "html"
704
+ },
705
+ {
706
+ name: "eslint/prettier/css",
707
+ files: [GLOB_CSS, GLOB_POSTCSS],
708
+ parser: "css"
709
+ },
710
+ {
711
+ name: "eslint/prettier/scss",
712
+ files: [GLOB_SCSS],
713
+ parser: "scss"
714
+ },
715
+ {
716
+ name: "eslint/prettier/less",
717
+ files: [GLOB_LESS],
718
+ parser: "less"
719
+ },
720
+ {
721
+ name: "eslint/prettier/yaml",
722
+ files: [GLOB_YAML],
723
+ parser: "yaml"
724
+ },
725
+ {
726
+ name: "eslint/prettier/graphql",
727
+ files: ["**/*.graphql"],
728
+ parser: "graphql"
729
+ }
730
+ ].map((rule) => ({
731
+ name: rule.name,
732
+ files: rule.files,
733
+ languageOptions: {
734
+ parser: parserPlain
735
+ },
736
+ rules: {
737
+ "prettier/prettier": [
738
+ "warn",
739
+ {
740
+ parser: rule.parser,
741
+ quoteProps: "consistent",
742
+ ...options
743
+ }
744
+ ]
745
+ }
746
+ }));
747
+ return [
748
+ {
749
+ name: "eslint/prettier/setup",
750
+ plugins: {
751
+ prettier: pluginPrettier
752
+ }
753
+ },
754
+ {
755
+ name: "eslint/prettier/rules",
756
+ ignores: [GLOB_TOML],
757
+ rules: {
758
+ // disable rules with prettier conflicts
759
+ ...configPrettier.rules,
760
+ // eslint-plugin-prettier recommended rules
761
+ ...{
762
+ "prettier/prettier": "error",
763
+ "arrow-body-style": "off",
764
+ "prefer-arrow-callback": "off"
765
+ },
766
+ "prettier/prettier": [
767
+ "warn",
768
+ {
769
+ plugins: tailwindcss2 ? ["prettier-plugin-tailwindcss"] : [],
770
+ quoteProps: "consistent",
771
+ ...options
772
+ }
773
+ ]
774
+ }
775
+ },
776
+ ...PlainFileRules
777
+ ];
778
+ };
779
+
639
780
  // src/configs/sort.ts
640
781
  async function sortPackageJson() {
641
782
  return [
@@ -843,19 +984,106 @@ async function sortTsconfig() {
843
984
  ];
844
985
  }
845
986
 
987
+ // src/configs/test.ts
988
+ var test = async (options) => {
989
+ const { overrides = {} } = options;
990
+ const [pluginVitest, pluginNoOnlyTests] = await Promise.all([
991
+ interopDefault(import("eslint-plugin-vitest")),
992
+ // @ts-expect-error missing types
993
+ interopDefault(import("eslint-plugin-no-only-tests"))
994
+ ]);
995
+ return [
996
+ {
997
+ name: "eslint/test/setup",
998
+ plugins: {
999
+ test: {
1000
+ ...pluginVitest,
1001
+ rules: {
1002
+ ...pluginVitest.rules,
1003
+ // extend `test/no-only-tests` rule
1004
+ ...pluginNoOnlyTests.rules
1005
+ }
1006
+ }
1007
+ }
1008
+ },
1009
+ {
1010
+ name: "eslint/test/rules",
1011
+ files: GLOB_TESTS,
1012
+ rules: {
1013
+ "node/prefer-global/process": "off",
1014
+ "test/consistent-test-it": [
1015
+ "error",
1016
+ { fn: "it", withinDescribe: "it" }
1017
+ ],
1018
+ "test/no-identical-title": "error",
1019
+ "test/no-import-node-test": "error",
1020
+ "test/no-only-tests": "error",
1021
+ "test/prefer-hooks-in-order": "error",
1022
+ "test/prefer-lowercase-title": "error",
1023
+ "@typescript-eslint/explicit-function-return-type": "off",
1024
+ ...overrides
1025
+ }
1026
+ }
1027
+ ];
1028
+ };
1029
+
1030
+ // src/configs/toml.ts
1031
+ var toml = async (options) => {
1032
+ const { overrides = {} } = options;
1033
+ const [pluginToml, parserToml] = await Promise.all([
1034
+ interopDefault(import("eslint-plugin-toml")),
1035
+ interopDefault(import("toml-eslint-parser"))
1036
+ ]);
1037
+ return [
1038
+ {
1039
+ name: "eslint/toml/setup",
1040
+ plugins: {
1041
+ toml: pluginToml
1042
+ }
1043
+ },
1044
+ {
1045
+ name: "eslint/toml/rules",
1046
+ files: [GLOB_TOML],
1047
+ languageOptions: {
1048
+ parser: parserToml
1049
+ },
1050
+ rules: {
1051
+ "toml/comma-style": "error",
1052
+ "toml/keys-order": "error",
1053
+ "toml/no-space-dots": "error",
1054
+ "toml/no-unreadable-number-separator": "error",
1055
+ "toml/precision-of-fractional-seconds": "error",
1056
+ "toml/precision-of-integer": "error",
1057
+ "toml/tables-order": "error",
1058
+ "toml/vue-custom-block/no-parsing-error": "error",
1059
+ "toml/array-bracket-newline": "error",
1060
+ "toml/array-bracket-spacing": "error",
1061
+ "toml/array-element-newline": "error",
1062
+ "toml/indent": ["error", 2],
1063
+ "toml/inline-table-curly-spacing": "error",
1064
+ "toml/key-spacing": "error",
1065
+ "toml/padding-line-between-pairs": "error",
1066
+ "toml/padding-line-between-tables": "error",
1067
+ "toml/quoted-keys": "error",
1068
+ "toml/spaced-comment": "error",
1069
+ "toml/table-bracket-spacing": "error",
1070
+ ...overrides
1071
+ }
1072
+ }
1073
+ ];
1074
+ };
1075
+
846
1076
  // src/configs/typescript.ts
847
1077
  import process2 from "process";
848
1078
  var typeAwareRules = {
849
1079
  "dot-notation": "off",
850
1080
  "no-implied-eval": "off",
851
- "no-throw-literal": "off",
852
1081
  "@typescript-eslint/await-thenable": "error",
853
1082
  "@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
854
1083
  "@typescript-eslint/no-floating-promises": "error",
855
1084
  "@typescript-eslint/no-for-in-array": "error",
856
1085
  "@typescript-eslint/no-implied-eval": "error",
857
1086
  "@typescript-eslint/no-misused-promises": "error",
858
- "@typescript-eslint/no-throw-literal": "error",
859
1087
  "@typescript-eslint/no-unnecessary-type-assertion": "error",
860
1088
  "@typescript-eslint/no-unsafe-argument": "error",
861
1089
  "@typescript-eslint/no-unsafe-assignment": "error",
@@ -865,8 +1093,11 @@ var typeAwareRules = {
865
1093
  "@typescript-eslint/promise-function-async": "error",
866
1094
  "@typescript-eslint/restrict-plus-operands": "error",
867
1095
  "@typescript-eslint/restrict-template-expressions": "error",
868
- "@typescript-eslint/strict-boolean-expressions": "error",
869
- "@typescript-eslint/return-await": "error",
1096
+ "@typescript-eslint/return-await": ["error", "in-try-catch"],
1097
+ "@typescript-eslint/strict-boolean-expressions": [
1098
+ "error",
1099
+ { allowNullableBoolean: true, allowNullableObject: true }
1100
+ ],
870
1101
  "@typescript-eslint/switch-exhaustiveness-check": "error",
871
1102
  "@typescript-eslint/unbound-method": "error"
872
1103
  };
@@ -916,18 +1147,13 @@ var typescript = async (options) => {
916
1147
  "solid/no-unknown-namespaces": "off"
917
1148
  } : {},
918
1149
  "no-dupe-class-members": "off",
919
- "no-invalid-this": "off",
920
1150
  "no-loss-of-precision": "off",
921
1151
  "no-redeclare": "off",
922
1152
  "no-use-before-define": "off",
923
1153
  "no-useless-constructor": "off",
924
1154
  "@typescript-eslint/ban-ts-comment": [
925
1155
  "error",
926
- { "ts-ignore": "allow-with-description" }
927
- ],
928
- "@typescript-eslint/ban-types": [
929
- "error",
930
- { types: { Function: false } }
1156
+ { "ts-expect-error": "allow-with-description" }
931
1157
  ],
932
1158
  "@typescript-eslint/consistent-type-definitions": [
933
1159
  "error",
@@ -935,16 +1161,22 @@ var typescript = async (options) => {
935
1161
  ],
936
1162
  "@typescript-eslint/consistent-type-imports": [
937
1163
  "error",
938
- { disallowTypeAnnotations: false, prefer: "type-imports" }
1164
+ {
1165
+ disallowTypeAnnotations: false,
1166
+ prefer: "type-imports"
1167
+ }
939
1168
  ],
940
1169
  // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
941
1170
  "@typescript-eslint/method-signature-style": ["error", "property"],
942
1171
  "@typescript-eslint/no-dupe-class-members": "error",
943
1172
  "@typescript-eslint/no-dynamic-delete": "off",
1173
+ "@typescript-eslint/no-empty-object-type": [
1174
+ "error",
1175
+ { allowInterfaces: "always" }
1176
+ ],
944
1177
  "@typescript-eslint/no-explicit-any": "off",
945
1178
  "@typescript-eslint/no-extraneous-class": "off",
946
1179
  "@typescript-eslint/no-import-type-side-effects": "error",
947
- "@typescript-eslint/no-invalid-this": "error",
948
1180
  "@typescript-eslint/no-invalid-void-type": "off",
949
1181
  "@typescript-eslint/no-loss-of-precision": "error",
950
1182
  "@typescript-eslint/no-non-null-assertion": "off",
@@ -956,7 +1188,7 @@ var typescript = async (options) => {
956
1188
  { classes: false, functions: false, variables: true }
957
1189
  ],
958
1190
  "@typescript-eslint/no-useless-constructor": "off",
959
- "@typescript-eslint/prefer-ts-expect-error": "error",
1191
+ "@typescript-eslint/no-wrapper-object-types": "error",
960
1192
  "@typescript-eslint/triple-slash-reference": "off",
961
1193
  "@typescript-eslint/unified-signatures": "off",
962
1194
  ...tsconfigPath ? typeAwareRules : {},
@@ -1210,206 +1442,6 @@ var yml = async (options) => {
1210
1442
  ];
1211
1443
  };
1212
1444
 
1213
- // src/configs/toml.ts
1214
- var toml = async (options) => {
1215
- const { overrides = {} } = options;
1216
- const [pluginToml, parserToml] = await Promise.all([
1217
- interopDefault(import("eslint-plugin-toml")),
1218
- interopDefault(import("toml-eslint-parser"))
1219
- ]);
1220
- return [
1221
- {
1222
- name: "eslint/toml/setup",
1223
- plugins: {
1224
- toml: pluginToml
1225
- }
1226
- },
1227
- {
1228
- name: "eslint/toml/rules",
1229
- files: [GLOB_TOML],
1230
- languageOptions: {
1231
- parser: parserToml
1232
- },
1233
- rules: {
1234
- "toml/comma-style": "error",
1235
- "toml/keys-order": "error",
1236
- "toml/no-space-dots": "error",
1237
- "toml/no-unreadable-number-separator": "error",
1238
- "toml/precision-of-fractional-seconds": "error",
1239
- "toml/precision-of-integer": "error",
1240
- "toml/tables-order": "error",
1241
- "toml/vue-custom-block/no-parsing-error": "error",
1242
- "toml/array-bracket-newline": "error",
1243
- "toml/array-bracket-spacing": "error",
1244
- "toml/array-element-newline": "error",
1245
- "toml/indent": ["error", 2],
1246
- "toml/inline-table-curly-spacing": "error",
1247
- "toml/key-spacing": "error",
1248
- "toml/padding-line-between-pairs": "error",
1249
- "toml/padding-line-between-tables": "error",
1250
- "toml/quoted-keys": "error",
1251
- "toml/spaced-comment": "error",
1252
- "toml/table-bracket-spacing": "error",
1253
- ...overrides
1254
- }
1255
- }
1256
- ];
1257
- };
1258
-
1259
- // src/configs/test.ts
1260
- var test = async (options) => {
1261
- const { overrides = {} } = options;
1262
- const [pluginVitest, pluginNoOnlyTests] = await Promise.all([
1263
- interopDefault(import("eslint-plugin-vitest")),
1264
- // @ts-expect-error missing types
1265
- interopDefault(import("eslint-plugin-no-only-tests"))
1266
- ]);
1267
- return [
1268
- {
1269
- name: "eslint/test/setup",
1270
- plugins: {
1271
- test: {
1272
- ...pluginVitest,
1273
- rules: {
1274
- ...pluginVitest.rules,
1275
- // extend `test/no-only-tests` rule
1276
- ...pluginNoOnlyTests.rules
1277
- }
1278
- }
1279
- }
1280
- },
1281
- {
1282
- name: "eslint/test/rules",
1283
- files: GLOB_TESTS,
1284
- rules: {
1285
- "test/consistent-test-it": [
1286
- "error",
1287
- { fn: "it", withinDescribe: "it" }
1288
- ],
1289
- "test/no-identical-title": "error",
1290
- "test/no-only-tests": "error",
1291
- "test/prefer-hooks-in-order": "error",
1292
- "test/prefer-lowercase-title": "error",
1293
- ...overrides
1294
- }
1295
- }
1296
- ];
1297
- };
1298
-
1299
- // src/configs/perfectionist.ts
1300
- async function perfectionist() {
1301
- const pluginPerfectionist = await interopDefault(
1302
- // @ts-expect-error missing types
1303
- import("eslint-plugin-perfectionist")
1304
- );
1305
- return [
1306
- {
1307
- name: "eslint/perfectionist/setup",
1308
- plugins: {
1309
- perfectionist: pluginPerfectionist
1310
- }
1311
- }
1312
- ];
1313
- }
1314
-
1315
- // src/configs/prettier.ts
1316
- var prettier = async ({ tailwindcss: tailwindcss2, ...options }) => {
1317
- const [pluginPrettier, configPrettier] = await Promise.all([
1318
- interopDefault(import("eslint-plugin-prettier")),
1319
- // @ts-expect-error missing types
1320
- interopDefault(import("eslint-config-prettier"))
1321
- ]);
1322
- const PlainFileRules = [
1323
- {
1324
- name: "eslint/prettier/markdown",
1325
- files: [GLOB_MARKDOWN],
1326
- parser: "markdown"
1327
- },
1328
- {
1329
- name: "eslint/prettier/mdx",
1330
- files: [GLOB_MDX],
1331
- parser: "mdx"
1332
- },
1333
- {
1334
- name: "eslint/prettier/html",
1335
- files: ["**/*.html"],
1336
- parser: "html"
1337
- },
1338
- {
1339
- name: "eslint/prettier/css",
1340
- files: [GLOB_CSS, GLOB_POSTCSS],
1341
- parser: "css"
1342
- },
1343
- {
1344
- name: "eslint/prettier/scss",
1345
- files: [GLOB_SCSS],
1346
- parser: "scss"
1347
- },
1348
- {
1349
- name: "eslint/prettier/less",
1350
- files: [GLOB_LESS],
1351
- parser: "less"
1352
- },
1353
- {
1354
- name: "eslint/prettier/yaml",
1355
- files: [GLOB_YAML],
1356
- parser: "yaml"
1357
- },
1358
- {
1359
- name: "eslint/prettier/graphql",
1360
- files: ["**/*.graphql"],
1361
- parser: "graphql"
1362
- }
1363
- ].map((rule) => ({
1364
- name: rule.name,
1365
- files: rule.files,
1366
- languageOptions: {
1367
- parser: parserPlain
1368
- },
1369
- rules: {
1370
- "prettier/prettier": [
1371
- "warn",
1372
- {
1373
- parser: rule.parser,
1374
- quoteProps: "consistent",
1375
- ...options
1376
- }
1377
- ]
1378
- }
1379
- }));
1380
- return [
1381
- {
1382
- name: "eslint/prettier/setup",
1383
- plugins: {
1384
- prettier: pluginPrettier
1385
- }
1386
- },
1387
- {
1388
- name: "eslint/prettier/rules",
1389
- ignores: [GLOB_TOML],
1390
- rules: {
1391
- // disable rules with prettier conflicts
1392
- ...configPrettier.rules,
1393
- // eslint-plugin-prettier recommended rules
1394
- ...{
1395
- "prettier/prettier": "error",
1396
- "arrow-body-style": "off",
1397
- "prefer-arrow-callback": "off"
1398
- },
1399
- "prettier/prettier": [
1400
- "warn",
1401
- {
1402
- plugins: tailwindcss2 ? ["prettier-plugin-tailwindcss"] : [],
1403
- quoteProps: "consistent",
1404
- ...options
1405
- }
1406
- ]
1407
- }
1408
- },
1409
- ...PlainFileRules
1410
- ];
1411
- };
1412
-
1413
1445
  // src/configs/react.ts
1414
1446
  async function next() {
1415
1447
  const pluginNext = await interopDefault(import("@next/eslint-plugin-next"));