@jimmy.codes/eslint-config 6.3.0 → 6.4.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 CHANGED
@@ -10,14 +10,14 @@
10
10
 
11
11
  A strict but practical ESLint config that works out of the box, adapts to your stack, and enforces good patterns without getting in the way. It catches real bugs, reduces ambiguity, and keeps your codebase consistent.
12
12
 
13
- - Auto-detects your stack: React, TypeScript, Astro, Next.js, Vitest, Jest, Playwright, Storybook, and TanStack Query.
14
- - Prevents real issues: Prioritizes rules that catch bugs and unsafe patterns.
15
- - Prevents confusion: Flags ambiguous code, confusing promise usage, shadowed variables, and unused exports.
16
- - Enforces consistency: Standardizes imports, naming, coding style, and testing conventions.
17
- - Fast and lightweight: Loads only what your project needs.
18
- - Zero-config start: Install it, extend it, done.
19
- - Customizable: Turn off or override rules per project or file.
20
- - Test-ready: Works with Vitest, Jest, Playwright, and Testing Library.
13
+ - **Auto-detects your stack**: React, TypeScript, Astro, Next.js, Vitest, Jest, Playwright, Storybook, and TanStack Query.
14
+ - **Prevents real issues**: Prioritizes rules that catch bugs and unsafe patterns.
15
+ - **Prevents confusion**: Flags ambiguous code, confusing promise usage, shadowed variables, and unused exports.
16
+ - **Enforces consistency**: Standardizes imports, naming, coding style, and testing conventions.
17
+ - **Fast and lightweight**: Loads only what your project needs.
18
+ - **Zero-config start**: Install it, extend it, done.
19
+ - **Customizable**: Turn off or override rules per project or file.
20
+ - **Test-ready**: Works with Vitest, Jest, Playwright, and Testing Library.
21
21
 
22
22
  ---
23
23
 
@@ -36,7 +36,7 @@ pnpm add -D @jimmy.codes/eslint-config
36
36
 
37
37
  Add this to `eslint.config.ts`:
38
38
 
39
- ```mjs
39
+ ```ts
40
40
  import { defineConfig } from "@jimmy.codes/eslint-config";
41
41
 
42
42
  export default defineConfig();
@@ -98,6 +98,29 @@ export default defineConfig({
98
98
  });
99
99
  ```
100
100
 
101
+ Or you can import [globs](src/globs.ts) for overrides instead of writing your own:
102
+
103
+ ```ts
104
+ import { GLOB_JS, GLOB_TS } from "@jimmy.codes/eslint-config/globs";
105
+
106
+ export default defineConfig({
107
+ overrides: [
108
+ {
109
+ files: [GLOB_JS],
110
+ rules: {
111
+ "prefer-spread": "error",
112
+ },
113
+ },
114
+ {
115
+ files: [GLOB_TS],
116
+ rules: {
117
+ "prefer-const": "error",
118
+ },
119
+ },
120
+ ],
121
+ });
122
+ ```
123
+
101
124
  ---
102
125
 
103
126
  ## Plugins Used
@@ -1,11 +1,11 @@
1
- import { GLOB_ASTRO } from "./constants-dep165g5.js";
1
+ import { GLOB_ASTRO } from "./globs-CRO5v7xy.js";
2
2
  import { interopDefault } from "./interop-default-D4l3hsYQ.js";
3
3
  import globals from "globals";
4
4
 
5
5
  //#region src/configs/astro.ts
6
6
  async function astroConfig() {
7
7
  const files = [GLOB_ASTRO];
8
- const { configs, parser: parserTs } = await import("typescript-eslint");
8
+ const { configs: tsConfigs, parser: tsParser } = await import("typescript-eslint");
9
9
  const [astroPlugin, astroParser, jsxA11yPlugin] = await Promise.all([
10
10
  import("eslint-plugin-astro"),
11
11
  import("astro-eslint-parser"),
@@ -23,7 +23,7 @@ async function astroConfig() {
23
23
  parser: astroParser,
24
24
  parserOptions: {
25
25
  extraFileExtensions: [".astro"],
26
- parser: parserTs
26
+ parser: tsParser
27
27
  },
28
28
  sourceType: "module"
29
29
  },
@@ -48,9 +48,13 @@ async function astroConfig() {
48
48
  },
49
49
  {
50
50
  files,
51
- languageOptions: { parserOptions: configs.disableTypeChecked.languageOptions?.parserOptions },
51
+ languageOptions: { parserOptions: {
52
+ program: null,
53
+ project: false,
54
+ projectService: false
55
+ } },
52
56
  name: "jimmy.codes/astro/disable-type-checked",
53
- rules: configs.disableTypeChecked.rules
57
+ rules: tsConfigs.disableTypeChecked.rules
54
58
  },
55
59
  {
56
60
  name: "jimmy.codes/astro/imports",
@@ -1,5 +1,30 @@
1
- //#region src/constants.ts
1
+ //#region src/globs.ts
2
2
  const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
3
+ const GLOB_JS = "**/*.?([cm])js";
4
+ const GLOB_JSX = "**/*.?([cm])jsx";
5
+ const GLOB_CJS = "**/*.cjs";
6
+ const GLOB_TS = "**/*.?([cm])ts";
7
+ const GLOB_TSX = "**/*.?([cm])tsx";
8
+ const GLOB_ASTRO = "**/*.astro";
9
+ const GLOB_TESTS = [
10
+ `**/__tests__/**/*.${GLOB_SRC_EXT}`,
11
+ `**/*.spec.${GLOB_SRC_EXT}`,
12
+ `**/*.test.${GLOB_SRC_EXT}`,
13
+ `**/*.bench.${GLOB_SRC_EXT}`,
14
+ `**/*.benchmark.${GLOB_SRC_EXT}`
15
+ ];
16
+ const GLOB_PLAYWRIGHT = [`**/e2e/**/*.spec.${GLOB_SRC_EXT}`, `**/e2e/**/*.test.${GLOB_SRC_EXT}`];
17
+ const GLOB_E2E = [
18
+ ...GLOB_PLAYWRIGHT,
19
+ `**/cypress/**/*.spec.${GLOB_SRC_EXT}`,
20
+ `**/cypress/**/*.test.${GLOB_SRC_EXT}`
21
+ ];
22
+ const GLOB_NEXTJS = [
23
+ GLOB_JS,
24
+ GLOB_JSX,
25
+ GLOB_TS,
26
+ GLOB_TSX
27
+ ];
3
28
  const GLOB_IGNORES = [
4
29
  "**/node_modules",
5
30
  "**/dist",
@@ -42,32 +67,6 @@ const GLOB_IGNORES = [
42
67
  "**/*.gen.*",
43
68
  "!.storybook"
44
69
  ];
45
- const GLOB_JS = "**/*.?([cm])js";
46
- const GLOB_JSX = "**/*.?([cm])jsx";
47
- const GLOB_TS = "**/*.?([cm])ts";
48
- const GLOB_TSX = "**/*.?([cm])tsx";
49
- const GLOB_TESTS = [
50
- `**/__tests__/**/*.${GLOB_SRC_EXT}`,
51
- `**/*.spec.${GLOB_SRC_EXT}`,
52
- `**/*.test.${GLOB_SRC_EXT}`,
53
- `**/*.bench.${GLOB_SRC_EXT}`,
54
- `**/*.benchmark.${GLOB_SRC_EXT}`
55
- ];
56
- const GLOB_PLAYWRIGHT = [`**/e2e/**/*.spec.${GLOB_SRC_EXT}`, `**/e2e/**/*.test.${GLOB_SRC_EXT}`];
57
- const GLOB_E2E = [
58
- ...GLOB_PLAYWRIGHT,
59
- `**/cypress/**/*.spec.${GLOB_SRC_EXT}`,
60
- `**/cypress/**/*.test.${GLOB_SRC_EXT}`
61
- ];
62
- const GLOB_NEXTJS = [
63
- GLOB_JS,
64
- GLOB_JSX,
65
- GLOB_TS,
66
- GLOB_TSX
67
- ];
68
- const GLOB_CJS = "**/*.cjs";
69
- const GLOB_ASTRO = "**/*.astro";
70
- const TESTING_LIBRARY_FAMILY = ["@testing-library/react"];
71
70
 
72
71
  //#endregion
73
- export { GLOB_ASTRO, GLOB_CJS, GLOB_E2E, GLOB_IGNORES, GLOB_JS, GLOB_JSX, GLOB_NEXTJS, GLOB_PLAYWRIGHT, GLOB_TESTS, GLOB_TSX, TESTING_LIBRARY_FAMILY };
72
+ export { GLOB_ASTRO, GLOB_CJS, GLOB_E2E, GLOB_IGNORES, GLOB_JS, GLOB_JSX, GLOB_NEXTJS, GLOB_PLAYWRIGHT, GLOB_TESTS, GLOB_TS, GLOB_TSX };
@@ -0,0 +1,14 @@
1
+ //#region src/globs.d.ts
2
+ declare const GLOB_JS = "**/*.?([cm])js";
3
+ declare const GLOB_JSX = "**/*.?([cm])jsx";
4
+ declare const GLOB_CJS = "**/*.cjs";
5
+ declare const GLOB_TS = "**/*.?([cm])ts";
6
+ declare const GLOB_TSX = "**/*.?([cm])tsx";
7
+ declare const GLOB_ASTRO = "**/*.astro";
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_PLAYWRIGHT: readonly ["**/e2e/**/*.spec.?([cm])[jt]s?(x)", "**/e2e/**/*.test.?([cm])[jt]s?(x)"];
10
+ 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
+ declare const GLOB_NEXTJS: readonly ["**/*.?([cm])js", "**/*.?([cm])jsx", "**/*.?([cm])ts", "**/*.?([cm])tsx"];
12
+ 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
+ //#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 };
package/dist/globs.js ADDED
@@ -0,0 +1,3 @@
1
+ import { GLOB_ASTRO, GLOB_CJS, GLOB_E2E, GLOB_IGNORES, GLOB_JS, GLOB_JSX, GLOB_NEXTJS, GLOB_PLAYWRIGHT, GLOB_TESTS, GLOB_TS, GLOB_TSX } from "./globs-CRO5v7xy.js";
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 };
@@ -1,4 +1,3 @@
1
- import { TESTING_LIBRARY_FAMILY } from "./constants-dep165g5.js";
2
1
  import { isPackageExists } from "local-pkg";
3
2
 
4
3
  //#region src/utils/has-dependency.ts
@@ -15,7 +14,7 @@ const hasJest = () => {
15
14
  return isPackageExists("jest");
16
15
  };
17
16
  const hasTestingLibrary = () => {
18
- return TESTING_LIBRARY_FAMILY.some((pkg) => {
17
+ return ["@testing-library/react"].some((pkg) => {
19
18
  return isPackageExists(pkg);
20
19
  });
21
20
  };
package/dist/index.d.ts CHANGED
@@ -14413,14 +14413,16 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
14413
14413
  //#endregion
14414
14414
  //#region src/types.d.ts
14415
14415
  type Rules = RuleOptions;
14416
- type TypedConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, "plugins"> & {
14417
- /**
14418
- * 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.
14419
- *
14420
- * @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
14421
- */
14416
+ type Base = Linter.Config<Linter.RulesRecord & Rules>;
14417
+ type MaybeReadonly<T> = Readonly<T> | T;
14418
+ type Override<T, R> = Omit<T, keyof R> & R;
14419
+ type Prettify<T> = { [K in keyof T]: T[K] } & {};
14420
+ interface LinterConfigOverrides {
14421
+ files?: MaybeReadonly<Base["files"]>;
14422
+ ignores?: MaybeReadonly<Base["ignores"]>;
14422
14423
  plugins?: Record<string, unknown>;
14423
- };
14424
+ }
14425
+ type TypedConfigItem = Prettify<Override<Base, LinterConfigOverrides>>;
14424
14426
  interface Options {
14425
14427
  /**
14426
14428
  * Are astro rules enabled?
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { GLOB_CJS, GLOB_IGNORES, GLOB_TESTS } from "./constants-dep165g5.js";
2
- import { hasAstro, hasJest, hasNext, hasPlaywright, hasReact, hasReactQuery, hasStorybook, hasTestingLibrary, hasTypescript, hasVitest } from "./has-dependency-B3Fi8OzA.js";
1
+ import { GLOB_CJS, GLOB_IGNORES, GLOB_TESTS } from "./globs-CRO5v7xy.js";
2
+ import { hasAstro, hasJest, hasNext, hasPlaywright, hasReact, hasReactQuery, hasStorybook, hasTestingLibrary, hasTypescript, hasVitest } from "./has-dependency-7vimNBSE.js";
3
3
  import globals from "globals";
4
4
  import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";
5
5
  import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
@@ -476,16 +476,16 @@ const defineConfig = async ({ astro = false, autoDetect = true, ignores = [], je
476
476
  stylisticConfig()
477
477
  ];
478
478
  const featureConfigs = await Promise.all([
479
- isTypescriptEnabled && unwrap(import("./typescript-DhqJ_65V.js")),
480
- isReactEnabled && unwrap(import("./react-CzWH0eX9.js")),
481
- isTanstackQueryEnabled && unwrap(import("./tanstack-query-DF8OWtLq.js")),
482
- isAstroEnabled && unwrap(import("./astro-CqgWkoKy.js")),
483
- isJestEnabled && unwrap(import("./jest-CzZHXxA7.js")),
484
- isVitestEnabled && unwrap(import("./vitest-J--7DiIk.js")),
485
- isTestingLibraryEnabled && unwrap(import("./testing-library-XmNQWB2F.js")),
486
- isPlaywrightEnabled && unwrap(import("./playwright-CHYoYi52.js")),
479
+ isTypescriptEnabled && unwrap(import("./typescript-B4UNt8qM.js")),
480
+ isReactEnabled && unwrap(import("./react-B3j6NZ4U.js")),
481
+ isTanstackQueryEnabled && unwrap(import("./tanstack-query-DqqVfxJs.js")),
482
+ isAstroEnabled && unwrap(import("./astro-Cc3Rxusf.js")),
483
+ isJestEnabled && unwrap(import("./jest-BhHoh4EB.js")),
484
+ isVitestEnabled && unwrap(import("./vitest-DpQEe80J.js")),
485
+ isTestingLibraryEnabled && unwrap(import("./testing-library-lJsmjyFo.js")),
486
+ isPlaywrightEnabled && unwrap(import("./playwright-Cyd4gThA.js")),
487
487
  isStorybookEnabled && unwrap(import("./storybook-BO4plVPp.js")),
488
- isNextjsEnabled && unwrap(import("./nextjs-Bh8fqE_o.js"))
488
+ isNextjsEnabled && unwrap(import("./nextjs-X6g9xH_I.js"))
489
489
  ]);
490
490
  return [
491
491
  ...baseConfigs,
@@ -1,4 +1,4 @@
1
- import { GLOB_E2E, GLOB_TESTS } from "./constants-dep165g5.js";
1
+ import { GLOB_E2E, GLOB_TESTS } from "./globs-CRO5v7xy.js";
2
2
  import { interopDefault } from "./interop-default-D4l3hsYQ.js";
3
3
 
4
4
  //#region src/rules/jest.ts
@@ -1,4 +1,4 @@
1
- import { GLOB_NEXTJS } from "./constants-dep165g5.js";
1
+ import { GLOB_NEXTJS } from "./globs-CRO5v7xy.js";
2
2
  import { interopDefault } from "./interop-default-D4l3hsYQ.js";
3
3
  import { upwarn } from "./upwarn-C7t3ub-R.js";
4
4
 
@@ -1,4 +1,4 @@
1
- import { GLOB_PLAYWRIGHT } from "./constants-dep165g5.js";
1
+ import { GLOB_PLAYWRIGHT } from "./globs-CRO5v7xy.js";
2
2
  import { interopDefault } from "./interop-default-D4l3hsYQ.js";
3
3
 
4
4
  //#region src/rules/playwright.ts
@@ -1,5 +1,5 @@
1
- import { GLOB_JSX, GLOB_TSX } from "./constants-dep165g5.js";
2
- import { hasNext, hasTypescript, hasVite } from "./has-dependency-B3Fi8OzA.js";
1
+ import { GLOB_JSX, GLOB_TSX } from "./globs-CRO5v7xy.js";
2
+ import { hasNext, hasTypescript, hasVite } from "./has-dependency-7vimNBSE.js";
3
3
  import { interopDefault } from "./interop-default-D4l3hsYQ.js";
4
4
  import { upwarn } from "./upwarn-C7t3ub-R.js";
5
5
  import globals from "globals";
@@ -1,4 +1,4 @@
1
- import { GLOB_JSX, GLOB_TSX } from "./constants-dep165g5.js";
1
+ import { GLOB_JSX, GLOB_TSX } from "./globs-CRO5v7xy.js";
2
2
  import { interopDefault } from "./interop-default-D4l3hsYQ.js";
3
3
 
4
4
  //#region src/configs/tanstack-query.ts
@@ -1,4 +1,4 @@
1
- import { GLOB_E2E, GLOB_TESTS } from "./constants-dep165g5.js";
1
+ import { GLOB_E2E, GLOB_TESTS } from "./globs-CRO5v7xy.js";
2
2
  import { interopDefault } from "./interop-default-D4l3hsYQ.js";
3
3
 
4
4
  //#region src/rules/testing-library.ts
@@ -1,4 +1,4 @@
1
- import { GLOB_JS, GLOB_JSX, GLOB_TESTS } from "./constants-dep165g5.js";
1
+ import { GLOB_JS, GLOB_JSX, GLOB_TESTS } from "./globs-CRO5v7xy.js";
2
2
 
3
3
  //#region src/rules/typescript.ts
4
4
  const disabledEslintRules = { "no-use-before-define": "off" };
@@ -47,7 +47,12 @@ async function typescriptConfig() {
47
47
  },
48
48
  {
49
49
  files: [GLOB_JS, GLOB_JSX],
50
- ...configs.disableTypeChecked
50
+ ...configs.disableTypeChecked,
51
+ languageOptions: { parserOptions: {
52
+ program: null,
53
+ project: false,
54
+ projectService: false
55
+ } }
51
56
  },
52
57
  {
53
58
  files: GLOB_TESTS,
@@ -1,4 +1,4 @@
1
- import { GLOB_E2E, GLOB_TESTS } from "./constants-dep165g5.js";
1
+ import { GLOB_E2E, GLOB_TESTS } from "./globs-CRO5v7xy.js";
2
2
  import { interopDefault } from "./interop-default-D4l3hsYQ.js";
3
3
 
4
4
  //#region src/rules/vitest.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jimmy.codes/eslint-config",
3
- "version": "6.3.0",
3
+ "version": "6.4.0",
4
4
  "description": "A simple, modern ESLint config that covers most use cases.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -24,7 +24,14 @@
24
24
  "sideEffects": false,
25
25
  "type": "module",
26
26
  "exports": {
27
- ".": "./dist/index.js"
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "default": "./dist/index.js"
30
+ },
31
+ "./globs": {
32
+ "types": "./dist/globs.d.ts",
33
+ "default": "./dist/globs.js"
34
+ }
28
35
  },
29
36
  "main": "./dist/index.js",
30
37
  "types": "./dist/index.d.ts",
@@ -33,14 +40,14 @@
33
40
  ],
34
41
  "dependencies": {
35
42
  "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
36
- "@eslint-react/eslint-plugin": "2.0.0-beta.32",
43
+ "@eslint-react/eslint-plugin": "2.0.0-beta.40",
37
44
  "@eslint/js": "^9.33.0",
38
- "@next/eslint-plugin-next": "^15.4.6",
45
+ "@next/eslint-plugin-next": "^15.5.0",
39
46
  "@stylistic/eslint-plugin": "^5.2.3",
40
47
  "@tanstack/eslint-plugin-query": "^5.83.1",
41
48
  "@types/eslint": "9.6.1",
42
- "@typescript-eslint/parser": "^8.39.1",
43
- "@typescript-eslint/utils": "^8.39.1",
49
+ "@typescript-eslint/parser": "^8.40.0",
50
+ "@typescript-eslint/utils": "^8.40.0",
44
51
  "@vitest/eslint-plugin": "^1.3.4",
45
52
  "astro-eslint-parser": "^1.2.2",
46
53
  "eslint-config-prettier": "^10.1.8",
@@ -49,7 +56,7 @@
49
56
  "eslint-plugin-import-x": "^4.16.1",
50
57
  "eslint-plugin-jest": "^29.0.1",
51
58
  "eslint-plugin-jest-dom": "^5.5.0",
52
- "eslint-plugin-jsdoc": "^54.1.0",
59
+ "eslint-plugin-jsdoc": "^54.1.1",
53
60
  "eslint-plugin-jsx-a11y": "^6.10.2",
54
61
  "eslint-plugin-n": "^17.21.3",
55
62
  "eslint-plugin-perfectionist": "^4.15.0",
@@ -62,8 +69,8 @@
62
69
  "eslint-plugin-testing-library": "^7.6.6",
63
70
  "eslint-plugin-unicorn": "^60.0.0",
64
71
  "globals": "^16.3.0",
65
- "local-pkg": "^1.1.1",
66
- "typescript-eslint": "^8.39.1"
72
+ "local-pkg": "^1.1.2",
73
+ "typescript-eslint": "^8.40.0"
67
74
  },
68
75
  "peerDependencies": {
69
76
  "eslint": "^9.10.0"