@jimmy.codes/eslint-config 4.3.1 โ 5.0.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 +22 -9
- package/dist/astro-Z5RFF624.js +71 -0
- package/dist/chunk-72FT76PY.js +9 -0
- package/dist/chunk-BJU7UEJ3.js +12 -0
- package/dist/chunk-N5KZEOXT.js +80 -0
- package/dist/chunk-OCS4JNPP.js +55 -0
- package/dist/{index.d.cts โ index.d.ts} +2484 -367
- package/dist/index.js +542 -0
- package/dist/jest-AHG2WRSU.js +72 -0
- package/dist/nextjs-RCR4GYMK.js +35 -0
- package/dist/playwright-U4PCWDYV.js +49 -0
- package/dist/react-X5DWOH4Y.js +189 -0
- package/dist/storybook-4KS3DD3C.js +37 -0
- package/dist/tanstack-query-UHBVVQ7V.js +32 -0
- package/dist/testing-library-7RTMAEOX.js +42 -0
- package/dist/typescript-IBCLQD7Q.js +85 -0
- package/dist/vitest-YI6KNRZE.js +85 -0
- package/package.json +5 -13
- package/dist/index.cjs +0 -1
- package/dist/index.d.mts +0 -15945
- package/dist/index.mjs +0 -1
package/README.md
CHANGED
|
@@ -8,16 +8,25 @@
|
|
|
8
8
|
|
|
9
9
|
> ๐ A pragmatic and opinionated [ESLint](https://eslint.org) config for modern development.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## **โจ Features**
|
|
12
|
+
|
|
13
|
+
- **๐ก Auto-detects your stack** โ Supports React, TypeScript, Astro, Next.js, Vitest, Jest, Playwright, Storybook, and TanStack Query.
|
|
14
|
+
- **โก Efficient & lightweight** โ Dynamically imports configs for better performance.
|
|
15
|
+
- **๐ ๏ธ Works out of the box** โ No manual setup required for most projects.
|
|
16
|
+
- **๐๏ธ Fully customizable** โ Override, extend, or disable rules to fit your needs.
|
|
17
|
+
- **๐ Always up to date** โ Evolves with the latest ESLint, TypeScript, and framework best practices.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## **๐ Philosophy**
|
|
12
22
|
|
|
13
23
|
A strict yet ergonomic ESLint config that ensures **clean, maintainable, and modern** JavaScript and TypeScript codebases.
|
|
14
24
|
|
|
15
|
-
- **๐ก๏ธ
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
- **๐งช
|
|
20
|
-
- **โ๏ธ Optimized React** โ Ensure predictable rendering, hook safety, and component clarity.
|
|
25
|
+
- **๐ก๏ธ Code safety first** โ Enforce patterns that prevent runtime errors and unexpected behavior.
|
|
26
|
+
- **๐ Embrace modern JavaScript** โ Prefer maintainable, expressive, and future-proof code.
|
|
27
|
+
- **โ๏ธ Optimized for performance** โ Loads only relevant configs to keep linting fast.
|
|
28
|
+
- **๐ Consistency without rigidity** โ Prioritizes structure and readability over personal opinions.
|
|
29
|
+
- **๐งช Built for testing** โ Enforces best practices for Vitest, Jest, Playwright, and Testing Library.
|
|
21
30
|
|
|
22
31
|
## ๐ ๏ธ Usage
|
|
23
32
|
|
|
@@ -28,11 +37,11 @@ A strict yet ergonomic ESLint config that ensures **clean, maintainable, and mod
|
|
|
28
37
|
|
|
29
38
|
Install the package:
|
|
30
39
|
|
|
31
|
-
```
|
|
40
|
+
```sh
|
|
32
41
|
pnpm add -D @jimmy.codes/eslint-config
|
|
33
42
|
```
|
|
34
43
|
|
|
35
|
-
Then, in your `eslint.config.
|
|
44
|
+
Then, in your `eslint.config.ts`, simply add:
|
|
36
45
|
|
|
37
46
|
```mjs
|
|
38
47
|
import { defineConfig } from "@jimmy.codes/eslint-config";
|
|
@@ -133,10 +142,14 @@ export default defineConfig({
|
|
|
133
142
|
});
|
|
134
143
|
```
|
|
135
144
|
|
|
145
|
+
---
|
|
146
|
+
|
|
136
147
|
## ๐ฌ Want to Contribute or Suggest Changes?
|
|
137
148
|
|
|
138
149
|
PRs and discussions are welcome! Open an issue if you have suggestions.
|
|
139
150
|
|
|
151
|
+
---
|
|
152
|
+
|
|
140
153
|
## โค๏ธ Credits
|
|
141
154
|
|
|
142
155
|
This config is inspired by:
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
interopDefault
|
|
3
|
+
} from "./chunk-72FT76PY.js";
|
|
4
|
+
import {
|
|
5
|
+
GLOB_ASTRO
|
|
6
|
+
} from "./chunk-N5KZEOXT.js";
|
|
7
|
+
|
|
8
|
+
// src/configs/astro.ts
|
|
9
|
+
import globals from "globals";
|
|
10
|
+
async function astroConfig() {
|
|
11
|
+
const files = [GLOB_ASTRO];
|
|
12
|
+
const { configs, parser: parserTs } = await import("typescript-eslint");
|
|
13
|
+
const [astroPlugin, astroParser, jsxA11yPlugin] = await Promise.all([
|
|
14
|
+
import("eslint-plugin-astro"),
|
|
15
|
+
import("astro-eslint-parser"),
|
|
16
|
+
interopDefault(import("eslint-plugin-jsx-a11y"))
|
|
17
|
+
]);
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
files,
|
|
21
|
+
languageOptions: {
|
|
22
|
+
globals: {
|
|
23
|
+
...globals.node,
|
|
24
|
+
Astro: false,
|
|
25
|
+
Fragment: false
|
|
26
|
+
},
|
|
27
|
+
parser: astroParser,
|
|
28
|
+
parserOptions: {
|
|
29
|
+
extraFileExtensions: [".astro"],
|
|
30
|
+
parser: parserTs
|
|
31
|
+
},
|
|
32
|
+
sourceType: "module"
|
|
33
|
+
},
|
|
34
|
+
name: "jimmy.codes/astro",
|
|
35
|
+
plugins: {
|
|
36
|
+
"astro": astroPlugin,
|
|
37
|
+
"jsx-a11y": jsxA11yPlugin
|
|
38
|
+
},
|
|
39
|
+
processor: "astro/client-side-ts",
|
|
40
|
+
rules: {
|
|
41
|
+
...jsxA11yPlugin.configs.recommended.rules,
|
|
42
|
+
"astro/missing-client-only-directive-value": "error",
|
|
43
|
+
"astro/no-conflict-set-directives": "error",
|
|
44
|
+
"astro/no-deprecated-astro-canonicalurl": "error",
|
|
45
|
+
"astro/no-deprecated-astro-fetchcontent": "error",
|
|
46
|
+
"astro/no-deprecated-astro-resolve": "error",
|
|
47
|
+
"astro/no-deprecated-getentrybyslug": "error",
|
|
48
|
+
"astro/no-exports-from-components": "off",
|
|
49
|
+
"astro/no-unused-define-vars-in-style": "error",
|
|
50
|
+
"astro/valid-compile": "error"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
files,
|
|
55
|
+
languageOptions: {
|
|
56
|
+
parserOptions: configs.disableTypeChecked.languageOptions?.parserOptions
|
|
57
|
+
},
|
|
58
|
+
name: "jimmy.codes/astro/disable-type-checked",
|
|
59
|
+
rules: configs.disableTypeChecked.rules
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: "jimmy.codes/astro/imports",
|
|
63
|
+
settings: {
|
|
64
|
+
"import-x/core-modules": ["astro:content"]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
astroConfig as default
|
|
71
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/utils/warnings-as-errors.ts
|
|
2
|
+
var warningAsErrors = (rules = {}) => {
|
|
3
|
+
return Object.fromEntries(
|
|
4
|
+
Object.entries(rules).map(([rule, option]) => {
|
|
5
|
+
return [rule, option === "warn" ? "error" : option];
|
|
6
|
+
})
|
|
7
|
+
);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
warningAsErrors
|
|
12
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// src/constants.ts
|
|
2
|
+
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
3
|
+
var GLOB_IGNORES = [
|
|
4
|
+
"**/node_modules",
|
|
5
|
+
"**/dist",
|
|
6
|
+
"**/package-lock.json",
|
|
7
|
+
"**/yarn.lock",
|
|
8
|
+
"**/pnpm-lock.yaml",
|
|
9
|
+
"**/bun.lockb",
|
|
10
|
+
"**/output",
|
|
11
|
+
"**/coverage",
|
|
12
|
+
"**/temp",
|
|
13
|
+
"**/.temp",
|
|
14
|
+
"**/tmp",
|
|
15
|
+
"**/.tmp",
|
|
16
|
+
"**/.history",
|
|
17
|
+
"**/.vitepress/cache",
|
|
18
|
+
"**/.nuxt",
|
|
19
|
+
"**/.next",
|
|
20
|
+
"**/.vercel",
|
|
21
|
+
"**/.changeset",
|
|
22
|
+
"**/.idea",
|
|
23
|
+
"**/.cache",
|
|
24
|
+
"**/.output",
|
|
25
|
+
"**/.vite-inspect",
|
|
26
|
+
"**/.yarn",
|
|
27
|
+
"**/storybook-static",
|
|
28
|
+
"**/.eslint-config-inspector",
|
|
29
|
+
"**/playwright-report",
|
|
30
|
+
"**/.astro",
|
|
31
|
+
"**/.vinxi",
|
|
32
|
+
"**/app.config.timestamp_*.js",
|
|
33
|
+
"**/CHANGELOG*.md",
|
|
34
|
+
"**/*.min.*",
|
|
35
|
+
"**/LICENSE*",
|
|
36
|
+
"**/__snapshots__",
|
|
37
|
+
"**/auto-import?(s).d.ts",
|
|
38
|
+
"**/components.d.ts",
|
|
39
|
+
"**/vite.config.ts.*.mjs",
|
|
40
|
+
"**/*.gen.*",
|
|
41
|
+
"!.storybook"
|
|
42
|
+
];
|
|
43
|
+
var GLOB_JS = "**/*.?([cm])js";
|
|
44
|
+
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
45
|
+
var GLOB_TS = "**/*.?([cm])ts";
|
|
46
|
+
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
47
|
+
var GLOB_TESTS = [
|
|
48
|
+
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
49
|
+
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
50
|
+
`**/*.test.${GLOB_SRC_EXT}`,
|
|
51
|
+
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
52
|
+
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
53
|
+
];
|
|
54
|
+
var GLOB_PLAYWRIGHT = [
|
|
55
|
+
`**/e2e/**/*.spec.${GLOB_SRC_EXT}`,
|
|
56
|
+
`**/e2e/**/*.test.${GLOB_SRC_EXT}`
|
|
57
|
+
];
|
|
58
|
+
var GLOB_E2E = [
|
|
59
|
+
...GLOB_PLAYWRIGHT,
|
|
60
|
+
`**/cypress/**/*.spec.${GLOB_SRC_EXT}`,
|
|
61
|
+
`**/cypress/**/*.test.${GLOB_SRC_EXT}`
|
|
62
|
+
];
|
|
63
|
+
var GLOB_NEXTJS = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX];
|
|
64
|
+
var GLOB_CJS = "**/*.cjs";
|
|
65
|
+
var GLOB_ASTRO = "**/*.astro";
|
|
66
|
+
var TESTING_LIBRARY_FAMILY = ["@testing-library/react"];
|
|
67
|
+
|
|
68
|
+
export {
|
|
69
|
+
GLOB_IGNORES,
|
|
70
|
+
GLOB_JS,
|
|
71
|
+
GLOB_JSX,
|
|
72
|
+
GLOB_TSX,
|
|
73
|
+
GLOB_TESTS,
|
|
74
|
+
GLOB_PLAYWRIGHT,
|
|
75
|
+
GLOB_E2E,
|
|
76
|
+
GLOB_NEXTJS,
|
|
77
|
+
GLOB_CJS,
|
|
78
|
+
GLOB_ASTRO,
|
|
79
|
+
TESTING_LIBRARY_FAMILY
|
|
80
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TESTING_LIBRARY_FAMILY
|
|
3
|
+
} from "./chunk-N5KZEOXT.js";
|
|
4
|
+
|
|
5
|
+
// src/utils/has-dependency.ts
|
|
6
|
+
import { isPackageExists } from "local-pkg";
|
|
7
|
+
var hasTypescript = () => {
|
|
8
|
+
return isPackageExists("typescript");
|
|
9
|
+
};
|
|
10
|
+
var hasReact = () => {
|
|
11
|
+
return isPackageExists("react");
|
|
12
|
+
};
|
|
13
|
+
var hasVitest = () => {
|
|
14
|
+
return isPackageExists("vitest");
|
|
15
|
+
};
|
|
16
|
+
var hasJest = () => {
|
|
17
|
+
return isPackageExists("jest");
|
|
18
|
+
};
|
|
19
|
+
var hasTestingLibrary = () => {
|
|
20
|
+
return TESTING_LIBRARY_FAMILY.some((pkg) => {
|
|
21
|
+
return isPackageExists(pkg);
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
var hasReactQuery = () => {
|
|
25
|
+
return isPackageExists("@tanstack/react-query");
|
|
26
|
+
};
|
|
27
|
+
var hasAstro = () => {
|
|
28
|
+
return isPackageExists("astro");
|
|
29
|
+
};
|
|
30
|
+
var hasPlaywright = () => {
|
|
31
|
+
return isPackageExists("@playwright/test");
|
|
32
|
+
};
|
|
33
|
+
var hasStorybook = () => {
|
|
34
|
+
return isPackageExists("storybook");
|
|
35
|
+
};
|
|
36
|
+
var hasNext = () => {
|
|
37
|
+
return isPackageExists("next");
|
|
38
|
+
};
|
|
39
|
+
var hasVite = () => {
|
|
40
|
+
return isPackageExists("vite");
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
hasTypescript,
|
|
45
|
+
hasReact,
|
|
46
|
+
hasVitest,
|
|
47
|
+
hasJest,
|
|
48
|
+
hasTestingLibrary,
|
|
49
|
+
hasReactQuery,
|
|
50
|
+
hasAstro,
|
|
51
|
+
hasPlaywright,
|
|
52
|
+
hasStorybook,
|
|
53
|
+
hasNext,
|
|
54
|
+
hasVite
|
|
55
|
+
};
|