@jimmy.codes/eslint-config 4.3.0 → 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.
@@ -0,0 +1,189 @@
1
+ import {
2
+ hasNext,
3
+ hasVite
4
+ } from "./chunk-OCS4JNPP.js";
5
+ import {
6
+ interopDefault
7
+ } from "./chunk-72FT76PY.js";
8
+ import {
9
+ GLOB_JSX,
10
+ GLOB_TSX
11
+ } from "./chunk-N5KZEOXT.js";
12
+
13
+ // src/configs/react.ts
14
+ import globals from "globals";
15
+
16
+ // src/utils/normalize-rule-entries.ts
17
+ var toStringSeverity = (option) => {
18
+ return option === 2 ? "error" : option === 1 ? "warn" : "off";
19
+ };
20
+ var normalizeRuleEntries = (rules = {}) => {
21
+ return Object.fromEntries(
22
+ Object.entries(rules).map(([rule, option]) => {
23
+ return [
24
+ rule,
25
+ typeof option === "number" ? toStringSeverity(option) : option
26
+ ];
27
+ })
28
+ );
29
+ };
30
+
31
+ // src/rules/react.ts
32
+ var nextAllowedExportNames = [
33
+ "dynamic",
34
+ "dynamicParams",
35
+ "revalidate",
36
+ "fetchCache",
37
+ "runtime",
38
+ "preferredRegion",
39
+ "maxDuration",
40
+ "config",
41
+ "generateStaticParams",
42
+ "metadata",
43
+ "generateMetadata",
44
+ "viewport",
45
+ "generateViewport"
46
+ ];
47
+ var reactRules = async () => {
48
+ const [reactPlugin, jsxA11yPlugin] = await Promise.all([
49
+ interopDefault(import("eslint-plugin-react")),
50
+ interopDefault(import("eslint-plugin-jsx-a11y"))
51
+ ]);
52
+ const isUsingNextjs = hasNext();
53
+ const isUsingVite = hasVite();
54
+ return {
55
+ ...jsxA11yPlugin.configs.recommended.rules,
56
+ ...normalizeRuleEntries(reactPlugin.configs.flat.recommended?.rules),
57
+ ...normalizeRuleEntries(reactPlugin.configs.flat["jsx-runtime"]?.rules),
58
+ "react-compiler/react-compiler": "error",
59
+ "react-hooks/exhaustive-deps": "error",
60
+ "react-hooks/rules-of-hooks": "error",
61
+ "react-refresh/only-export-components": [
62
+ "warn",
63
+ {
64
+ allowConstantExport: isUsingVite,
65
+ allowExportNames: isUsingNextjs ? nextAllowedExportNames : []
66
+ }
67
+ ],
68
+ "react/boolean-prop-naming": "off",
69
+ // revisit
70
+ "react/button-has-type": "error",
71
+ "react/checked-requires-onchange-or-readonly": "error",
72
+ "react/default-props-match-prop-types": "error",
73
+ "react/destructuring-assignment": "off",
74
+ // revisit
75
+ "react/forbid-component-props": "off",
76
+ "react/forbid-dom-props": "off",
77
+ "react/forbid-elements": "off",
78
+ "react/forbid-foreign-prop-types": "off",
79
+ "react/forbid-prop-types": "off",
80
+ "react/forward-ref-uses-ref": "error",
81
+ "react/function-component-definition": "off",
82
+ // revisit
83
+ "react/hook-use-state": "error",
84
+ "react/iframe-missing-sandbox": "error",
85
+ "react/jsx-boolean-value": ["error", "never"],
86
+ "react/jsx-curly-brace-presence": "error",
87
+ "react/jsx-filename-extension": "off",
88
+ "react/jsx-fragments": ["error", "syntax"],
89
+ "react/jsx-handler-names": "off",
90
+ "react/jsx-max-depth": "off",
91
+ "react/jsx-no-bind": "off",
92
+ // revisit
93
+ "react/jsx-no-constructed-context-values": "error",
94
+ "react/jsx-no-leaked-render": "error",
95
+ "react/jsx-no-literals": "off",
96
+ "react/jsx-no-script-url": "error",
97
+ "react/jsx-no-useless-fragment": "error",
98
+ "react/jsx-one-expression-per-line": "off",
99
+ "react/jsx-pascal-case": ["error", { allowNamespace: true }],
100
+ "react/jsx-props-no-spread-multi": "off",
101
+ "react/jsx-props-no-spreading": "off",
102
+ "react/jsx-sort-default-props": "off",
103
+ "react/jsx-sort-props": "off",
104
+ "react/no-access-state-in-setstate": "error",
105
+ "react/no-adjacent-inline-elements": "off",
106
+ "react/no-array-index-key": "off",
107
+ "react/no-arrow-function-lifecycle": "error",
108
+ "react/no-danger": "off",
109
+ "react/no-did-mount-set-state": "error",
110
+ "react/no-did-update-set-state": "error",
111
+ "react/no-invalid-html-attribute": "error",
112
+ "react/no-multi-comp": "off",
113
+ "react/no-namespace": "error",
114
+ "react/no-object-type-as-default-prop": "error",
115
+ "react/no-redundant-should-component-update": "error",
116
+ "react/no-set-state": "off",
117
+ "react/no-this-in-sfc": "error",
118
+ "react/no-typos": "error",
119
+ "react/no-unstable-nested-components": "error",
120
+ "react/no-unused-class-component-methods": "error",
121
+ "react/no-unused-prop-types": "error",
122
+ "react/no-unused-state": "error",
123
+ "react/no-will-update-set-state": "error",
124
+ "react/prefer-es6-class": "off",
125
+ "react/prefer-exact-props": "off",
126
+ "react/prefer-read-only-props": "off",
127
+ "react/prefer-stateless-function": "off",
128
+ "react/require-default-props": "off",
129
+ "react/require-optimization": "off",
130
+ "react/self-closing-comp": "error",
131
+ "react/sort-comp": "off",
132
+ "react/sort-default-props": "off",
133
+ "react/sort-prop-types": "off",
134
+ "react/state-in-constructor": "off",
135
+ "react/static-property-placement": "off",
136
+ "react/style-prop-object": "error",
137
+ "react/void-dom-elements-no-children": "error"
138
+ };
139
+ };
140
+
141
+ // src/configs/react.ts
142
+ async function reactConfig() {
143
+ const [
144
+ reactPlugin,
145
+ jsxA11yPlugin,
146
+ reactHooksPlugin,
147
+ reactRefreshPlugin,
148
+ reactCompilerPlugin
149
+ ] = await Promise.all([
150
+ interopDefault(import("eslint-plugin-react")),
151
+ interopDefault(import("eslint-plugin-jsx-a11y")),
152
+ import("eslint-plugin-react-hooks"),
153
+ interopDefault(import("eslint-plugin-react-refresh")),
154
+ import("eslint-plugin-react-compiler")
155
+ ]);
156
+ return [
157
+ {
158
+ files: [GLOB_JSX, GLOB_TSX],
159
+ languageOptions: {
160
+ globals: {
161
+ ...globals.browser
162
+ },
163
+ parserOptions: {
164
+ ecmaFeatures: {
165
+ jsx: true
166
+ },
167
+ jsxPragma: null
168
+ }
169
+ },
170
+ name: "jimmy.codes/react",
171
+ plugins: {
172
+ "jsx-a11y": jsxA11yPlugin,
173
+ "react": reactPlugin,
174
+ "react-compiler": reactCompilerPlugin,
175
+ "react-hooks": reactHooksPlugin,
176
+ "react-refresh": reactRefreshPlugin
177
+ },
178
+ rules: await reactRules(),
179
+ settings: {
180
+ react: {
181
+ version: "detect"
182
+ }
183
+ }
184
+ }
185
+ ];
186
+ }
187
+ export {
188
+ reactConfig as default
189
+ };
@@ -0,0 +1,37 @@
1
+ import {
2
+ warningAsErrors
3
+ } from "./chunk-BJU7UEJ3.js";
4
+ import {
5
+ interopDefault
6
+ } from "./chunk-72FT76PY.js";
7
+
8
+ // src/configs/storybook.ts
9
+ async function storybookConfig() {
10
+ const { configs } = await interopDefault(import("eslint-plugin-storybook"));
11
+ const [setup, storiesConfig, mainConfig] = configs["flat/recommended"];
12
+ return [
13
+ {
14
+ name: "jimmy.codes/storybook/setup",
15
+ plugins: setup?.plugins
16
+ },
17
+ {
18
+ files: storiesConfig?.files,
19
+ name: "jimmy.codes/storybook/stories-rules",
20
+ rules: {
21
+ ...warningAsErrors(storiesConfig?.rules),
22
+ "import-x/no-anonymous-default-export": "off",
23
+ "unicorn/no-anonymous-default-export": "off"
24
+ }
25
+ },
26
+ {
27
+ files: mainConfig?.files,
28
+ name: "jimmy.codes/storybook/main-rules",
29
+ rules: {
30
+ ...mainConfig?.rules
31
+ }
32
+ }
33
+ ];
34
+ }
35
+ export {
36
+ storybookConfig as default
37
+ };
@@ -0,0 +1,32 @@
1
+ import {
2
+ interopDefault
3
+ } from "./chunk-72FT76PY.js";
4
+ import {
5
+ GLOB_JSX,
6
+ GLOB_TSX
7
+ } from "./chunk-N5KZEOXT.js";
8
+
9
+ // src/configs/tanstack-query.ts
10
+ async function tanstackQueryConfig() {
11
+ const queryPlugin = await interopDefault(
12
+ import("@tanstack/eslint-plugin-query")
13
+ );
14
+ return [
15
+ {
16
+ files: [GLOB_JSX, GLOB_TSX],
17
+ name: "jimmy.codes/react/query",
18
+ plugins: {
19
+ // TODO: remove unknown conversion when Plugin type is exported by @tanstack/query
20
+ "@tanstack/query": queryPlugin
21
+ },
22
+ rules: {
23
+ "@tanstack/query/exhaustive-deps": "error",
24
+ "@tanstack/query/no-rest-destructuring": "warn",
25
+ "@tanstack/query/stable-query-client": "error"
26
+ }
27
+ }
28
+ ];
29
+ }
30
+ export {
31
+ tanstackQueryConfig as default
32
+ };
@@ -0,0 +1,42 @@
1
+ import {
2
+ interopDefault
3
+ } from "./chunk-72FT76PY.js";
4
+ import {
5
+ GLOB_E2E,
6
+ GLOB_TESTS
7
+ } from "./chunk-N5KZEOXT.js";
8
+
9
+ // src/rules/testing-library.ts
10
+ var testingLibraryRules = async () => {
11
+ const [jestDom, testingLibrary] = await Promise.all([
12
+ import("eslint-plugin-jest-dom"),
13
+ interopDefault(import("eslint-plugin-testing-library"))
14
+ ]);
15
+ return {
16
+ ...testingLibrary.configs["flat/react"].rules,
17
+ ...jestDom.configs["flat/recommended"].rules
18
+ };
19
+ };
20
+
21
+ // src/configs/testing-library.ts
22
+ async function testingLibraryConfig() {
23
+ const [jestDom, testingLibrary] = await Promise.all([
24
+ import("eslint-plugin-jest-dom"),
25
+ interopDefault(import("eslint-plugin-testing-library"))
26
+ ]);
27
+ return [
28
+ {
29
+ files: GLOB_TESTS,
30
+ ignores: GLOB_E2E,
31
+ name: "jimmy.codes/testing-library",
32
+ plugins: {
33
+ "jest-dom": jestDom,
34
+ "testing-library": testingLibrary
35
+ },
36
+ rules: await testingLibraryRules()
37
+ }
38
+ ];
39
+ }
40
+ export {
41
+ testingLibraryConfig as default
42
+ };
@@ -0,0 +1,85 @@
1
+ import {
2
+ GLOB_JS,
3
+ GLOB_JSX,
4
+ GLOB_TESTS
5
+ } from "./chunk-N5KZEOXT.js";
6
+
7
+ // src/rules/typescript.ts
8
+ var typescriptRules = {
9
+ "@typescript-eslint/consistent-type-exports": [
10
+ "error",
11
+ { fixMixedExportsWithInlineTypeSpecifier: false }
12
+ ],
13
+ "@typescript-eslint/consistent-type-imports": [
14
+ "error",
15
+ { fixStyle: "separate-type-imports" }
16
+ ],
17
+ "@typescript-eslint/no-deprecated": "warn",
18
+ "@typescript-eslint/no-misused-promises": [
19
+ "error",
20
+ { checksVoidReturn: { attributes: false } }
21
+ ],
22
+ "@typescript-eslint/no-unused-vars": [
23
+ "error",
24
+ // https://typescript-eslint.io/rules/no-unused-vars/#benefits-over-typescript
25
+ {
26
+ args: "all",
27
+ argsIgnorePattern: "^_",
28
+ caughtErrors: "all",
29
+ caughtErrorsIgnorePattern: "^_",
30
+ destructuredArrayIgnorePattern: "^_",
31
+ ignoreRestSiblings: true,
32
+ varsIgnorePattern: "^_"
33
+ }
34
+ ],
35
+ "@typescript-eslint/no-use-before-define": [
36
+ "error",
37
+ {
38
+ allowNamedExports: false,
39
+ classes: false,
40
+ functions: false,
41
+ variables: true
42
+ }
43
+ ],
44
+ "@typescript-eslint/restrict-template-expressions": [
45
+ "error",
46
+ { allowNumber: true }
47
+ ],
48
+ "no-use-before-define": "off"
49
+ };
50
+
51
+ // src/configs/typescript.ts
52
+ async function typescriptConfig() {
53
+ const { configs } = await import("typescript-eslint");
54
+ return [
55
+ ...configs.strictTypeChecked,
56
+ ...configs.stylisticTypeChecked.filter((config) => {
57
+ return config.name === "typescript-eslint/stylistic-type-checked";
58
+ }),
59
+ {
60
+ languageOptions: {
61
+ parserOptions: {
62
+ projectService: true,
63
+ tsconfigRootDir: process.cwd()
64
+ }
65
+ },
66
+ name: "jimmy.codes/typescript",
67
+ rules: typescriptRules
68
+ },
69
+ {
70
+ files: [GLOB_JS, GLOB_JSX],
71
+ ...configs.disableTypeChecked
72
+ },
73
+ {
74
+ files: GLOB_TESTS,
75
+ name: "jimmy.codes/typescript/testing",
76
+ rules: {
77
+ "@typescript-eslint/no-unsafe-argument": "off",
78
+ "@typescript-eslint/no-unsafe-assignment": "off"
79
+ }
80
+ }
81
+ ];
82
+ }
83
+ export {
84
+ typescriptConfig as default
85
+ };
@@ -0,0 +1,85 @@
1
+ import {
2
+ interopDefault
3
+ } from "./chunk-72FT76PY.js";
4
+ import {
5
+ GLOB_E2E,
6
+ GLOB_TESTS
7
+ } from "./chunk-N5KZEOXT.js";
8
+
9
+ // src/rules/vitest.ts
10
+ var vitestRules = async () => {
11
+ const vitestPlugin = await interopDefault(import("@vitest/eslint-plugin"));
12
+ return {
13
+ ...vitestPlugin.configs.recommended.rules,
14
+ "vitest/consistent-test-it": [
15
+ "error",
16
+ {
17
+ fn: "test",
18
+ withinDescribe: "it"
19
+ }
20
+ ],
21
+ "vitest/no-alias-methods": "error",
22
+ "vitest/no-commented-out-tests": "error",
23
+ "vitest/no-conditional-in-test": "error",
24
+ // "vitest/no-confusing-set-timeout": "error", // missing
25
+ // "vitest/no-deprecated-functions": "error", // missing
26
+ "vitest/no-disabled-tests": "warn",
27
+ "vitest/no-duplicate-hooks": "error",
28
+ // "vitest/no-export": "error", // missing
29
+ "vitest/no-focused-tests": "error",
30
+ "vitest/no-hooks": "off",
31
+ "vitest/no-identical-title": "error",
32
+ "vitest/no-interpolation-in-snapshots": "error",
33
+ // "vitest/no-jasmine-globals": "error", // missing
34
+ "vitest/no-large-snapshots": "off",
35
+ "vitest/no-mocks-import": "error",
36
+ "vitest/no-restricted-matchers": "off",
37
+ "vitest/no-restricted-vi-methods": "off",
38
+ "vitest/no-standalone-expect": "error",
39
+ "vitest/no-test-prefixes": "error",
40
+ "vitest/no-test-return-statement": "error",
41
+ // "vitest/no-untyped-mock-factory": "off", // requires typescript
42
+ "vitest/prefer-called-with": "error",
43
+ "vitest/prefer-comparison-matcher": "error",
44
+ "vitest/prefer-each": "error",
45
+ "vitest/prefer-equality-matcher": "error",
46
+ "vitest/prefer-expect-assertions": "off",
47
+ "vitest/prefer-expect-resolves": "error",
48
+ "vitest/prefer-hooks-in-order": "error",
49
+ "vitest/prefer-hooks-on-top": "error",
50
+ "vitest/prefer-lowercase-title": "off",
51
+ "vitest/prefer-mock-promise-shorthand": "error",
52
+ "vitest/prefer-snapshot-hint": "error",
53
+ "vitest/prefer-spy-on": "off",
54
+ "vitest/prefer-strict-boolean-matchers": "error",
55
+ "vitest/prefer-strict-equal": "error",
56
+ "vitest/prefer-to-be": "error",
57
+ "vitest/prefer-to-contain": "error",
58
+ "vitest/prefer-to-have-length": "error",
59
+ "vitest/prefer-todo": "warn",
60
+ "vitest/require-hook": "error",
61
+ "vitest/require-to-throw-message": "error",
62
+ "vitest/require-top-level-describe": "off",
63
+ // "vitest/unbound-method": "off", // requires typescript, missing https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/unbound-method.md
64
+ "vitest/valid-expect": "error",
65
+ "vitest/valid-expect-in-promise": "error",
66
+ "vitest/valid-title": "error"
67
+ };
68
+ };
69
+
70
+ // src/configs/vitest.ts
71
+ async function vitestConfig() {
72
+ const vitestPlugin = await interopDefault(import("@vitest/eslint-plugin"));
73
+ return [
74
+ {
75
+ files: GLOB_TESTS,
76
+ ignores: GLOB_E2E,
77
+ ...vitestPlugin.configs.recommended,
78
+ name: "jimmy.codes/vitest",
79
+ rules: await vitestRules()
80
+ }
81
+ ];
82
+ }
83
+ export {
84
+ vitestConfig as default
85
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jimmy.codes/eslint-config",
3
- "version": "4.3.0",
4
- "description": "another opinionated eslint config",
3
+ "version": "5.0.0",
4
+ "description": "A pragmatic and opinionated ESLint config for modern development.",
5
5
  "keywords": [
6
6
  "eslint",
7
7
  "eslint-config",
@@ -15,18 +15,10 @@
15
15
  "sideEffects": false,
16
16
  "type": "module",
17
17
  "exports": {
18
- "require": {
19
- "types": "./dist/index.d.cts",
20
- "default": "./dist/index.cjs"
21
- },
22
- "import": {
23
- "types": "./dist/index.d.mts",
24
- "default": "./dist/index.mjs"
25
- }
18
+ ".": "./dist/index.js"
26
19
  },
27
- "main": "./dist/index.cjs",
28
- "module": "./dist/index.mjs",
29
- "types": "./dist/index.d.cts",
20
+ "main": "./dist/index.js",
21
+ "types": "./dist/index.d.ts",
30
22
  "files": [
31
23
  "dist"
32
24
  ],
@@ -46,7 +38,7 @@
46
38
  "eslint-plugin-import-x": "^4.6.1",
47
39
  "eslint-plugin-jest": "^28.11.0",
48
40
  "eslint-plugin-jest-dom": "^5.5.0",
49
- "eslint-plugin-jsdoc": "^50.6.3",
41
+ "eslint-plugin-jsdoc": "^50.6.6",
50
42
  "eslint-plugin-jsx-a11y": "^6.10.2",
51
43
  "eslint-plugin-n": "^17.15.1",
52
44
  "eslint-plugin-perfectionist": "^4.9.0",
package/dist/index.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";var ee=Object.create;var d=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var r=(e,t)=>d(e,"name",{value:t,configurable:!0});var ne=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of te(t))!se.call(e,l)&&l!==o&&d(e,l,{get:()=>t[l],enumerable:!(i=re(t,l))||i.enumerable});return e};var s=(e,t,o)=>(o=e!=null?ee(oe(e)):{},ne(t||!e||!e.__esModule?d(o,"default",{value:e,enumerable:!0}):o,e));Object.defineProperty(exports,"__esModule",{value:!0});var g=require("globals"),f=require("typescript-eslint"),v=require("@eslint-community/eslint-plugin-eslint-comments/configs"),ie=require("eslint-import-resolver-typescript"),y=require("eslint-plugin-import-x"),b=require("eslint-plugin-n"),ae=require("@eslint/js"),w=require("eslint-plugin-jsdoc"),k=require("eslint-plugin-perfectionist"),ce=require("eslint-config-prettier/flat"),a=require("local-pkg"),le=require("eslint-plugin-regexp"),P=require("eslint-plugin-unicorn");function pe(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(o){if(o!=="default"){var i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:r(function(){return e[o]},"get")})}}),t.default=e,Object.freeze(t)}r(pe,"_interopNamespaceDefault");var E=pe(le);const p="?([cm])[jt]s?(x)",fe=["**/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","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts","**/vite.config.ts.*.mjs","**/*.gen.*","!.storybook"],C="**/*.?([cm])js",m="**/*.?([cm])jsx",ue="**/*.?([cm])ts",x="**/*.?([cm])tsx",u=[`**/__tests__/**/*.${p}`,`**/*.spec.${p}`,`**/*.test.${p}`,`**/*.bench.${p}`,`**/*.benchmark.${p}`],q=[`**/e2e/**/*.spec.${p}`,`**/e2e/**/*.test.${p}`],j=[...q,`**/cypress/**/*.spec.${p}`,`**/cypress/**/*.test.${p}`],me=[C,m,ue,x],de="**/*.cjs",ge="**/*.astro",ye=["@testing-library/react"],n=r(async e=>{const t=await e;return t.default??t},"interopDefault"),xe=r(async()=>{const e=[ge],[t,o,i]=await Promise.all([import("eslint-plugin-astro"),import("astro-eslint-parser"),n(import("eslint-plugin-jsx-a11y"))]);return[{files:e,languageOptions:{globals:{...g.node,Astro:!1,Fragment:!1},parser:o,parserOptions:{extraFileExtensions:[".astro"],parser:f.parser},sourceType:"module"},name:"jimmy.codes/astro",plugins:{astro:t,"jsx-a11y":i},processor:"astro/client-side-ts",rules:{...i.configs.recommended.rules,"astro/missing-client-only-directive-value":"error","astro/no-conflict-set-directives":"error","astro/no-deprecated-astro-canonicalurl":"error","astro/no-deprecated-astro-fetchcontent":"error","astro/no-deprecated-astro-resolve":"error","astro/no-deprecated-getentrybyslug":"error","astro/no-exports-from-components":"off","astro/no-unused-define-vars-in-style":"error","astro/valid-compile":"error"}},{files:e,languageOptions:{parserOptions:f.configs.disableTypeChecked.languageOptions?.parserOptions},name:"jimmy.codes/astro/disable-type-checked",rules:f.configs.disableTypeChecked.rules},{name:"jimmy.codes/astro/imports",settings:{"import-x/core-modules":["astro:content"]}}]},"astroConfig"),je=r(()=>[{files:[de],languageOptions:{globals:g.commonjs},name:"jimmy.codes/commonjs"}],"commonjsConfig"),he={...v.recommended.rules,"@eslint-community/eslint-comments/no-unused-disable":"off","@eslint-community/eslint-comments/require-description":"error"},ve=r(()=>[{...v.recommended,name:"jimmy.codes/eslint-comments",rules:he}],"eslintCommentsConfig"),be=r(e=>[{ignores:[...fe,...e],name:"jimmy.codes/ignores"}],"ignoresConfig"),we={...y.configs.recommended.rules,"import-x/consistent-type-specifier-style":["error","prefer-top-level"],"import-x/extensions":["error","never",{checkTypedImports:!0,svg:"always"}],"import-x/first":"error","import-x/namespace":"off","import-x/newline-after-import":"error","import-x/no-absolute-path":"error","import-x/no-duplicates":"error","import-x/no-empty-named-blocks":"error","import-x/no-named-as-default":"error","import-x/no-named-as-default-member":"error","import-x/no-self-import":"error","import-x/no-unresolved":["error",{ignore:[String.raw`\.svg$`]}],"import-x/no-useless-path-segments":"error"},ke=r(()=>{const{rules:e,settings:t}=y.configs.typescript;return[{name:"jimmy.codes/imports/typescript",rules:e,settings:{"import-x/extensions":t["import-x/extensions"],"import-x/external-module-folders":t["import-x/external-module-folders"],"import-x/parsers":t["import-x/parsers"],"import-x/resolver-next":[ie.createTypeScriptImportResolver({alwaysTryTypes:!0})]}}]},"importsTypescriptConfig"),Pe=r(({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":y,n:b},rules:we},...e?ke():[]],"importsConfig"),Ee={"array-callback-return":["error",{allowImplicit:!0}],"arrow-body-style":["error","always"],"class-methods-use-this":"error","consistent-return":"error",curly:["error","all"],"default-case":"error","default-case-last":"error","no-console":"warn","no-implicit-coercion":"error","no-implicit-globals":"error","no-loop-func":"error","no-magic-numbers":["error",{ignore:[0,1,-1,2]}],"no-new-wrappers":"error","no-param-reassign":["error",{props:!0}],"no-promise-executor-return":"error","no-self-compare":"error","no-template-curly-in-string":"error","no-throw-literal":"error","no-unmodified-loop-condition":"error","no-unreachable-loop":"error","no-use-before-define":["error",{allowNamedExports:!1,classes:!1,functions:!0,variables:!0}],"no-useless-computed-key":"error","no-useless-constructor":"error","no-useless-rename":"error","no-useless-return":"error","no-var":"error","object-shorthand":"error","prefer-arrow-callback":"error","prefer-const":"error","prefer-destructuring":["error",{AssignmentExpression:{array:!1,object:!1},VariableDeclarator:{array:!1,object:!0}}],"prefer-object-spread":"error","prefer-rest-params":"error","prefer-spread":"error","prefer-template":"error",radix:"error","require-await":"error",strict:["error","safe"],"symbol-description":"error"},Ce={...ae.configs.recommended.rules,...Ee},qe=r(()=>[{linterOptions:{reportUnusedDisableDirectives:!0},name:"jimmy.codes/javascript",rules:Ce},{files:u,name:"jimmy.codes/javascript/testing",rules:{"no-magic-numbers":"off"}}],"javascriptConfig"),Oe=r(async()=>{const e=await n(import("eslint-plugin-jest"));return{...e.configs["flat/recommended"].rules,...e.configs["flat/style"].rules,"jest/consistent-test-it":["error",{fn:"test",withinDescribe:"it"}],"jest/expect-expect":"error","jest/no-alias-methods":"error","jest/no-commented-out-tests":"error","jest/no-conditional-in-test":"error","jest/no-confusing-set-timeout":"error","jest/no-duplicate-hooks":"error","jest/no-hooks":"off","jest/no-large-snapshots":"off","jest/no-restricted-jest-methods":"off","jest/no-restricted-matchers":"off","jest/no-test-return-statement":"error","jest/no-untyped-mock-factory":"off","jest/prefer-called-with":"error","jest/prefer-comparison-matcher":"error","jest/prefer-each":"error","jest/prefer-equality-matcher":"error","jest/prefer-expect-assertions":"off","jest/prefer-expect-resolves":"error","jest/prefer-hooks-in-order":"error","jest/prefer-hooks-on-top":"error","jest/prefer-lowercase-title":"off","jest/prefer-mock-promise-shorthand":"error","jest/prefer-snapshot-hint":"error","jest/prefer-spy-on":"off","jest/prefer-strict-equal":"error","jest/prefer-todo":"warn","jest/require-hook":"error","jest/require-to-throw-message":"error","jest/require-top-level-describe":"off","jest/unbound-method":"off"}},"jestRules"),_e=r(async()=>{const e=await n(import("eslint-plugin-jest"));return[{files:u,ignores:j,...e.configs["flat/recommended"],name:"jimmy.codes/jest",rules:await Oe()}]},"jestConfig"),Re=r(()=>({...w.configs["flat/recommended-typescript-error"].rules,"jsdoc/require-jsdoc":"off","jsdoc/require-param":"off","jsdoc/require-returns":"off","jsdoc/tag-lines":["error","always",{applyToEndTag:!1}]}),"jsdocRules"),Te=r(()=>[{...w.configs["flat/recommended-typescript-error"],name:"jimmy.codes/jsdoc",rules:Re()}],"jsdocConfig"),O=r((e={})=>Object.fromEntries(Object.entries(e).map(([t,o])=>[t,o==="warn"?"error":o])),"warningAsErrors"),Se=r(async()=>{const e=await n(import("@next/eslint-plugin-next"));return O(e.configs.recommended.rules)},"nextjsRules"),Le=r(async()=>{const e=await n(import("@next/eslint-plugin-next"));return[{files:me,name:"jimmy.codes/nextjs",plugins:{"@next/next":e},rules:await Se()}]},"nextjsConfig"),Ge={"n/no-process-exit":"off","n/prefer-node-protocol":"error"},Ae=r(()=>[{name:"jimmy.codes/node",plugins:{n:b},rules:Ge}],"nodeConfig"),Be={...k.configs["recommended-natural"].rules,"perfectionist/sort-imports":["error",{customGroups:{type:{},value:{}},environment:"node",groups:["side-effect-style","builtin","type","external","internal-type","internal",["parent-type","sibling-type","index-type"],["parent","sibling","index"],"object","style","unknown"],internalPattern:["^~/.*","^@/.*"],order:"asc",type:"natural"}],"perfectionist/sort-modules":"off"},Ie=r(()=>[{name:"jimmy.codes/perfectionist",plugins:{perfectionist:k},rules:Be}],"perfectionistConfig"),Ne=r(async()=>({...(await n(import("eslint-plugin-playwright"))).configs["flat/recommended"].rules,"playwright/expect-expect":"error","playwright/max-nested-describe":"error","playwright/no-conditional-expect":"error","playwright/no-conditional-in-test":"error","playwright/no-element-handle":"error","playwright/no-eval":"error","playwright/no-force-option":"error","playwright/no-nested-step":"error","playwright/no-page-pause":"error","playwright/no-skipped-test":"error","playwright/no-slowed-test":"error","playwright/no-useless-await":"error","playwright/no-useless-not":"error","playwright/no-wait-for-selector":"error","playwright/no-wait-for-timeout":"error"}),"playwrightRules"),De=r(async()=>[{...(await n(import("eslint-plugin-playwright"))).configs["flat/recommended"],files:q,name:"jimmy.codes/playwright",rules:await Ne()}],"playwrightConfig"),$e=r(()=>[{...ce,name:"jimmy.codes/prettier"}],"prettierConfig"),Ve=r(()=>a.isPackageExists("typescript"),"hasTypescript"),Fe=r(()=>a.isPackageExists("react"),"hasReact"),Je=r(()=>a.isPackageExists("vitest"),"hasVitest"),Xe=r(()=>a.isPackageExists("jest"),"hasJest"),ze=r(()=>ye.some(e=>a.isPackageExists(e)),"hasTestingLibrary"),Me=r(()=>a.isPackageExists("@tanstack/react-query"),"hasReactQuery"),Ue=r(()=>a.isPackageExists("astro"),"hasAstro"),He=r(()=>a.isPackageExists("@playwright/test"),"hasPlaywright"),Qe=r(()=>a.isPackageExists("storybook"),"hasStorybook"),_=r(()=>a.isPackageExists("next"),"hasNext"),Ye=r(()=>a.isPackageExists("vite"),"hasVite"),We=r(e=>e===2?"error":e===1?"warn":"off","toStringSeverity"),R=r((e={})=>Object.fromEntries(Object.entries(e).map(([t,o])=>[t,typeof o=="number"?We(o):o])),"normalizeRuleEntries"),Ke=["dynamic","dynamicParams","revalidate","fetchCache","runtime","preferredRegion","maxDuration","config","generateStaticParams","metadata","generateMetadata","viewport","generateViewport"],Ze=r(async()=>{const[e,t]=await Promise.all([n(import("eslint-plugin-react")),n(import("eslint-plugin-jsx-a11y"))]),o=_(),i=Ye();return{...t.configs.recommended.rules,...R(e.configs.flat.recommended?.rules),...R(e.configs.flat["jsx-runtime"]?.rules),"react-compiler/react-compiler":"error","react-hooks/exhaustive-deps":"error","react-hooks/rules-of-hooks":"error","react-refresh/only-export-components":["warn",{allowConstantExport:i,allowExportNames:o?Ke:[]}],"react/boolean-prop-naming":"off","react/button-has-type":"error","react/checked-requires-onchange-or-readonly":"error","react/default-props-match-prop-types":"error","react/destructuring-assignment":"off","react/forbid-component-props":"off","react/forbid-dom-props":"off","react/forbid-elements":"off","react/forbid-foreign-prop-types":"off","react/forbid-prop-types":"off","react/forward-ref-uses-ref":"error","react/function-component-definition":"off","react/hook-use-state":"error","react/iframe-missing-sandbox":"error","react/jsx-boolean-value":["error","never"],"react/jsx-curly-brace-presence":"error","react/jsx-filename-extension":"off","react/jsx-fragments":["error","syntax"],"react/jsx-handler-names":"off","react/jsx-max-depth":"off","react/jsx-no-bind":"off","react/jsx-no-constructed-context-values":"error","react/jsx-no-leaked-render":"error","react/jsx-no-literals":"off","react/jsx-no-script-url":"error","react/jsx-no-useless-fragment":"error","react/jsx-one-expression-per-line":"off","react/jsx-pascal-case":["error",{allowNamespace:!0}],"react/jsx-props-no-spread-multi":"off","react/jsx-props-no-spreading":"off","react/jsx-sort-default-props":"off","react/jsx-sort-props":"off","react/no-access-state-in-setstate":"error","react/no-adjacent-inline-elements":"off","react/no-array-index-key":"off","react/no-arrow-function-lifecycle":"error","react/no-danger":"off","react/no-did-mount-set-state":"error","react/no-did-update-set-state":"error","react/no-invalid-html-attribute":"error","react/no-multi-comp":"off","react/no-namespace":"error","react/no-object-type-as-default-prop":"error","react/no-redundant-should-component-update":"error","react/no-set-state":"off","react/no-this-in-sfc":"error","react/no-typos":"error","react/no-unstable-nested-components":"error","react/no-unused-class-component-methods":"error","react/no-unused-prop-types":"error","react/no-unused-state":"error","react/no-will-update-set-state":"error","react/prefer-es6-class":"off","react/prefer-exact-props":"off","react/prefer-read-only-props":"off","react/prefer-stateless-function":"off","react/require-default-props":"off","react/require-optimization":"off","react/self-closing-comp":"error","react/sort-comp":"off","react/sort-default-props":"off","react/sort-prop-types":"off","react/state-in-constructor":"off","react/static-property-placement":"off","react/style-prop-object":"error","react/void-dom-elements-no-children":"error"}},"reactRules"),er=r(async()=>{const[e,t,o,i,l]=await Promise.all([n(import("eslint-plugin-react")),n(import("eslint-plugin-jsx-a11y")),import("eslint-plugin-react-hooks"),n(import("eslint-plugin-react-refresh")),import("eslint-plugin-react-compiler")]);return[{files:[m,x],languageOptions:{globals:{...g.browser},parserOptions:{ecmaFeatures:{jsx:!0},jsxPragma:null}},name:"jimmy.codes/react",plugins:{"jsx-a11y":t,react:e,"react-compiler":l,"react-hooks":o,"react-refresh":i},rules:await Ze(),settings:{react:{version:"detect"}}}]},"reactConfig"),rr={...E.configs["flat/recommended"].rules,"regexp/confusing-quantifier":"error","regexp/no-empty-alternative":"error","regexp/no-lazy-ends":"error","regexp/no-potentially-useless-backreference":"error","regexp/no-useless-flag":"error","regexp/optimal-lookaround-quantifier":"error"},tr=r(()=>[{name:"jimmy.codes/regexp",plugins:{regexp:E},rules:rr}],"regexpConfig"),or=r(async()=>{const{configs:e}=await n(import("eslint-plugin-storybook")),[t,o,i]=e["flat/recommended"];return[{name:"jimmy.codes/storybook/setup",plugins:t?.plugins},{files:o?.files,name:"jimmy.codes/storybook/stories-rules",rules:{...O(o?.rules),"import-x/no-anonymous-default-export":"off","unicorn/no-anonymous-default-export":"off"}},{files:i?.files,name:"jimmy.codes/storybook/main-rules",rules:{...i?.rules}}]},"storybookConfig"),sr=r(async()=>{const e=await n(import("@tanstack/eslint-plugin-query"));return[{files:[m,x],name:"jimmy.codes/react/query",plugins:{"@tanstack/query":e},rules:{"@tanstack/query/exhaustive-deps":"error","@tanstack/query/no-rest-destructuring":"warn","@tanstack/query/stable-query-client":"error"}}]},"tanstackQueryConfig"),nr=r(async()=>{const[e,t]=await Promise.all([import("eslint-plugin-jest-dom"),n(import("eslint-plugin-testing-library"))]);return{...t.configs["flat/react"].rules,...e.configs["flat/recommended"].rules}},"testingLibraryRules"),ir=r(async()=>{const[e,t]=await Promise.all([import("eslint-plugin-jest-dom"),n(import("eslint-plugin-testing-library"))]);return[{files:u,ignores:j,name:"jimmy.codes/testing-library",plugins:{"jest-dom":e,"testing-library":t},rules:await nr()}]},"testingLibraryConfig"),ar={"@typescript-eslint/consistent-type-exports":["error",{fixMixedExportsWithInlineTypeSpecifier:!1}],"@typescript-eslint/consistent-type-imports":["error",{fixStyle:"separate-type-imports"}],"@typescript-eslint/no-deprecated":"warn","@typescript-eslint/no-misused-promises":["error",{checksVoidReturn:{attributes:!1}}],"@typescript-eslint/no-unused-vars":["error",{args:"all",argsIgnorePattern:"^_",caughtErrors:"all",caughtErrorsIgnorePattern:"^_",destructuredArrayIgnorePattern:"^_",ignoreRestSiblings:!0,varsIgnorePattern:"^_"}],"@typescript-eslint/no-use-before-define":["error",{allowNamedExports:!1,classes:!1,functions:!1,variables:!0}],"@typescript-eslint/restrict-template-expressions":["error",{allowNumber:!0}],"no-use-before-define":"off"},cr=r(()=>[...f.configs.strictTypeChecked,...f.configs.stylisticTypeChecked.filter(e=>e.name==="typescript-eslint/stylistic-type-checked"),{languageOptions:{parserOptions:{projectService:!0,tsconfigRootDir:process.cwd()}},name:"jimmy.codes/typescript",rules:ar},{files:[C,m],...f.configs.disableTypeChecked},{files:u,name:"jimmy.codes/typescript/testing",rules:{"@typescript-eslint/no-unsafe-argument":"off","@typescript-eslint/no-unsafe-assignment":"off"}}],"typescriptConfig"),lr={...P.configs["flat/recommended"].rules,"unicorn/filename-case":"off","unicorn/import-style":"off","unicorn/no-abusive-eslint-disable":"off","unicorn/no-anonymous-default-export":"off","unicorn/no-array-callback-reference":"off","unicorn/no-array-reduce":"off","unicorn/no-null":"off","unicorn/no-process-exit":"off","unicorn/no-useless-undefined":["error",{checkArguments:!1,checkArrowFunctionBody:!1}],"unicorn/prefer-node-protocol":"off","unicorn/prevent-abbreviations":"off"},pr=r(()=>[{...P.configs["flat/recommended"],name:"jimmy.codes/unicorn",rules:lr}],"unicornConfig"),fr=r(async()=>({...(await n(import("@vitest/eslint-plugin"))).configs.recommended.rules,"vitest/consistent-test-it":["error",{fn:"test",withinDescribe:"it"}],"vitest/no-alias-methods":"error","vitest/no-commented-out-tests":"error","vitest/no-conditional-in-test":"error","vitest/no-disabled-tests":"warn","vitest/no-duplicate-hooks":"error","vitest/no-focused-tests":"error","vitest/no-hooks":"off","vitest/no-identical-title":"error","vitest/no-interpolation-in-snapshots":"error","vitest/no-large-snapshots":"off","vitest/no-mocks-import":"error","vitest/no-restricted-matchers":"off","vitest/no-restricted-vi-methods":"off","vitest/no-standalone-expect":"error","vitest/no-test-prefixes":"error","vitest/no-test-return-statement":"error","vitest/prefer-called-with":"error","vitest/prefer-comparison-matcher":"error","vitest/prefer-each":"error","vitest/prefer-equality-matcher":"error","vitest/prefer-expect-assertions":"off","vitest/prefer-expect-resolves":"error","vitest/prefer-hooks-in-order":"error","vitest/prefer-hooks-on-top":"error","vitest/prefer-lowercase-title":"off","vitest/prefer-mock-promise-shorthand":"error","vitest/prefer-snapshot-hint":"error","vitest/prefer-spy-on":"off","vitest/prefer-strict-boolean-matchers":"error","vitest/prefer-strict-equal":"error","vitest/prefer-to-be":"error","vitest/prefer-to-contain":"error","vitest/prefer-to-have-length":"error","vitest/prefer-todo":"warn","vitest/require-hook":"error","vitest/require-to-throw-message":"error","vitest/require-top-level-describe":"off","vitest/valid-expect":"error","vitest/valid-expect-in-promise":"error","vitest/valid-title":"error"}),"vitestRules"),ur=r(async()=>{const e=await n(import("@vitest/eslint-plugin"));return[{files:u,ignores:j,...e.configs.recommended,name:"jimmy.codes/vitest",rules:await fr()}]},"vitestConfig"),T=r(async({astro:e=!1,autoDetect:t=!0,ignores:o=[],jest:i=!1,nextjs:l=!1,overrides:S=[],playwright:L=!1,react:G=!1,storybook:A=!1,tanstackQuery:B=!1,testingLibrary:I=!1,typescript:N=!1,vitest:D=!1}={},...$)=>{const c=r((K,Z)=>K||t&&Z(),"resolveFlag"),h=c(N,Ve),V=c(G,Fe),F=c(e,Ue),J=c(B,Me),X=c(I,ze),z=c(L,He),M=c(A,Qe),U=c(l,_),H=c(i,Xe),Q=c(D,Je),Y=[qe(),Ie(),Ae(),pr(),ve(),tr(),Te(),Pe({typescript:h})],W=[h&&cr(),V&&await er(),J&&await sr(),F&&await xe(),H&&await _e(),Q&&await ur(),X&&await ir(),z&&await De(),M&&await or(),U&&await Le()].filter(Boolean);return[...Y,...W,$e(),je(),be(o),S,$].flat()},"defineConfig");exports.default=T,exports.defineConfig=T;