@jimmy.codes/eslint-config 6.22.0 → 6.23.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/README.md +14 -0
- package/dist/{astro-D3Zl135N.mjs → astro-DNtOkeq5.mjs} +1 -1
- package/dist/{globs-C_yfK842.mjs → globs-uKx5b8lV.mjs} +11 -3
- package/dist/globs.d.mts +2 -1
- package/dist/globs.mjs +2 -2
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +10 -10
- package/dist/{jest-DZtYWPoX.mjs → jest-DgTHyrfz.mjs} +1 -1
- package/dist/{nextjs-DEk_ANZ4.mjs → nextjs-VPeisXpq.mjs} +1 -1
- package/dist/{playwright-CrBcE3qD.mjs → playwright-CM4et1Wx.mjs} +1 -1
- package/dist/{react-sWdvHd_J.mjs → react-DY8zODCu.mjs} +1 -1
- package/dist/{tanstack-query-D1gpzKY3.mjs → tanstack-query-DG6a41GH.mjs} +1 -1
- package/dist/{testing-library-BBWV3thw.mjs → testing-library-oE675dT3.mjs} +1 -1
- package/dist/{typescript-w0LuBIDT.mjs → typescript-CMkBsIGI.mjs} +1 -1
- package/dist/{vitest-oIUtAksi.mjs → vitest-C4QXivmM.mjs} +4 -3
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -99,6 +99,20 @@ Options:
|
|
|
99
99
|
- `'implicit'`: Use implicit global APIs (vitest config `globals: true`)
|
|
100
100
|
- `'either'`: Allow both styles (default)
|
|
101
101
|
|
|
102
|
+
#### Configure Type Testing
|
|
103
|
+
|
|
104
|
+
Indicate whether [Vitest's type testing utilities](https://vitest.dev/guide/testing-types.html) (`expectTypeOf`, `assertType`) are being used:
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
import { defineConfig } from "@jimmy.codes/eslint-config";
|
|
108
|
+
|
|
109
|
+
export default defineConfig({
|
|
110
|
+
vitest: {
|
|
111
|
+
typecheck: true,
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
102
116
|
### Override Specific Rules
|
|
103
117
|
|
|
104
118
|
```ts
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
//#region src/globs.ts
|
|
2
2
|
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
3
|
+
const GLOB_TS_EXT = "?([cm])ts";
|
|
4
|
+
const GLOB_TSX_EXT = "?([cm])tsx";
|
|
3
5
|
const GLOB_JS = "**/*.?([cm])js";
|
|
4
6
|
const GLOB_JSX = "**/*.?([cm])jsx";
|
|
5
7
|
const GLOB_CJS = "**/*.cjs";
|
|
6
|
-
const GLOB_TS =
|
|
7
|
-
const GLOB_TSX =
|
|
8
|
+
const GLOB_TS = `**/*.${GLOB_TS_EXT}`;
|
|
9
|
+
const GLOB_TSX = `**/*.${GLOB_TSX_EXT}`;
|
|
8
10
|
const GLOB_ASTRO = "**/*.astro";
|
|
9
11
|
const GLOB_TESTS = [
|
|
10
12
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
@@ -13,6 +15,12 @@ const GLOB_TESTS = [
|
|
|
13
15
|
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
14
16
|
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
15
17
|
];
|
|
18
|
+
const GLOB_TYPE_TESTS = [
|
|
19
|
+
`**/*.test-d.${GLOB_TS_EXT}`,
|
|
20
|
+
`**/*.test-d.${GLOB_TSX_EXT}`,
|
|
21
|
+
`**/*.spec-d.${GLOB_TS_EXT}`,
|
|
22
|
+
`**/*.spec-d.${GLOB_TSX_EXT}`
|
|
23
|
+
];
|
|
16
24
|
const GLOB_PLAYWRIGHT = [`**/e2e/**/*.spec.${GLOB_SRC_EXT}`, `**/e2e/**/*.test.${GLOB_SRC_EXT}`];
|
|
17
25
|
const GLOB_E2E = [
|
|
18
26
|
...GLOB_PLAYWRIGHT,
|
|
@@ -69,4 +77,4 @@ const GLOB_IGNORES = [
|
|
|
69
77
|
];
|
|
70
78
|
|
|
71
79
|
//#endregion
|
|
72
|
-
export { GLOB_JS as a, GLOB_PLAYWRIGHT as c, GLOB_TSX as d, GLOB_IGNORES as i, GLOB_TESTS as l, GLOB_CJS as n, GLOB_JSX as o, GLOB_E2E as r, GLOB_NEXTJS as s, GLOB_ASTRO as t, GLOB_TS as u };
|
|
80
|
+
export { GLOB_JS as a, GLOB_PLAYWRIGHT as c, GLOB_TSX as d, GLOB_TYPE_TESTS as f, GLOB_IGNORES as i, GLOB_TESTS as l, GLOB_CJS as n, GLOB_JSX as o, GLOB_E2E as r, GLOB_NEXTJS as s, GLOB_ASTRO as t, GLOB_TS as u };
|
package/dist/globs.d.mts
CHANGED
|
@@ -6,9 +6,10 @@ declare const GLOB_TS = "**/*.?([cm])ts";
|
|
|
6
6
|
declare const GLOB_TSX = "**/*.?([cm])tsx";
|
|
7
7
|
declare const GLOB_ASTRO = "**/*.astro";
|
|
8
8
|
declare const GLOB_TESTS: readonly ["**/__tests__/**/*.?([cm])[jt]s?(x)", "**/*.spec.?([cm])[jt]s?(x)", "**/*.test.?([cm])[jt]s?(x)", "**/*.bench.?([cm])[jt]s?(x)", "**/*.benchmark.?([cm])[jt]s?(x)"];
|
|
9
|
+
declare const GLOB_TYPE_TESTS: readonly ["**/*.test-d.?([cm])ts", "**/*.test-d.?([cm])tsx", "**/*.spec-d.?([cm])ts", "**/*.spec-d.?([cm])tsx"];
|
|
9
10
|
declare const GLOB_PLAYWRIGHT: readonly ["**/e2e/**/*.spec.?([cm])[jt]s?(x)", "**/e2e/**/*.test.?([cm])[jt]s?(x)"];
|
|
10
11
|
declare const GLOB_E2E: readonly ["**/e2e/**/*.spec.?([cm])[jt]s?(x)", "**/e2e/**/*.test.?([cm])[jt]s?(x)", "**/cypress/**/*.spec.?([cm])[jt]s?(x)", "**/cypress/**/*.test.?([cm])[jt]s?(x)"];
|
|
11
12
|
declare const GLOB_NEXTJS: readonly ["**/*.?([cm])js", "**/*.?([cm])jsx", "**/*.?([cm])ts", "**/*.?([cm])tsx"];
|
|
12
13
|
declare const GLOB_IGNORES: readonly ["**/node_modules", "**/dist", "**/package-lock.json", "**/yarn.lock", "**/pnpm-lock.yaml", "**/bun.lockb", "**/output", "**/coverage", "**/temp", "**/.temp", "**/tmp", "**/.tmp", "**/.history", "**/.vitepress/cache", "**/.nuxt", "**/.next", "**/.vercel", "**/.changeset", "**/.idea", "**/.cache", "**/.output", "**/.vite-inspect", "**/.yarn", "**/storybook-static", "**/.eslint-config-inspector", "**/playwright-report", "**/.astro", "**/.vinxi", "**/app.config.timestamp_*.js", "**/.tanstack", "**/.nitro", "**/CHANGELOG*.md", "**/*.min.*", "**/LICENSE*", "**/__snapshots__", "**/auto-import?(s).d.ts", "**/components.d.ts", "**/vite.config.ts.*.mjs", "**/*.gen.*", "!.storybook"];
|
|
13
14
|
//#endregion
|
|
14
|
-
export { GLOB_ASTRO, GLOB_CJS, GLOB_E2E, GLOB_IGNORES, GLOB_JS, GLOB_JSX, GLOB_NEXTJS, GLOB_PLAYWRIGHT, GLOB_TESTS, GLOB_TS, GLOB_TSX };
|
|
15
|
+
export { GLOB_ASTRO, GLOB_CJS, GLOB_E2E, GLOB_IGNORES, GLOB_JS, GLOB_JSX, GLOB_NEXTJS, GLOB_PLAYWRIGHT, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_TYPE_TESTS };
|
package/dist/globs.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as GLOB_JS, c as GLOB_PLAYWRIGHT, d as GLOB_TSX, i as GLOB_IGNORES, l as GLOB_TESTS, n as GLOB_CJS, o as GLOB_JSX, r as GLOB_E2E, s as GLOB_NEXTJS, t as GLOB_ASTRO, u as GLOB_TS } from "./globs-
|
|
1
|
+
import { a as GLOB_JS, c as GLOB_PLAYWRIGHT, d as GLOB_TSX, f as GLOB_TYPE_TESTS, i as GLOB_IGNORES, l as GLOB_TESTS, n as GLOB_CJS, o as GLOB_JSX, r as GLOB_E2E, s as GLOB_NEXTJS, t as GLOB_ASTRO, u as GLOB_TS } from "./globs-uKx5b8lV.mjs";
|
|
2
2
|
|
|
3
|
-
export { GLOB_ASTRO, GLOB_CJS, GLOB_E2E, GLOB_IGNORES, GLOB_JS, GLOB_JSX, GLOB_NEXTJS, GLOB_PLAYWRIGHT, GLOB_TESTS, GLOB_TS, GLOB_TSX };
|
|
3
|
+
export { GLOB_ASTRO, GLOB_CJS, GLOB_E2E, GLOB_IGNORES, GLOB_JS, GLOB_JSX, GLOB_NEXTJS, GLOB_PLAYWRIGHT, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_TYPE_TESTS };
|
package/dist/index.d.mts
CHANGED
|
@@ -15017,6 +15017,12 @@ interface VitestOptions {
|
|
|
15017
15017
|
* @default 'either'
|
|
15018
15018
|
*/
|
|
15019
15019
|
globals?: "either" | "explicit" | "implicit";
|
|
15020
|
+
/**
|
|
15021
|
+
* Indicate whether [Vitest's type testing utilities](https://vitest.dev/guide/testing-types.html) (`expectTypeOf`, `assertType`) are being used
|
|
15022
|
+
*
|
|
15023
|
+
* @default false
|
|
15024
|
+
*/
|
|
15025
|
+
typecheck?: boolean;
|
|
15020
15026
|
}
|
|
15021
15027
|
interface Options {
|
|
15022
15028
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as GLOB_IGNORES, l as GLOB_TESTS, n as GLOB_CJS } from "./globs-
|
|
1
|
+
import { i as GLOB_IGNORES, l as GLOB_TESTS, n as GLOB_CJS } from "./globs-uKx5b8lV.mjs";
|
|
2
2
|
import { a as hasReact, c as hasTestingLibrary, d as hasVitest, i as hasPlaywright, l as hasTypescript, n as hasJest, o as hasReactQuery, r as hasNext, s as hasStorybook, t as hasAstro } from "./has-dependency-BreXO1rF.mjs";
|
|
3
3
|
import gitignoreConfig from "eslint-config-flat-gitignore";
|
|
4
4
|
import globals from "globals";
|
|
@@ -504,16 +504,16 @@ const defineConfig = async ({ astro = false, autoDetect = true, gitignore = fals
|
|
|
504
504
|
stylisticConfig()
|
|
505
505
|
];
|
|
506
506
|
const featureConfigs = await Promise.all([
|
|
507
|
-
isTypescriptEnabled && unwrap(import("./typescript-
|
|
508
|
-
isReactEnabled && unwrap(import("./react-
|
|
509
|
-
isTanstackQueryEnabled && unwrap(import("./tanstack-query-
|
|
510
|
-
isAstroEnabled && unwrap(import("./astro-
|
|
511
|
-
isJestEnabled && unwrap(import("./jest-
|
|
512
|
-
isVitestEnabled && unwrap(import("./vitest-
|
|
513
|
-
isTestingLibraryEnabled && unwrap(import("./testing-library-
|
|
514
|
-
isPlaywrightEnabled && unwrap(import("./playwright-
|
|
507
|
+
isTypescriptEnabled && unwrap(import("./typescript-CMkBsIGI.mjs")),
|
|
508
|
+
isReactEnabled && unwrap(import("./react-DY8zODCu.mjs")),
|
|
509
|
+
isTanstackQueryEnabled && unwrap(import("./tanstack-query-DG6a41GH.mjs")),
|
|
510
|
+
isAstroEnabled && unwrap(import("./astro-DNtOkeq5.mjs")),
|
|
511
|
+
isJestEnabled && unwrap(import("./jest-DgTHyrfz.mjs")),
|
|
512
|
+
isVitestEnabled && unwrap(import("./vitest-C4QXivmM.mjs"), vitest),
|
|
513
|
+
isTestingLibraryEnabled && unwrap(import("./testing-library-oE675dT3.mjs")),
|
|
514
|
+
isPlaywrightEnabled && unwrap(import("./playwright-CM4et1Wx.mjs")),
|
|
515
515
|
isStorybookEnabled && unwrap(import("./storybook-CyxpG33Q.mjs")),
|
|
516
|
-
isNextjsEnabled && unwrap(import("./nextjs-
|
|
516
|
+
isNextjsEnabled && unwrap(import("./nextjs-VPeisXpq.mjs"))
|
|
517
517
|
]);
|
|
518
518
|
return [
|
|
519
519
|
...gitignore ? [gitignoreConfig({ strict: false })] : [],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as GLOB_TSX, o as GLOB_JSX } from "./globs-
|
|
1
|
+
import { d as GLOB_TSX, o as GLOB_JSX } from "./globs-uKx5b8lV.mjs";
|
|
2
2
|
import { l as hasTypescript, r as hasNext, u as hasVite } from "./has-dependency-BreXO1rF.mjs";
|
|
3
3
|
import { t as interopDefault } from "./interop-default-Bn64p66u.mjs";
|
|
4
4
|
import { t as upwarn } from "./upwarn-BWFMaOyK.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as GLOB_TESTS, r as GLOB_E2E } from "./globs-
|
|
1
|
+
import { f as GLOB_TYPE_TESTS, l as GLOB_TESTS, r as GLOB_E2E } from "./globs-uKx5b8lV.mjs";
|
|
2
2
|
import { t as interopDefault } from "./interop-default-Bn64p66u.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/rules/vitest.ts
|
|
@@ -80,11 +80,12 @@ async function vitestConfig(options) {
|
|
|
80
80
|
const vitestPlugin = await interopDefault(import("@vitest/eslint-plugin"));
|
|
81
81
|
const extractedOptions = extractOptions(options);
|
|
82
82
|
return [{
|
|
83
|
-
files: GLOB_TESTS,
|
|
83
|
+
files: [...GLOB_TESTS, ...extractedOptions?.typecheck ? GLOB_TYPE_TESTS : []],
|
|
84
84
|
ignores: GLOB_E2E,
|
|
85
85
|
...vitestPlugin.configs.recommended,
|
|
86
86
|
name: "jimmy.codes/vitest",
|
|
87
|
-
rules: await vitestRules(extractedOptions)
|
|
87
|
+
rules: await vitestRules(extractedOptions),
|
|
88
|
+
settings: { vitest: { typecheck: extractedOptions?.typecheck ?? false } }
|
|
88
89
|
}];
|
|
89
90
|
}
|
|
90
91
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jimmy.codes/eslint-config",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.23.0",
|
|
4
4
|
"description": "A simple, modern ESLint config that covers most use cases.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -63,13 +63,13 @@
|
|
|
63
63
|
"eslint-plugin-perfectionist": "^4.15.1",
|
|
64
64
|
"eslint-plugin-playwright": "^2.3.0",
|
|
65
65
|
"eslint-plugin-react-compiler": "19.1.0-rc.2",
|
|
66
|
-
"eslint-plugin-react-dom": "^2.3.
|
|
66
|
+
"eslint-plugin-react-dom": "^2.3.9",
|
|
67
67
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
68
|
-
"eslint-plugin-react-hooks-extra": "^2.3.
|
|
69
|
-
"eslint-plugin-react-naming-convention": "^2.3.
|
|
68
|
+
"eslint-plugin-react-hooks-extra": "^2.3.9",
|
|
69
|
+
"eslint-plugin-react-naming-convention": "^2.3.9",
|
|
70
70
|
"eslint-plugin-react-refresh": "0.4.24",
|
|
71
|
-
"eslint-plugin-react-web-api": "^2.3.
|
|
72
|
-
"eslint-plugin-react-x": "^2.3.
|
|
71
|
+
"eslint-plugin-react-web-api": "^2.3.9",
|
|
72
|
+
"eslint-plugin-react-x": "^2.3.9",
|
|
73
73
|
"eslint-plugin-regexp": "^2.10.0",
|
|
74
74
|
"eslint-plugin-storybook": "0.12.0",
|
|
75
75
|
"eslint-plugin-testing-library": "^7.13.5",
|