js-style-kit 0.1.3 → 0.1.5

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.
Files changed (57) hide show
  1. package/README.md +36 -14
  2. package/dist/{chunk-LGB33CUY.js → chunk-254VVGLB.js} +2 -2
  3. package/dist/{chunk-OPQZGCVL.js → chunk-3NAB7PYG.js} +2 -2
  4. package/dist/{chunk-VWKQSLJR.js → chunk-436YRRJR.js} +35 -9
  5. package/dist/chunk-436YRRJR.js.map +1 -0
  6. package/dist/{chunk-SIH4WAXK.js → chunk-43MH6BR2.js} +2 -2
  7. package/dist/chunk-KSSFLTRQ.js +34 -0
  8. package/dist/chunk-KSSFLTRQ.js.map +1 -0
  9. package/dist/{chunk-VF7D6J7C.js → chunk-KVRY4Z5V.js} +2 -2
  10. package/dist/{chunk-Y4XKZK6J.js → chunk-LQQAQ4PJ.js} +73 -38
  11. package/dist/chunk-LQQAQ4PJ.js.map +1 -0
  12. package/dist/{chunk-3JDYGS77.js → chunk-N3RZA2FB.js} +2 -2
  13. package/dist/{chunk-GBJI557O.js → chunk-RBMRMMJZ.js} +2 -2
  14. package/dist/{chunk-XXWXCIGZ.js → chunk-SFG5KNOI.js} +3 -2
  15. package/dist/{chunk-XXWXCIGZ.js.map → chunk-SFG5KNOI.js.map} +1 -1
  16. package/dist/{chunk-IZXVPZVW.js → chunk-VEO5AWMY.js} +2 -2
  17. package/dist/{chunk-HLX2OWWB.js → chunk-YNIBJXJY.js} +2 -2
  18. package/dist/chunk-ZQ3U2JXO.js +64 -0
  19. package/dist/chunk-ZQ3U2JXO.js.map +1 -0
  20. package/dist/eslint/base/config.js +2 -2
  21. package/dist/eslint/constants.d.ts +1 -0
  22. package/dist/eslint/constants.js +1 -1
  23. package/dist/eslint/ignores.js +2 -2
  24. package/dist/eslint/index.d.ts +14 -2
  25. package/dist/eslint/index.js +12 -10
  26. package/dist/eslint/index.test.js +85 -23
  27. package/dist/eslint/index.test.js.map +1 -1
  28. package/dist/eslint/jsdoc/config.js +2 -2
  29. package/dist/eslint/perfectionist/config.js +2 -2
  30. package/dist/eslint/prefer-arrow-function/config.js +2 -2
  31. package/dist/eslint/react/config.js +2 -2
  32. package/dist/eslint/react-compiler/config.js +2 -2
  33. package/dist/eslint/typescript/config.js +2 -2
  34. package/dist/eslint/vitest/config.d.ts +20 -0
  35. package/dist/eslint/vitest/config.js +10 -0
  36. package/dist/eslint/vitest/config.js.map +1 -0
  37. package/dist/eslint/vitest/config.test.d.ts +2 -0
  38. package/dist/eslint/vitest/config.test.js +72 -0
  39. package/dist/eslint/vitest/config.test.js.map +1 -0
  40. package/dist/eslint/vitest/rules.d.ts +19 -0
  41. package/dist/eslint/vitest/rules.js +8 -0
  42. package/dist/eslint/vitest/rules.js.map +1 -0
  43. package/dist/index.d.ts +1 -1
  44. package/dist/index.js +12 -10
  45. package/dist/prettier/index.test.js +21 -19
  46. package/dist/prettier/index.test.js.map +1 -1
  47. package/package.json +6 -5
  48. package/dist/chunk-VWKQSLJR.js.map +0 -1
  49. package/dist/chunk-Y4XKZK6J.js.map +0 -1
  50. /package/dist/{chunk-LGB33CUY.js.map → chunk-254VVGLB.js.map} +0 -0
  51. /package/dist/{chunk-OPQZGCVL.js.map → chunk-3NAB7PYG.js.map} +0 -0
  52. /package/dist/{chunk-SIH4WAXK.js.map → chunk-43MH6BR2.js.map} +0 -0
  53. /package/dist/{chunk-VF7D6J7C.js.map → chunk-KVRY4Z5V.js.map} +0 -0
  54. /package/dist/{chunk-3JDYGS77.js.map → chunk-N3RZA2FB.js.map} +0 -0
  55. /package/dist/{chunk-GBJI557O.js.map → chunk-RBMRMMJZ.js.map} +0 -0
  56. /package/dist/{chunk-IZXVPZVW.js.map → chunk-VEO5AWMY.js.map} +0 -0
  57. /package/dist/{chunk-HLX2OWWB.js.map → chunk-YNIBJXJY.js.map} +0 -0
package/README.md CHANGED
@@ -1,19 +1,29 @@
1
- ![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/drake-nathan/js-style-kit?labelColor=171717&color=FF570A&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit%20Reviews)
2
-
3
1
  # `js-style-kit`
4
2
 
5
3
  A zero-configuration style guide for ESLint and Prettier that provides sensible default settings and flexible configuration options.
6
4
 
7
- ## Features
5
+ [![CI](https://github.com/drake-nathan/js-style-kit/actions/workflows/ci.yaml/badge.svg)](https://github.com/drake-nathan/js-style-kit/actions/workflows/ci.yaml)
6
+ [![Release](https://github.com/drake-nathan/js-style-kit/actions/workflows/release.yaml/badge.svg)](https://github.com/drake-nathan/js-style-kit/actions/workflows/release.yaml)
7
+ [![npm version](https://img.shields.io/npm/v/js-style-kit.svg)](https://www.npmjs.com/package/js-style-kit)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+ [![codecov](https://codecov.io/gh/drake-nathan/js-style-kit/graph/badge.svg?token=C57D67JAE0)](https://codecov.io/gh/drake-nathan/js-style-kit)
10
+ ![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/drake-nathan/js-style-kit?labelColor=5C5C5C&color=FF570A&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit%20Reviews)
11
+
12
+ ## Overview
13
+
14
+ JS Style Kit is a comprehensive, batteries-included linting and formatting solution for modern JavaScript and TypeScript projects.
8
15
 
9
16
  - ✅ All dependencies included (ESLint, Prettier, plugins) - no need to install extras
17
+ - ✅ ESLint v9 flat config
10
18
  - ✅ TypeScript support out of the box
11
19
  - ✅ Optional React and React Compiler support
12
- - ✅ JSDoc validation with configurable requirements
20
+ - ✅ JSDoc validation with configurable requirements for libraries
13
21
  - ✅ Automatic import, prop, and object sorting with Perfectionist
14
22
  - ✅ Tailwind CSS support for Prettier
15
23
  - ✅ Modern ESM-only package
16
24
 
25
+ > **Note:** This is very much a work in progress. I want to know what configuration changes you make, so please open an issue!
26
+
17
27
  ## Requirements
18
28
 
19
29
  - Node.js v20.11.0 or higher
@@ -70,8 +80,7 @@ export default eslintConfig({
70
80
  functionStyle: "arrow", // Controls function style: "arrow", "declaration", "expression", or "off"
71
81
  ignores: [], // Additional paths to ignore (node_modules and dist already excluded)
72
82
  jsdoc: { requireJsdoc: false }, // JSDoc configuration or false to disable
73
- react: false, // Whether to include React rules
74
- reactCompiler: undefined, // When react is true, controls React compiler rules
83
+ react: false, // Whether to include React rules, see below for options
75
84
  sorting: true, // Whether to include sorting rules from Perfectionist
76
85
  typescript: true, // Boolean or string path to tsconfig.json
77
86
  });
@@ -112,16 +121,18 @@ typescript: "./tsconfig.json";
112
121
 
113
122
  #### React Configuration
114
123
 
115
- React support is disabled by default:
124
+ React support is disabled by default.
116
125
 
117
126
  ```js
118
- // Enable React support
127
+ // `true` enables standard react rules, react hook rules, and react compiler
119
128
  react: true
120
129
 
121
- // With React enabled, React Compiler is automatically included
122
- // Disable React Compiler explicitly:
123
- react: true,
124
- reactCompiler: false
130
+ // you can also pass an object to control react compiler and next support
131
+ react: {
132
+ reactCompiler: false,
133
+ next: true
134
+ }
135
+ // next simply adds ".next" to the ignores array, but I plan add the next plugin in the future
125
136
  ```
126
137
 
127
138
  #### JSDoc Configuration
@@ -157,7 +168,7 @@ import { eslintConfig } from "js-style-kit";
157
168
  export default eslintConfig(
158
169
  {
159
170
  // Base configuration options
160
- typescript: "./tsconfig.json",
171
+ typescript: "tsconfig.eslint.json",
161
172
  react: true,
162
173
  },
163
174
  // Additional custom ESLint configuration objects
@@ -197,6 +208,17 @@ export default prettierConfig();
197
208
 
198
209
  > **Note:** If you're not using `"type": "module"` in your package.json, name your file `prettier.config.mjs` instead.
199
210
 
211
+ Setup your `package.json` commands:
212
+
213
+ ```json
214
+ {
215
+ "scripts": {
216
+ "format": "prettier --write .",
217
+ "format:check": "prettier --check ." // run this one in your CI
218
+ }
219
+ }
220
+ ```
221
+
200
222
  ### Configuration Options
201
223
 
202
224
  The `prettierConfig()` function accepts a configuration object with the following options:
@@ -294,7 +316,7 @@ import { eslintConfig } from "js-style-kit";
294
316
 
295
317
  export default eslintConfig(
296
318
  {
297
- typescript: "./tsconfig.json",
319
+ typescript: "tsconfig.eslint.json",
298
320
  react: true,
299
321
  jsdoc: { requireJsdoc: true },
300
322
  functionStyle: "arrow",
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-XCPOAYGQ.js";
4
4
  import {
5
5
  configNames
6
- } from "./chunk-XXWXCIGZ.js";
6
+ } from "./chunk-SFG5KNOI.js";
7
7
 
8
8
  // src/eslint/jsdoc/config.ts
9
9
  import jsdoc from "eslint-plugin-jsdoc";
@@ -18,4 +18,4 @@ var jsdocConfig = (requireJsdoc = false, typescript = true) => ({
18
18
  export {
19
19
  jsdocConfig
20
20
  };
21
- //# sourceMappingURL=chunk-LGB33CUY.js.map
21
+ //# sourceMappingURL=chunk-254VVGLB.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  configNames
3
- } from "./chunk-XXWXCIGZ.js";
3
+ } from "./chunk-SFG5KNOI.js";
4
4
 
5
5
  // src/eslint/prefer-arrow-function/config.ts
6
6
  import preferArrowFunctions from "eslint-plugin-prefer-arrow-functions";
@@ -23,4 +23,4 @@ var preferArrowFunctionConfig = () => ({
23
23
  export {
24
24
  preferArrowFunctionConfig
25
25
  };
26
- //# sourceMappingURL=chunk-OPQZGCVL.js.map
26
+ //# sourceMappingURL=chunk-3NAB7PYG.js.map
@@ -1,27 +1,30 @@
1
+ import {
2
+ vitestConfig
3
+ } from "./chunk-KSSFLTRQ.js";
1
4
  import {
2
5
  preferArrowFunctionConfig
3
- } from "./chunk-OPQZGCVL.js";
6
+ } from "./chunk-3NAB7PYG.js";
4
7
  import {
5
8
  reactEslintConfig
6
- } from "./chunk-SIH4WAXK.js";
9
+ } from "./chunk-43MH6BR2.js";
7
10
  import {
8
11
  reactCompilerEslintConfig
9
- } from "./chunk-GBJI557O.js";
12
+ } from "./chunk-RBMRMMJZ.js";
10
13
  import {
11
14
  tseslintConfig
12
- } from "./chunk-IZXVPZVW.js";
15
+ } from "./chunk-VEO5AWMY.js";
13
16
  import {
14
17
  baseEslintConfig
15
- } from "./chunk-VF7D6J7C.js";
18
+ } from "./chunk-KVRY4Z5V.js";
16
19
  import {
17
20
  jsdocConfig
18
- } from "./chunk-LGB33CUY.js";
21
+ } from "./chunk-254VVGLB.js";
19
22
  import {
20
23
  perfectionistConfig
21
- } from "./chunk-HLX2OWWB.js";
24
+ } from "./chunk-YNIBJXJY.js";
22
25
  import {
23
26
  ignoresConfig
24
- } from "./chunk-3JDYGS77.js";
27
+ } from "./chunk-N3RZA2FB.js";
25
28
 
26
29
  // src/eslint/index.ts
27
30
  import { isObject, isString } from "is-type-of";
@@ -31,6 +34,7 @@ var eslintConfig = ({
31
34
  jsdoc = { requireJsdoc: false },
32
35
  react = false,
33
36
  sorting = true,
37
+ testing,
34
38
  typescript = true
35
39
  } = {}, ...additionalConfigs) => {
36
40
  const configs = [
@@ -57,6 +61,28 @@ var eslintConfig = ({
57
61
  configs.push(reactCompilerEslintConfig);
58
62
  }
59
63
  }
64
+ if (testing !== false) {
65
+ const defaultTestingConfig = {
66
+ filenamePattern: "test",
67
+ files: ["**/*.{test,spec}.{ts,tsx,js,jsx}"],
68
+ itOrTest: "it",
69
+ lib: "vitest"
70
+ };
71
+ const mergedTestingConfig = {
72
+ ...defaultTestingConfig,
73
+ ...isObject(testing) ? testing : {}
74
+ };
75
+ const { filenamePattern, files, itOrTest, lib } = mergedTestingConfig;
76
+ if (lib === "vitest") {
77
+ configs.push(
78
+ vitestConfig({
79
+ filenamePattern,
80
+ files,
81
+ itOrTest
82
+ })
83
+ );
84
+ }
85
+ }
60
86
  if (sorting) {
61
87
  configs.push(perfectionistConfig);
62
88
  }
@@ -72,4 +98,4 @@ var eslintConfig = ({
72
98
  export {
73
99
  eslintConfig
74
100
  };
75
- //# sourceMappingURL=chunk-VWKQSLJR.js.map
101
+ //# sourceMappingURL=chunk-436YRRJR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/eslint/index.ts"],"sourcesContent":["import type { Linter } from \"eslint\";\n\nimport { isObject, isString } from \"is-type-of\";\n\nimport type { FunctionStyle } from \"./types.js\";\n\nimport { baseEslintConfig } from \"./base/config.js\";\nimport { ignoresConfig } from \"./ignores.js\";\nimport { jsdocConfig } from \"./jsdoc/config.js\";\nimport { perfectionistConfig } from \"./perfectionist/config.js\";\nimport { preferArrowFunctionConfig } from \"./prefer-arrow-function/config.js\";\nimport { reactCompilerEslintConfig } from \"./react-compiler/config.js\";\nimport { reactEslintConfig } from \"./react/config.js\";\nimport { tseslintConfig } from \"./typescript/config.js\";\nimport { vitestConfig } from \"./vitest/config.js\";\n\nexport interface TestingConfig {\n filenamePattern?: \"spec\" | \"test\";\n files?: string[];\n itOrTest?: \"it\" | \"test\";\n lib?: \"vitest\";\n}\n\nexport interface EslintConfigOptions {\n functionStyle?: \"off\" | FunctionStyle;\n ignores?: string[];\n jsdoc?:\n | false\n | {\n requireJsdoc?: boolean;\n };\n react?:\n | boolean\n | {\n next?: boolean | undefined;\n reactCompiler?: boolean | undefined;\n };\n sorting?: boolean;\n testing?: false | TestingConfig;\n typescript?: boolean | string;\n}\n\n/**\n * Configures ESLint based on provided options.\n *\n * @param options - The optional configuration object.\n * @param options.functionStyle - The function style to enforce. Defaults to \"arrow\".\n * @param options.ignores - Additional paths to ignore. Already excludes `node_modules` and `dist`.\n * @param options.jsdoc - Whether to include JSDoc rules. Set to false to disable, or provide an object to configure.\n * @param options.react - Whether to include React rules. When true, reactCompiler is enabled by default.\n * Can be configured with an object to control next.js support and reactCompiler.\n * @param options.sorting - Whether to include sorting rules from Perfectionist. Defaults to true.\n * @param options.testing - An object with the following properties:\n * - `filenamePattern`: One of \"spec\" or \"test\" to determine which filename pattern to use.\n * - `files`: Array of file patterns to include in the configuration.\n * - `itOrTest`: One of \"it\" or \"test\" to determine which test function to use.\n * - `lib`: One of \"vitest\" to determine which testing library to use. Jest support forthcoming.\n * @param options.typescript - Whether to include TypeScript rules. Can be a boolean or a string with path to tsconfig.\n * @param additionalConfigs - Additional ESLint config objects to be merged into the final configuration.\n * @returns An array of ESLint configuration objects.\n */\nexport const eslintConfig = (\n {\n functionStyle = \"arrow\",\n ignores = [],\n jsdoc = { requireJsdoc: false },\n react = false,\n sorting = true,\n testing,\n typescript = true,\n }: EslintConfigOptions = {},\n ...additionalConfigs: Linter.Config[]\n): Linter.Config[] => {\n const configs: Linter.Config[] = [\n ignoresConfig({\n next: isObject(react) && react.next,\n userIgnores: ignores,\n }),\n baseEslintConfig(functionStyle),\n ];\n\n if (jsdoc !== false) {\n configs.push(jsdocConfig(jsdoc.requireJsdoc ?? false));\n }\n\n if (typescript) {\n configs.push(\n ...(tseslintConfig(\n isString(typescript) ? typescript : undefined,\n ) as Linter.Config[]),\n );\n }\n\n if (react) {\n configs.push(reactEslintConfig(functionStyle, Boolean(typescript)));\n\n // Apply reactCompiler by default if react is true or if react.reactCompiler isn't explicitly false\n const shouldUseReactCompiler =\n react === true || (isObject(react) && react.reactCompiler !== false);\n\n if (shouldUseReactCompiler) {\n configs.push(reactCompilerEslintConfig);\n }\n }\n\n if (testing !== false) {\n const defaultTestingConfig: TestingConfig = {\n filenamePattern: \"test\",\n files: [\"**/*.{test,spec}.{ts,tsx,js,jsx}\"],\n itOrTest: \"it\",\n lib: \"vitest\",\n };\n\n // Merge the user's testing config with defaults\n const mergedTestingConfig: TestingConfig = {\n ...defaultTestingConfig,\n ...(isObject(testing) ? testing : {}),\n };\n\n // Destructure from the merged config\n const { filenamePattern, files, itOrTest, lib } = mergedTestingConfig;\n\n if (lib === \"vitest\") {\n configs.push(\n vitestConfig({\n filenamePattern,\n files,\n itOrTest,\n }),\n );\n }\n }\n\n if (sorting) {\n configs.push(perfectionistConfig);\n }\n\n if (functionStyle === \"arrow\") {\n configs.push(preferArrowFunctionConfig());\n }\n\n // Add any additional config objects provided by the user\n if (additionalConfigs.length > 0) {\n configs.push(...additionalConfigs);\n }\n\n return configs;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,UAAU,gBAAgB;AA2D5B,IAAM,eAAe,CAC1B;AAAA,EACE,gBAAgB;AAAA,EAChB,UAAU,CAAC;AAAA,EACX,QAAQ,EAAE,cAAc,MAAM;AAAA,EAC9B,QAAQ;AAAA,EACR,UAAU;AAAA,EACV;AAAA,EACA,aAAa;AACf,IAAyB,CAAC,MACvB,sBACiB;AACpB,QAAM,UAA2B;AAAA,IAC/B,cAAc;AAAA,MACZ,MAAM,SAAS,KAAK,KAAK,MAAM;AAAA,MAC/B,aAAa;AAAA,IACf,CAAC;AAAA,IACD,iBAAiB,aAAa;AAAA,EAChC;AAEA,MAAI,UAAU,OAAO;AACnB,YAAQ,KAAK,YAAY,MAAM,gBAAgB,KAAK,CAAC;AAAA,EACvD;AAEA,MAAI,YAAY;AACd,YAAQ;AAAA,MACN,GAAI;AAAA,QACF,SAAS,UAAU,IAAI,aAAa;AAAA,MACtC;AAAA,IACF;AAAA,EACF;AAEA,MAAI,OAAO;AACT,YAAQ,KAAK,kBAAkB,eAAe,QAAQ,UAAU,CAAC,CAAC;AAGlE,UAAM,yBACJ,UAAU,QAAS,SAAS,KAAK,KAAK,MAAM,kBAAkB;AAEhE,QAAI,wBAAwB;AAC1B,cAAQ,KAAK,yBAAyB;AAAA,IACxC;AAAA,EACF;AAEA,MAAI,YAAY,OAAO;AACrB,UAAM,uBAAsC;AAAA,MAC1C,iBAAiB;AAAA,MACjB,OAAO,CAAC,kCAAkC;AAAA,MAC1C,UAAU;AAAA,MACV,KAAK;AAAA,IACP;AAGA,UAAM,sBAAqC;AAAA,MACzC,GAAG;AAAA,MACH,GAAI,SAAS,OAAO,IAAI,UAAU,CAAC;AAAA,IACrC;AAGA,UAAM,EAAE,iBAAiB,OAAO,UAAU,IAAI,IAAI;AAElD,QAAI,QAAQ,UAAU;AACpB,cAAQ;AAAA,QACN,aAAa;AAAA,UACX;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,MAAI,SAAS;AACX,YAAQ,KAAK,mBAAmB;AAAA,EAClC;AAEA,MAAI,kBAAkB,SAAS;AAC7B,YAAQ,KAAK,0BAA0B,CAAC;AAAA,EAC1C;AAGA,MAAI,kBAAkB,SAAS,GAAG;AAChC,YAAQ,KAAK,GAAG,iBAAiB;AAAA,EACnC;AAEA,SAAO;AACT;","names":[]}
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-26SVGV32.js";
4
4
  import {
5
5
  configNames
6
- } from "./chunk-XXWXCIGZ.js";
6
+ } from "./chunk-SFG5KNOI.js";
7
7
 
8
8
  // src/eslint/react/config.ts
9
9
  import react from "eslint-plugin-react";
@@ -38,4 +38,4 @@ var reactEslintConfig = (functionStyle, typescript) => {
38
38
  export {
39
39
  reactEslintConfig
40
40
  };
41
- //# sourceMappingURL=chunk-SIH4WAXK.js.map
41
+ //# sourceMappingURL=chunk-43MH6BR2.js.map
@@ -0,0 +1,34 @@
1
+ import {
2
+ vitestRules
3
+ } from "./chunk-ZQ3U2JXO.js";
4
+ import {
5
+ configNames
6
+ } from "./chunk-SFG5KNOI.js";
7
+
8
+ // src/eslint/vitest/config.ts
9
+ import vitest from "eslint-plugin-vitest";
10
+ var vitestConfig = ({
11
+ filenamePattern,
12
+ files,
13
+ itOrTest
14
+ } = {
15
+ filenamePattern: "test",
16
+ itOrTest: "test"
17
+ }) => ({
18
+ files: files ?? ["**/*.{test,spec}.{ts,tsx,js,jsx}"],
19
+ languageOptions: {
20
+ globals: {
21
+ ...vitest.environments.env.globals
22
+ }
23
+ },
24
+ name: configNames.vitest,
25
+ plugins: {
26
+ vitest
27
+ },
28
+ rules: vitestRules({ filenamePattern, itOrTest })
29
+ });
30
+
31
+ export {
32
+ vitestConfig
33
+ };
34
+ //# sourceMappingURL=chunk-KSSFLTRQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/eslint/vitest/config.ts"],"sourcesContent":["import vitest from \"eslint-plugin-vitest\";\n\nimport type { EslintConfigObject } from \"../types.js\";\n\nimport { configNames } from \"../constants.js\";\nimport { vitestRules } from \"./rules.js\";\n\n/**\n * Creates an ESLint configuration object for Vitest.\n *\n * @param options - Configuration options\n * @param options.files - Files to include in the configuration\n * @param options.filenamePattern - \".test\" or \".spec\" filename pattern\n * @param options.itOrTest - \"it\" or \"test\"\n * @returns ESLint configuration object\n */\nexport const vitestConfig = (\n {\n filenamePattern,\n files,\n itOrTest,\n }: {\n filenamePattern?: \"spec\" | \"test\";\n files?: string[];\n itOrTest?: \"it\" | \"test\";\n } = {\n filenamePattern: \"test\",\n itOrTest: \"test\",\n },\n): EslintConfigObject => ({\n files: files ?? [\"**/*.{test,spec}.{ts,tsx,js,jsx}\"],\n languageOptions: {\n globals: {\n ...vitest.environments.env.globals,\n },\n },\n name: configNames.vitest,\n plugins: {\n vitest,\n },\n rules: vitestRules({ filenamePattern, itOrTest }),\n});\n"],"mappings":";;;;;;;;AAAA,OAAO,YAAY;AAgBZ,IAAM,eAAe,CAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF,IAII;AAAA,EACF,iBAAiB;AAAA,EACjB,UAAU;AACZ,OACwB;AAAA,EACxB,OAAO,SAAS,CAAC,kCAAkC;AAAA,EACnD,iBAAiB;AAAA,IACf,SAAS;AAAA,MACP,GAAG,OAAO,aAAa,IAAI;AAAA,IAC7B;AAAA,EACF;AAAA,EACA,MAAM,YAAY;AAAA,EAClB,SAAS;AAAA,IACP;AAAA,EACF;AAAA,EACA,OAAO,YAAY,EAAE,iBAAiB,SAAS,CAAC;AAClD;","names":[]}
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-ZOCL6XIB.js";
4
4
  import {
5
5
  configNames
6
- } from "./chunk-XXWXCIGZ.js";
6
+ } from "./chunk-SFG5KNOI.js";
7
7
 
8
8
  // src/eslint/base/config.ts
9
9
  var baseEslintConfig = (functionStyle) => ({
@@ -18,4 +18,4 @@ var baseEslintConfig = (functionStyle) => ({
18
18
  export {
19
19
  baseEslintConfig
20
20
  };
21
- //# sourceMappingURL=chunk-VF7D6J7C.js.map
21
+ //# sourceMappingURL=chunk-KVRY4Z5V.js.map
@@ -216,7 +216,7 @@ import { isatty as s } from "tty";
216
216
  var r = process.env.FORCE_TTY !== void 0 || s(1);
217
217
  var u = p(r);
218
218
 
219
- // ../../node_modules/.pnpm/@vitest+pretty-format@3.0.7/node_modules/@vitest/pretty-format/dist/index.js
219
+ // ../../node_modules/.pnpm/@vitest+pretty-format@3.0.8/node_modules/@vitest/pretty-format/dist/index.js
220
220
  function _mergeNamespaces(n, m3) {
221
221
  m3.forEach(function(e) {
222
222
  e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k2) {
@@ -2241,7 +2241,7 @@ function inspect(value, opts = {}) {
2241
2241
  return options.stylize(String(value), type3);
2242
2242
  }
2243
2243
 
2244
- // ../../node_modules/.pnpm/@vitest+utils@3.0.7/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js
2244
+ // ../../node_modules/.pnpm/@vitest+utils@3.0.8/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js
2245
2245
  var {
2246
2246
  AsymmetricMatcher,
2247
2247
  DOMCollection,
@@ -2396,7 +2396,7 @@ function getDefaultExportFromCjs2(x2) {
2396
2396
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
2397
2397
  }
2398
2398
 
2399
- // ../../node_modules/.pnpm/@vitest+utils@3.0.7/node_modules/@vitest/utils/dist/helpers.js
2399
+ // ../../node_modules/.pnpm/@vitest+utils@3.0.8/node_modules/@vitest/utils/dist/helpers.js
2400
2400
  function createSimpleStackTrace(options) {
2401
2401
  const { message = "$$stack trace error", stackTraceLimit = 1 } = options || {};
2402
2402
  const limit = Error.stackTraceLimit;
@@ -2535,7 +2535,7 @@ function isNegativeNaN(val) {
2535
2535
  return isNegative;
2536
2536
  }
2537
2537
 
2538
- // ../../node_modules/.pnpm/@vitest+utils@3.0.7/node_modules/@vitest/utils/dist/index.js
2538
+ // ../../node_modules/.pnpm/@vitest+utils@3.0.8/node_modules/@vitest/utils/dist/index.js
2539
2539
  var jsTokens_1;
2540
2540
  var hasRequiredJsTokens;
2541
2541
  function requireJsTokens() {
@@ -3006,7 +3006,7 @@ function getSafeTimers() {
3006
3006
  };
3007
3007
  }
3008
3008
 
3009
- // ../../node_modules/.pnpm/@vitest+utils@3.0.7/node_modules/@vitest/utils/dist/source-map.js
3009
+ // ../../node_modules/.pnpm/@vitest+utils@3.0.8/node_modules/@vitest/utils/dist/source-map.js
3010
3010
  var comma = ",".charCodeAt(0);
3011
3011
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
3012
3012
  var intToChar = new Uint8Array(64);
@@ -3138,7 +3138,9 @@ function extractLocation(urlLike) {
3138
3138
  }
3139
3139
  if (url.startsWith("http:") || url.startsWith("https:")) {
3140
3140
  const urlObj = new URL(url);
3141
- url = urlObj.pathname;
3141
+ urlObj.searchParams.delete("import");
3142
+ urlObj.searchParams.delete("browserv");
3143
+ url = urlObj.pathname + urlObj.hash + urlObj.search;
3142
3144
  }
3143
3145
  if (url.startsWith("/@fs/")) {
3144
3146
  const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url);
@@ -3220,7 +3222,7 @@ function parseSingleV8Stack(raw) {
3220
3222
  };
3221
3223
  }
3222
3224
 
3223
- // ../../node_modules/.pnpm/@vitest+utils@3.0.7/node_modules/@vitest/utils/dist/diff.js
3225
+ // ../../node_modules/.pnpm/@vitest+utils@3.0.8/node_modules/@vitest/utils/dist/diff.js
3224
3226
  var DIFF_DELETE = -1;
3225
3227
  var DIFF_INSERT = 1;
3226
3228
  var DIFF_EQUAL = 0;
@@ -4954,7 +4956,7 @@ function getCommonAndChangedSubstrings(diffs, op, hasCommonDiff2) {
4954
4956
  );
4955
4957
  }
4956
4958
 
4957
- // ../../node_modules/.pnpm/@vitest+utils@3.0.7/node_modules/@vitest/utils/dist/error.js
4959
+ // ../../node_modules/.pnpm/@vitest+utils@3.0.8/node_modules/@vitest/utils/dist/error.js
4958
4960
  var IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
4959
4961
  var IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
4960
4962
  function isImmutable(v) {
@@ -5181,7 +5183,7 @@ var isAbsolute2 = function(p3) {
5181
5183
  return _IS_ABSOLUTE_RE2.test(p3);
5182
5184
  };
5183
5185
 
5184
- // ../../node_modules/.pnpm/@vitest+runner@3.0.7/node_modules/@vitest/runner/dist/chunk-tasks.js
5186
+ // ../../node_modules/.pnpm/@vitest+runner@3.0.8/node_modules/@vitest/runner/dist/chunk-tasks.js
5185
5187
  function createChainable(keys2, fn2) {
5186
5188
  function create(context) {
5187
5189
  const chain2 = function(...args) {
@@ -5226,7 +5228,7 @@ function getTestName(task, separator = " > ") {
5226
5228
  return getNames(task).slice(1).join(separator);
5227
5229
  }
5228
5230
 
5229
- // ../../node_modules/.pnpm/@vitest+runner@3.0.7/node_modules/@vitest/runner/dist/index.js
5231
+ // ../../node_modules/.pnpm/@vitest+runner@3.0.8/node_modules/@vitest/runner/dist/index.js
5230
5232
  var PendingError = class extends Error {
5231
5233
  constructor(message, task, note) {
5232
5234
  super(message);
@@ -5608,10 +5610,11 @@ function createSuiteCollector(name, factory = () => {
5608
5610
  let suite2;
5609
5611
  initSuite(true);
5610
5612
  const task = function(name2 = "", options = {}) {
5613
+ var _a;
5611
5614
  const task2 = {
5612
5615
  id: "",
5613
5616
  name: name2,
5614
- suite: void 0,
5617
+ suite: (_a = collectorContext.currentSuite) == null ? void 0 : _a.suite,
5615
5618
  each: options.each,
5616
5619
  fails: options.fails,
5617
5620
  context: void 0,
@@ -5673,6 +5676,7 @@ function createSuiteCollector(name, factory = () => {
5673
5676
  type: "collector",
5674
5677
  name,
5675
5678
  mode,
5679
+ suite: suite2,
5676
5680
  options: suiteOptions,
5677
5681
  test: test22,
5678
5682
  tasks,
@@ -5685,6 +5689,7 @@ function createSuiteCollector(name, factory = () => {
5685
5689
  getHooks(suite2)[name2].push(...fn2);
5686
5690
  }
5687
5691
  function initSuite(includeLocation) {
5692
+ var _a;
5688
5693
  if (typeof suiteOptions === "number") {
5689
5694
  suiteOptions = { timeout: suiteOptions };
5690
5695
  }
@@ -5692,6 +5697,7 @@ function createSuiteCollector(name, factory = () => {
5692
5697
  id: "",
5693
5698
  type: "suite",
5694
5699
  name,
5700
+ suite: (_a = collectorContext.currentSuite) == null ? void 0 : _a.suite,
5695
5701
  mode,
5696
5702
  each,
5697
5703
  file: void 0,
@@ -5730,7 +5736,6 @@ function createSuiteCollector(name, factory = () => {
5730
5736
  suite2.file = file;
5731
5737
  suite2.tasks = allChildren;
5732
5738
  allChildren.forEach((task2) => {
5733
- task2.suite = suite2;
5734
5739
  task2.file = file;
5735
5740
  });
5736
5741
  return suite2;
@@ -5988,6 +5993,7 @@ function findTestFileStackTrace(error, each) {
5988
5993
  function getDefaultHookTimeout() {
5989
5994
  return getRunner().config.hookTimeout;
5990
5995
  }
5996
+ var CLEANUP_TIMEOUT_KEY = Symbol.for("VITEST_CLEANUP_TIMEOUT");
5991
5997
  var onTestFailed = createTestHook(
5992
5998
  "onTestFailed",
5993
5999
  (test5, handler, timeout) => {
@@ -6124,7 +6130,7 @@ function C2(e, t, n) {
6124
6130
  ), x.add(i), i;
6125
6131
  }
6126
6132
 
6127
- // ../../node_modules/.pnpm/@vitest+spy@3.0.7/node_modules/@vitest/spy/dist/index.js
6133
+ // ../../node_modules/.pnpm/@vitest+spy@3.0.8/node_modules/@vitest/spy/dist/index.js
6128
6134
  var mocks = /* @__PURE__ */ new Set();
6129
6135
  function isMockFunction(fn2) {
6130
6136
  return typeof fn2 === "function" && "_isMockFunction" in fn2 && fn2._isMockFunction;
@@ -10254,7 +10260,7 @@ function use(fn2) {
10254
10260
  }
10255
10261
  __name(use, "use");
10256
10262
 
10257
- // ../../node_modules/.pnpm/@vitest+expect@3.0.7/node_modules/@vitest/expect/dist/index.js
10263
+ // ../../node_modules/.pnpm/@vitest+expect@3.0.8/node_modules/@vitest/expect/dist/index.js
10258
10264
  var MATCHERS_OBJECT = Symbol.for("matchers-object");
10259
10265
  var JEST_MATCHERS_OBJECT = Symbol.for("$$jest-matchers-object");
10260
10266
  var GLOBAL_EXPECT = Symbol.for("expect-global");
@@ -12402,7 +12408,7 @@ var JestExtend = (chai2, utils) => {
12402
12408
  );
12403
12409
  };
12404
12410
 
12405
- // ../../node_modules/.pnpm/vitest@3.0.7_@types+debug@4.1.12_@types+node@22.13.9_jiti@1.21.7_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.js
12411
+ // ../../node_modules/.pnpm/vitest@3.0.8_@types+debug@4.1.12_@types+node@22.13.9_jiti@1.21.7_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.js
12406
12412
  var NAME_WORKER_STATE = "__vitest_worker__";
12407
12413
  function getWorkerState() {
12408
12414
  const workerState = globalThis[NAME_WORKER_STATE];
@@ -12462,13 +12468,13 @@ async function waitForImportsToResolve() {
12462
12468
  await waitForImportsToResolve();
12463
12469
  }
12464
12470
 
12465
- // ../../node_modules/.pnpm/vitest@3.0.7_@types+debug@4.1.12_@types+node@22.13.9_jiti@1.21.7_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js
12471
+ // ../../node_modules/.pnpm/vitest@3.0.8_@types+debug@4.1.12_@types+node@22.13.9_jiti@1.21.7_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js
12466
12472
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
12467
12473
  function getDefaultExportFromCjs3(x2) {
12468
12474
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
12469
12475
  }
12470
12476
 
12471
- // ../../node_modules/.pnpm/@vitest+snapshot@3.0.7/node_modules/@vitest/snapshot/dist/index.js
12477
+ // ../../node_modules/.pnpm/@vitest+snapshot@3.0.8/node_modules/@vitest/snapshot/dist/index.js
12472
12478
  var comma2 = ",".charCodeAt(0);
12473
12479
  var chars2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
12474
12480
  var intToChar2 = new Uint8Array(64);
@@ -13004,7 +13010,9 @@ function extractLocation2(urlLike) {
13004
13010
  }
13005
13011
  if (url.startsWith("http:") || url.startsWith("https:")) {
13006
13012
  const urlObj = new URL(url);
13007
- url = urlObj.pathname;
13013
+ urlObj.searchParams.delete("import");
13014
+ urlObj.searchParams.delete("browserv");
13015
+ url = urlObj.pathname + urlObj.hash + urlObj.search;
13008
13016
  }
13009
13017
  if (url.startsWith("/@fs/")) {
13010
13018
  const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url);
@@ -13080,28 +13088,40 @@ function parseSingleV8Stack2(raw) {
13080
13088
  }
13081
13089
  function parseStacktrace(stack, options = {}) {
13082
13090
  const { ignoreStackEntries = stackIgnorePatterns } = options;
13083
- let stacks = !CHROME_IE_STACK_REGEXP2.test(stack) ? parseFFOrSafariStackTrace(stack) : parseV8Stacktrace(stack);
13084
- if (ignoreStackEntries.length) {
13085
- stacks = stacks.filter(
13086
- (stack2) => !ignoreStackEntries.some((p3) => stack2.file.match(p3))
13087
- );
13088
- }
13091
+ const stacks = !CHROME_IE_STACK_REGEXP2.test(stack) ? parseFFOrSafariStackTrace(stack) : parseV8Stacktrace(stack);
13089
13092
  return stacks.map((stack2) => {
13090
13093
  var _a;
13091
- if (options.getFileName) {
13092
- stack2.file = options.getFileName(stack2.file);
13094
+ if (options.getUrlId) {
13095
+ stack2.file = options.getUrlId(stack2.file);
13093
13096
  }
13094
13097
  const map2 = (_a = options.getSourceMap) == null ? void 0 : _a.call(options, stack2.file);
13095
13098
  if (!map2 || typeof map2 !== "object" || !map2.version) {
13096
- return stack2;
13099
+ return shouldFilter(ignoreStackEntries, stack2.file) ? null : stack2;
13097
13100
  }
13098
13101
  const traceMap = new TraceMap(map2);
13099
- const { line, column } = originalPositionFor(traceMap, stack2);
13102
+ const { line, column, source, name } = originalPositionFor(traceMap, stack2);
13103
+ let file = stack2.file;
13104
+ if (source) {
13105
+ const fileUrl = stack2.file.startsWith("file://") ? stack2.file : `file://${stack2.file}`;
13106
+ const sourceRootUrl = map2.sourceRoot ? new URL(map2.sourceRoot, fileUrl) : fileUrl;
13107
+ file = new URL(source, sourceRootUrl).pathname;
13108
+ }
13109
+ if (shouldFilter(ignoreStackEntries, file)) {
13110
+ return null;
13111
+ }
13100
13112
  if (line != null && column != null) {
13101
- return { ...stack2, line, column };
13113
+ return {
13114
+ line,
13115
+ column,
13116
+ file,
13117
+ method: name || stack2.method
13118
+ };
13102
13119
  }
13103
13120
  return stack2;
13104
- });
13121
+ }).filter((s2) => s2 != null);
13122
+ }
13123
+ function shouldFilter(ignoreStackEntries, file) {
13124
+ return ignoreStackEntries.some((p3) => file.match(p3));
13105
13125
  }
13106
13126
  function parseFFOrSafariStackTrace(stack) {
13107
13127
  return stack.split("\n").map((line) => parseSingleFFOrSafariStack2(line)).filter(notNullish2);
@@ -14121,6 +14141,9 @@ var CounterMap = class extends DefaultMap {
14121
14141
  return total;
14122
14142
  }
14123
14143
  };
14144
+ function isSameStackPosition(x2, y2) {
14145
+ return x2.file === y2.file && x2.column === y2.column && x2.line === y2.line;
14146
+ }
14124
14147
  var SnapshotState = class _SnapshotState {
14125
14148
  constructor(testFilePath, snapshotPath, snapshotContent, options) {
14126
14149
  this.testFilePath = testFilePath;
@@ -14355,11 +14378,23 @@ ${JSON.stringify(
14355
14378
  }
14356
14379
  stack = ((_b = (_a = this.environment).processStackTrace) == null ? void 0 : _b.call(_a, _stack)) || _stack;
14357
14380
  stack.column--;
14358
- if (this._inlineSnapshotStacks.some((s2) => s2.file === stack.file && s2.line === stack.line && s2.column === stack.column)) {
14359
- this._inlineSnapshots = this._inlineSnapshots.filter((s2) => !(s2.file === stack.file && s2.line === stack.line && s2.column === stack.column));
14360
- throw new Error("toMatchInlineSnapshot cannot be called multiple times at the same location.");
14381
+ const snapshotsWithSameStack = this._inlineSnapshotStacks.filter((s2) => isSameStackPosition(s2, stack));
14382
+ if (snapshotsWithSameStack.length > 0) {
14383
+ this._inlineSnapshots = this._inlineSnapshots.filter((s2) => !isSameStackPosition(s2, stack));
14384
+ const differentSnapshot = snapshotsWithSameStack.find((s2) => s2.snapshot !== receivedSerialized);
14385
+ if (differentSnapshot) {
14386
+ throw Object.assign(
14387
+ new Error(
14388
+ "toMatchInlineSnapshot with different snapshots cannot be called at the same location"
14389
+ ),
14390
+ {
14391
+ actual: receivedSerialized,
14392
+ expected: differentSnapshot.snapshot
14393
+ }
14394
+ );
14395
+ }
14361
14396
  }
14362
- this._inlineSnapshotStacks.push({ ...stack, testId });
14397
+ this._inlineSnapshotStacks.push({ ...stack, testId, snapshot: receivedSerialized });
14363
14398
  }
14364
14399
  if (hasSnapshot && this._updateSnapshot === "all" || (!hasSnapshot || !snapshotIsPersisted) && (this._updateSnapshot === "new" || this._updateSnapshot === "all")) {
14365
14400
  if (this._updateSnapshot === "all") {
@@ -14580,7 +14615,7 @@ var SnapshotClient = class {
14580
14615
  }
14581
14616
  };
14582
14617
 
14583
- // ../../node_modules/.pnpm/vitest@3.0.7_@types+debug@4.1.12_@types+node@22.13.9_jiti@1.21.7_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/chunks/date.W2xKR2qe.js
14618
+ // ../../node_modules/.pnpm/vitest@3.0.8_@types+debug@4.1.12_@types+node@22.13.9_jiti@1.21.7_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/chunks/date.W2xKR2qe.js
14584
14619
  var RealDate = Date;
14585
14620
  var now2 = null;
14586
14621
  var MockDate = class _MockDate extends RealDate {
@@ -14633,7 +14668,7 @@ function resetDate() {
14633
14668
  globalThis.Date = RealDate;
14634
14669
  }
14635
14670
 
14636
- // ../../node_modules/.pnpm/vitest@3.0.7_@types+debug@4.1.12_@types+node@22.13.9_jiti@1.21.7_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/chunks/vi.DT3m61kS.js
14671
+ // ../../node_modules/.pnpm/vitest@3.0.8_@types+debug@4.1.12_@types+node@22.13.9_jiti@1.21.7_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/chunks/vi.B5EKKJdE.js
14637
14672
  var unsupported = [
14638
14673
  // .poll is meant to retry matchers until they succeed, and
14639
14674
  // snapshots will always succeed as long as the poll method doesn't throw an error
@@ -17599,7 +17634,7 @@ function getImporter(name) {
17599
17634
  return stack?.file || "";
17600
17635
  }
17601
17636
 
17602
- // ../../node_modules/.pnpm/vitest@3.0.7_@types+debug@4.1.12_@types+node@22.13.9_jiti@1.21.7_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/index.js
17637
+ // ../../node_modules/.pnpm/vitest@3.0.8_@types+debug@4.1.12_@types+node@22.13.9_jiti@1.21.7_terser@5.37.0_yaml@2.7.0/node_modules/vitest/dist/index.js
17603
17638
  var import_expect_type = __toESM(require_dist(), 1);
17604
17639
 
17605
17640
  export {
@@ -17898,4 +17933,4 @@ chai/chai.js:
17898
17933
  * @license MIT License
17899
17934
  *)
17900
17935
  */
17901
- //# sourceMappingURL=chunk-Y4XKZK6J.js.map
17936
+ //# sourceMappingURL=chunk-LQQAQ4PJ.js.map