@jimmy.codes/eslint-config 4.2.1 → 4.3.1
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 +12 -12
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +27 -2
- package/dist/index.d.mts +27 -2
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -35,9 +35,9 @@ pnpm add -D @jimmy.codes/eslint-config
|
|
|
35
35
|
Then, in your `eslint.config.js`, simply add:
|
|
36
36
|
|
|
37
37
|
```mjs
|
|
38
|
-
import
|
|
38
|
+
import { defineConfig } from "@jimmy.codes/eslint-config";
|
|
39
39
|
|
|
40
|
-
export default
|
|
40
|
+
export default defineConfig();
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
This automatically applies rules **based on your installed dependencies**.
|
|
@@ -48,9 +48,9 @@ By default, this config **auto-detects** relevant rules based on your dependenci
|
|
|
48
48
|
To disable this behavior:
|
|
49
49
|
|
|
50
50
|
```ts
|
|
51
|
-
import
|
|
51
|
+
import { defineConfig } from "@jimmy.codes/eslint-config";
|
|
52
52
|
|
|
53
|
-
export default
|
|
53
|
+
export default defineConfig({ autoDetect: false });
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
#### **Manually Enable/Disable Rule Sets**
|
|
@@ -58,9 +58,9 @@ export default eslintConfig({ autoDetect: false });
|
|
|
58
58
|
You can explicitly enable or disable rule sets:
|
|
59
59
|
|
|
60
60
|
```ts
|
|
61
|
-
import
|
|
61
|
+
import { defineConfig } from "@jimmy.codes/eslint-config";
|
|
62
62
|
|
|
63
|
-
export default
|
|
63
|
+
export default defineConfig({
|
|
64
64
|
astro: false,
|
|
65
65
|
jest: false,
|
|
66
66
|
nextjs: false,
|
|
@@ -79,9 +79,9 @@ export default eslintConfig({
|
|
|
79
79
|
Use the `overrides` option:
|
|
80
80
|
|
|
81
81
|
```ts
|
|
82
|
-
import
|
|
82
|
+
import { defineConfig } from "@jimmy.codes/eslint-config";
|
|
83
83
|
|
|
84
|
-
export default
|
|
84
|
+
export default defineConfig({
|
|
85
85
|
overrides: [
|
|
86
86
|
{
|
|
87
87
|
files: ["**/*.js"],
|
|
@@ -102,9 +102,9 @@ export default eslintConfig({
|
|
|
102
102
|
Alternatively, pass multiple configurations as separate arguments:
|
|
103
103
|
|
|
104
104
|
```ts
|
|
105
|
-
import
|
|
105
|
+
import { defineConfig } from "@jimmy.codes/eslint-config";
|
|
106
106
|
|
|
107
|
-
export default
|
|
107
|
+
export default defineConfig(
|
|
108
108
|
{},
|
|
109
109
|
{
|
|
110
110
|
files: ["**/*.js"],
|
|
@@ -126,9 +126,9 @@ export default eslintConfig(
|
|
|
126
126
|
Extend ignored files:
|
|
127
127
|
|
|
128
128
|
```ts
|
|
129
|
-
import
|
|
129
|
+
import { defineConfig } from "@jimmy.codes/eslint-config";
|
|
130
130
|
|
|
131
|
-
export default
|
|
131
|
+
export default defineConfig({
|
|
132
132
|
ignores: ["**/*.mjs"],
|
|
133
133
|
});
|
|
134
134
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Z=Object.create;var d=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,oe=Object.prototype.hasOwnProperty;var r=(e,t)=>d(e,"name",{value:t,configurable:!0});var se=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of re(t))!oe.call(e,l)&&l!==o&&d(e,l,{get:()=>t[l],enumerable:!(i=ee(t,l))||i.enumerable});return e};var s=(e,t,o)=>(o=e!=null?Z(te(e)):{},se(t||!e||!e.__esModule?d(o,"default",{value:e,enumerable:!0}):o,e));var g=require("globals"),f=require("typescript-eslint"),v=require("@eslint-community/eslint-plugin-eslint-comments/configs"),ne=require("eslint-import-resolver-typescript"),y=require("eslint-plugin-import-x"),b=require("eslint-plugin-n"),ie=require("@eslint/js"),w=require("eslint-plugin-jsdoc"),k=require("eslint-plugin-perfectionist"),ae=require("eslint-config-prettier/flat"),a=require("local-pkg"),ce=require("eslint-plugin-regexp"),P=require("eslint-plugin-unicorn");function le(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(le,"_interopNamespaceDefault");var E=le(ce);const p="?([cm])[jt]s?(x)",pe=["**/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",fe="**/*.?([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}`],ue=[C,m,fe,x],me="**/*.cjs",de="**/*.astro",ge=["@testing-library/react"],n=r(async e=>{const t=await e;return t.default??t},"interopDefault"),ye=r(async()=>{const e=[de],[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"),xe=r(()=>[{files:[me],languageOptions:{globals:g.commonjs},name:"jimmy.codes/commonjs"}],"commonjsConfig"),je={...v.recommended.rules,"@eslint-community/eslint-comments/no-unused-disable":"off","@eslint-community/eslint-comments/require-description":"error"},he=r(()=>[{...v.recommended,name:"jimmy.codes/eslint-comments",rules:je}],"eslintCommentsConfig"),ve=r(e=>[{ignores:[...pe,...e],name:"jimmy.codes/ignores"}],"ignoresConfig"),be={...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"},we=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":[ne.createTypeScriptImportResolver({alwaysTryTypes:!0})]}}]},"importsTypescriptConfig"),ke=r(({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":y,n:b},rules:be},...e?we():[]],"importsConfig"),Pe={"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"},Ee={...ie.configs.recommended.rules,...Pe},Ce=r(()=>[{linterOptions:{reportUnusedDisableDirectives:!0},name:"jimmy.codes/javascript",rules:Ee},{files:u,name:"jimmy.codes/javascript/testing",rules:{"no-magic-numbers":"off"}}],"javascriptConfig"),qe=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"),Oe=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 qe()}]},"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"),_e=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"),Te=r(async()=>{const e=await n(import("@next/eslint-plugin-next"));return O(e.configs.recommended.rules)},"nextjsRules"),Se=r(async()=>{const e=await n(import("@next/eslint-plugin-next"));return[{files:ue,name:"jimmy.codes/nextjs",plugins:{"@next/next":e},rules:await Te()}]},"nextjsConfig"),Le={"n/no-process-exit":"off","n/prefer-node-protocol":"error"},Ge=r(()=>[{name:"jimmy.codes/node",plugins:{n:b},rules:Le}],"nodeConfig"),Ae={...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"},Be=r(()=>[{name:"jimmy.codes/perfectionist",plugins:{perfectionist:k},rules:Ae}],"perfectionistConfig"),Ie=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"),Ne=r(async()=>[{...(await n(import("eslint-plugin-playwright"))).configs["flat/recommended"],files:q,name:"jimmy.codes/playwright",rules:await Ie()}],"playwrightConfig"),De=r(()=>[{...ae,name:"jimmy.codes/prettier"}],"prettierConfig"),$e=r(()=>a.isPackageExists("typescript"),"hasTypescript"),Ve=r(()=>a.isPackageExists("react"),"hasReact"),Fe=r(()=>a.isPackageExists("vitest"),"hasVitest"),Je=r(()=>a.isPackageExists("jest"),"hasJest"),Xe=r(()=>ge.some(e=>a.isPackageExists(e)),"hasTestingLibrary"),ze=r(()=>a.isPackageExists("@tanstack/react-query"),"hasReactQuery"),Ue=r(()=>a.isPackageExists("astro"),"hasAstro"),He=r(()=>a.isPackageExists("@playwright/test"),"hasPlaywright"),Me=r(()=>a.isPackageExists("storybook"),"hasStorybook"),R=r(()=>a.isPackageExists("next"),"hasNext"),Qe=r(()=>a.isPackageExists("vite"),"hasVite"),Ye=r(e=>e===2?"error":e===1?"warn":"off","toStringSeverity"),_=r((e={})=>Object.fromEntries(Object.entries(e).map(([t,o])=>[t,typeof o=="number"?Ye(o):o])),"normalizeRuleEntries"),We=["dynamic","dynamicParams","revalidate","fetchCache","runtime","preferredRegion","maxDuration","config","generateStaticParams","metadata","generateMetadata","viewport","generateViewport"],Ke=r(async()=>{const[e,t]=await Promise.all([n(import("eslint-plugin-react")),n(import("eslint-plugin-jsx-a11y"))]),o=R(),i=Qe();return{...t.configs.recommended.rules,..._(e.configs.flat.recommended?.rules),..._(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?We:[]}],"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"),Ze=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 Ke(),settings:{react:{version:"detect"}}}]},"reactConfig"),er={...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"},rr=r(()=>[{name:"jimmy.codes/regexp",plugins:{regexp:E},rules:er}],"regexpConfig"),tr=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"),or=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"),sr=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"),nr=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 sr()}]},"testingLibraryConfig"),ir={"@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"},ar=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:ir},{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"),cr={...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"},lr=r(()=>[{...P.configs["flat/recommended"],name:"jimmy.codes/unicorn",rules:cr}],"unicornConfig"),pr=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"),fr=r(async()=>{const e=await n(import("@vitest/eslint-plugin"));return[{files:u,ignores:j,...e.configs.recommended,name:"jimmy.codes/vitest",rules:await pr()}]},"vitestConfig"),ur=r(async({astro:e=!1,autoDetect:t=!0,ignores:o=[],jest:i=!1,nextjs:l=!1,overrides:T=[],playwright:S=!1,react:L=!1,storybook:G=!1,tanstackQuery:A=!1,testingLibrary:B=!1,typescript:I=!1,vitest:N=!1}={},...D)=>{const c=r((W,K)=>W||t&&K(),"resolveFlag"),h=c(I,$e),$=c(L,Ve),V=c(e,Ue),F=c(A,ze),J=c(B,Xe),X=c(S,He),z=c(G,Me),U=c(l,R),H=c(i,Je),M=c(N,Fe),Q=[Ce(),Be(),Ge(),lr(),he(),rr(),_e(),ke({typescript:h})],Y=[h&&ar(),$&&await Ze(),F&&await or(),V&&await ye(),H&&await Oe(),M&&await fr(),J&&await nr(),X&&await Ne(),z&&await tr(),U&&await Se()].filter(Boolean);return[...Q,...Y,De(),xe(),ve(o),T,D].flat()},"eslintConfig");module.exports=ur;
|
|
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,startLines: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"),Le=r(async()=>{const e=await n(import("@next/eslint-plugin-next"));return O(e.configs.recommended.rules)},"nextjsRules"),Se=r(async()=>{const e=await n(import("@next/eslint-plugin-next"));return[{files:me,name:"jimmy.codes/nextjs",plugins:{"@next/next":e},rules:await Le()}]},"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:L=[],playwright:S=!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(S,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 Se()].filter(Boolean);return[...Y,...W,$e(),je(),be(o),L,$].flat()},"defineConfig");exports.default=T,exports.defineConfig=T;
|
package/dist/index.d.cts
CHANGED
|
@@ -13297,6 +13297,7 @@ type Rules = RuleOptions;
|
|
|
13297
13297
|
type TypedConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, "plugins"> & {
|
|
13298
13298
|
/**
|
|
13299
13299
|
* 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.
|
|
13300
|
+
*
|
|
13300
13301
|
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
|
|
13301
13302
|
*/
|
|
13302
13303
|
plugins?: Record<string, unknown>;
|
|
@@ -13304,75 +13305,98 @@ type TypedConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, "plugins"
|
|
|
13304
13305
|
interface Options {
|
|
13305
13306
|
/**
|
|
13306
13307
|
* Are astro rules enabled?
|
|
13308
|
+
*
|
|
13307
13309
|
* @default false
|
|
13308
13310
|
*/
|
|
13309
13311
|
astro?: boolean;
|
|
13310
13312
|
/**
|
|
13311
13313
|
* Automatically enables rules based on installed dependencies.
|
|
13312
13314
|
* For example, if `react` is installed, React-specific rules will be applied.
|
|
13315
|
+
*
|
|
13313
13316
|
* @default true
|
|
13314
13317
|
*/
|
|
13315
13318
|
autoDetect?: boolean;
|
|
13316
13319
|
/**
|
|
13317
13320
|
* Glob patterns for files that should be ignored.
|
|
13318
13321
|
* Matches ESLint's ignore patterns.
|
|
13322
|
+
*
|
|
13319
13323
|
* @see [Ignoring files](https://eslint.org/docs/latest/use/configure/ignore)
|
|
13320
13324
|
*/
|
|
13321
13325
|
ignores?: string[];
|
|
13322
13326
|
/**
|
|
13323
13327
|
* Are Jest rules enabled?
|
|
13328
|
+
*
|
|
13324
13329
|
* @default false
|
|
13325
13330
|
*/
|
|
13326
13331
|
jest?: boolean;
|
|
13327
13332
|
/**
|
|
13328
13333
|
* Are Next.js rules enabled?
|
|
13334
|
+
*
|
|
13329
13335
|
* @default false
|
|
13330
13336
|
*/
|
|
13331
13337
|
nextjs?: boolean;
|
|
13332
13338
|
/**
|
|
13333
13339
|
* Additional configs to extend or override rules.
|
|
13334
13340
|
* Accepts ESLint configuration objects.
|
|
13341
|
+
*
|
|
13335
13342
|
* @default []
|
|
13336
13343
|
*/
|
|
13337
13344
|
overrides?: Linter.Config[] | TypedConfigItem[];
|
|
13338
13345
|
/**
|
|
13339
13346
|
* Are playwright rules enabled?
|
|
13347
|
+
*
|
|
13340
13348
|
* @default false
|
|
13341
13349
|
*/
|
|
13342
13350
|
playwright?: boolean;
|
|
13343
13351
|
/**
|
|
13344
13352
|
* Are React rules enabled?
|
|
13353
|
+
*
|
|
13345
13354
|
* @default false
|
|
13346
13355
|
*/
|
|
13347
13356
|
react?: boolean;
|
|
13348
13357
|
/**
|
|
13349
13358
|
* Are Storybook rules enabled?
|
|
13359
|
+
*
|
|
13350
13360
|
* @default false
|
|
13351
13361
|
*/
|
|
13352
13362
|
storybook?: boolean;
|
|
13353
13363
|
/**
|
|
13354
13364
|
* Are TanStack Query rules enabled?
|
|
13365
|
+
*
|
|
13355
13366
|
* @default false
|
|
13356
13367
|
*/
|
|
13357
13368
|
tanstackQuery?: boolean;
|
|
13358
13369
|
/**
|
|
13359
13370
|
* Are Testing Library rules enabled?
|
|
13371
|
+
*
|
|
13360
13372
|
* @default false
|
|
13361
13373
|
*/
|
|
13362
13374
|
testingLibrary?: boolean;
|
|
13363
13375
|
/**
|
|
13364
13376
|
* Are TypeScript rules enabled?
|
|
13377
|
+
*
|
|
13365
13378
|
* @default false
|
|
13366
13379
|
*/
|
|
13367
13380
|
typescript?: boolean;
|
|
13368
13381
|
/**
|
|
13369
13382
|
* Are Vitest rules enabled?
|
|
13383
|
+
*
|
|
13370
13384
|
* @default false
|
|
13371
13385
|
*/
|
|
13372
13386
|
vitest?: boolean;
|
|
13373
13387
|
}
|
|
13374
13388
|
|
|
13375
|
-
|
|
13389
|
+
/**
|
|
13390
|
+
* Generates an ESLint configuration based on the provided options.
|
|
13391
|
+
*
|
|
13392
|
+
* @returns The resolved ESLint configuration.
|
|
13393
|
+
*
|
|
13394
|
+
* @example
|
|
13395
|
+
* import { defineConfig } from "@jimmy.codes/eslint-config";
|
|
13396
|
+
*
|
|
13397
|
+
* export default defineConfig();
|
|
13398
|
+
*/
|
|
13399
|
+
declare const defineConfig: ({ astro, autoDetect, ignores, jest, nextjs, overrides, playwright, react, storybook, tanstackQuery, testingLibrary, typescript, vitest, }?: Options, ...moreOverrides: Linter.Config[] | TypedConfigItem[]) => Promise<(TypedConfigItem | Linter.Config<Linter.RulesRecord> | _typescript_eslint_utils_ts_eslint.FlatConfig.Config | {
|
|
13376
13400
|
files: string[];
|
|
13377
13401
|
languageOptions: {
|
|
13378
13402
|
globals: {
|
|
@@ -14083,6 +14107,7 @@ declare const eslintConfig: ({ astro, autoDetect, ignores, jest, nextjs, overrid
|
|
|
14083
14107
|
"jsdoc/require-returns": "off";
|
|
14084
14108
|
"jsdoc/tag-lines": ["error", "always", {
|
|
14085
14109
|
applyToEndTag: false;
|
|
14110
|
+
startLines: number;
|
|
14086
14111
|
}];
|
|
14087
14112
|
};
|
|
14088
14113
|
files?: Array<string | string[]>;
|
|
@@ -15917,4 +15942,4 @@ declare const eslintConfig: ({ astro, autoDetect, ignores, jest, nextjs, overrid
|
|
|
15917
15942
|
settings?: Record<string, unknown>;
|
|
15918
15943
|
})[]>;
|
|
15919
15944
|
|
|
15920
|
-
export { type Options, type Rules, type TypedConfigItem,
|
|
15945
|
+
export { type Options, type Rules, type TypedConfigItem, defineConfig as default, defineConfig };
|
package/dist/index.d.mts
CHANGED
|
@@ -13297,6 +13297,7 @@ type Rules = RuleOptions;
|
|
|
13297
13297
|
type TypedConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, "plugins"> & {
|
|
13298
13298
|
/**
|
|
13299
13299
|
* 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.
|
|
13300
|
+
*
|
|
13300
13301
|
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
|
|
13301
13302
|
*/
|
|
13302
13303
|
plugins?: Record<string, unknown>;
|
|
@@ -13304,75 +13305,98 @@ type TypedConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, "plugins"
|
|
|
13304
13305
|
interface Options {
|
|
13305
13306
|
/**
|
|
13306
13307
|
* Are astro rules enabled?
|
|
13308
|
+
*
|
|
13307
13309
|
* @default false
|
|
13308
13310
|
*/
|
|
13309
13311
|
astro?: boolean;
|
|
13310
13312
|
/**
|
|
13311
13313
|
* Automatically enables rules based on installed dependencies.
|
|
13312
13314
|
* For example, if `react` is installed, React-specific rules will be applied.
|
|
13315
|
+
*
|
|
13313
13316
|
* @default true
|
|
13314
13317
|
*/
|
|
13315
13318
|
autoDetect?: boolean;
|
|
13316
13319
|
/**
|
|
13317
13320
|
* Glob patterns for files that should be ignored.
|
|
13318
13321
|
* Matches ESLint's ignore patterns.
|
|
13322
|
+
*
|
|
13319
13323
|
* @see [Ignoring files](https://eslint.org/docs/latest/use/configure/ignore)
|
|
13320
13324
|
*/
|
|
13321
13325
|
ignores?: string[];
|
|
13322
13326
|
/**
|
|
13323
13327
|
* Are Jest rules enabled?
|
|
13328
|
+
*
|
|
13324
13329
|
* @default false
|
|
13325
13330
|
*/
|
|
13326
13331
|
jest?: boolean;
|
|
13327
13332
|
/**
|
|
13328
13333
|
* Are Next.js rules enabled?
|
|
13334
|
+
*
|
|
13329
13335
|
* @default false
|
|
13330
13336
|
*/
|
|
13331
13337
|
nextjs?: boolean;
|
|
13332
13338
|
/**
|
|
13333
13339
|
* Additional configs to extend or override rules.
|
|
13334
13340
|
* Accepts ESLint configuration objects.
|
|
13341
|
+
*
|
|
13335
13342
|
* @default []
|
|
13336
13343
|
*/
|
|
13337
13344
|
overrides?: Linter.Config[] | TypedConfigItem[];
|
|
13338
13345
|
/**
|
|
13339
13346
|
* Are playwright rules enabled?
|
|
13347
|
+
*
|
|
13340
13348
|
* @default false
|
|
13341
13349
|
*/
|
|
13342
13350
|
playwright?: boolean;
|
|
13343
13351
|
/**
|
|
13344
13352
|
* Are React rules enabled?
|
|
13353
|
+
*
|
|
13345
13354
|
* @default false
|
|
13346
13355
|
*/
|
|
13347
13356
|
react?: boolean;
|
|
13348
13357
|
/**
|
|
13349
13358
|
* Are Storybook rules enabled?
|
|
13359
|
+
*
|
|
13350
13360
|
* @default false
|
|
13351
13361
|
*/
|
|
13352
13362
|
storybook?: boolean;
|
|
13353
13363
|
/**
|
|
13354
13364
|
* Are TanStack Query rules enabled?
|
|
13365
|
+
*
|
|
13355
13366
|
* @default false
|
|
13356
13367
|
*/
|
|
13357
13368
|
tanstackQuery?: boolean;
|
|
13358
13369
|
/**
|
|
13359
13370
|
* Are Testing Library rules enabled?
|
|
13371
|
+
*
|
|
13360
13372
|
* @default false
|
|
13361
13373
|
*/
|
|
13362
13374
|
testingLibrary?: boolean;
|
|
13363
13375
|
/**
|
|
13364
13376
|
* Are TypeScript rules enabled?
|
|
13377
|
+
*
|
|
13365
13378
|
* @default false
|
|
13366
13379
|
*/
|
|
13367
13380
|
typescript?: boolean;
|
|
13368
13381
|
/**
|
|
13369
13382
|
* Are Vitest rules enabled?
|
|
13383
|
+
*
|
|
13370
13384
|
* @default false
|
|
13371
13385
|
*/
|
|
13372
13386
|
vitest?: boolean;
|
|
13373
13387
|
}
|
|
13374
13388
|
|
|
13375
|
-
|
|
13389
|
+
/**
|
|
13390
|
+
* Generates an ESLint configuration based on the provided options.
|
|
13391
|
+
*
|
|
13392
|
+
* @returns The resolved ESLint configuration.
|
|
13393
|
+
*
|
|
13394
|
+
* @example
|
|
13395
|
+
* import { defineConfig } from "@jimmy.codes/eslint-config";
|
|
13396
|
+
*
|
|
13397
|
+
* export default defineConfig();
|
|
13398
|
+
*/
|
|
13399
|
+
declare const defineConfig: ({ astro, autoDetect, ignores, jest, nextjs, overrides, playwright, react, storybook, tanstackQuery, testingLibrary, typescript, vitest, }?: Options, ...moreOverrides: Linter.Config[] | TypedConfigItem[]) => Promise<(TypedConfigItem | Linter.Config<Linter.RulesRecord> | _typescript_eslint_utils_ts_eslint.FlatConfig.Config | {
|
|
13376
13400
|
files: string[];
|
|
13377
13401
|
languageOptions: {
|
|
13378
13402
|
globals: {
|
|
@@ -14083,6 +14107,7 @@ declare const eslintConfig: ({ astro, autoDetect, ignores, jest, nextjs, overrid
|
|
|
14083
14107
|
"jsdoc/require-returns": "off";
|
|
14084
14108
|
"jsdoc/tag-lines": ["error", "always", {
|
|
14085
14109
|
applyToEndTag: false;
|
|
14110
|
+
startLines: number;
|
|
14086
14111
|
}];
|
|
14087
14112
|
};
|
|
14088
14113
|
files?: Array<string | string[]>;
|
|
@@ -15917,4 +15942,4 @@ declare const eslintConfig: ({ astro, autoDetect, ignores, jest, nextjs, overrid
|
|
|
15917
15942
|
settings?: Record<string, unknown>;
|
|
15918
15943
|
})[]>;
|
|
15919
15944
|
|
|
15920
|
-
export { type Options, type Rules, type TypedConfigItem,
|
|
15945
|
+
export { type Options, type Rules, type TypedConfigItem, defineConfig as default, defineConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var W=Object.defineProperty;var r=(e,t)=>W(e,"name",{value:t,configurable:!0});import u from"globals";import{parser as K,configs as l}from"typescript-eslint";import x from"@eslint-community/eslint-plugin-eslint-comments/configs";import{createTypeScriptImportResolver as Z}from"eslint-import-resolver-typescript";import d from"eslint-plugin-import-x";import h from"eslint-plugin-n";import ee from"@eslint/js";import b from"eslint-plugin-jsdoc";import v from"eslint-plugin-perfectionist";import re from"eslint-config-prettier/flat";import{isPackageExists as i}from"local-pkg";import*as w from"eslint-plugin-regexp";import k from"eslint-plugin-unicorn";const c="?([cm])[jt]s?(x)",te=["**/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"],P="**/*.?([cm])js",f="**/*.?([cm])jsx",oe="**/*.?([cm])ts",g="**/*.?([cm])tsx",p=[`**/__tests__/**/*.${c}`,`**/*.spec.${c}`,`**/*.test.${c}`,`**/*.bench.${c}`,`**/*.benchmark.${c}`],C=[`**/e2e/**/*.spec.${c}`,`**/e2e/**/*.test.${c}`],y=[...C,`**/cypress/**/*.spec.${c}`,`**/cypress/**/*.test.${c}`],se=[P,f,oe,g],ne="**/*.cjs",ie="**/*.astro",ae=["@testing-library/react"],o=r(async e=>{const t=await e;return t.default??t},"interopDefault"),ce=r(async()=>{const e=[ie],[t,s,n]=await Promise.all([import("eslint-plugin-astro"),import("astro-eslint-parser"),o(import("eslint-plugin-jsx-a11y"))]);return[{files:e,languageOptions:{globals:{...u.node,Astro:!1,Fragment:!1},parser:s,parserOptions:{extraFileExtensions:[".astro"],parser:K},sourceType:"module"},name:"jimmy.codes/astro",plugins:{astro:t,"jsx-a11y":n},processor:"astro/client-side-ts",rules:{...n.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:l.disableTypeChecked.languageOptions?.parserOptions},name:"jimmy.codes/astro/disable-type-checked",rules:l.disableTypeChecked.rules},{name:"jimmy.codes/astro/imports",settings:{"import-x/core-modules":["astro:content"]}}]},"astroConfig"),le=r(()=>[{files:[ne],languageOptions:{globals:u.commonjs},name:"jimmy.codes/commonjs"}],"commonjsConfig"),pe={...x.recommended.rules,"@eslint-community/eslint-comments/no-unused-disable":"off","@eslint-community/eslint-comments/require-description":"error"},fe=r(()=>[{...x.recommended,name:"jimmy.codes/eslint-comments",rules:pe}],"eslintCommentsConfig"),me=r(e=>[{ignores:[...te,...e],name:"jimmy.codes/ignores"}],"ignoresConfig"),ue={...d.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"},de=r(()=>{const{rules:e,settings:t}=d.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":[Z({alwaysTryTypes:!0})]}}]},"importsTypescriptConfig"),ge=r(({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":d,n:h},rules:ue},...e?de():[]],"importsConfig"),ye={"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"},je={...ee.configs.recommended.rules,...ye},xe=r(()=>[{linterOptions:{reportUnusedDisableDirectives:!0},name:"jimmy.codes/javascript",rules:je},{files:p,name:"jimmy.codes/javascript/testing",rules:{"no-magic-numbers":"off"}}],"javascriptConfig"),he=r(async()=>{const e=await o(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"),be=r(async()=>{const e=await o(import("eslint-plugin-jest"));return[{files:p,ignores:y,...e.configs["flat/recommended"],name:"jimmy.codes/jest",rules:await he()}]},"jestConfig"),ve=r(()=>({...b.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"),we=r(()=>[{...b.configs["flat/recommended-typescript-error"],name:"jimmy.codes/jsdoc",rules:ve()}],"jsdocConfig"),E=r((e={})=>Object.fromEntries(Object.entries(e).map(([t,s])=>[t,s==="warn"?"error":s])),"warningAsErrors"),ke=r(async()=>{const e=await o(import("@next/eslint-plugin-next"));return E(e.configs.recommended.rules)},"nextjsRules"),Pe=r(async()=>{const e=await o(import("@next/eslint-plugin-next"));return[{files:se,name:"jimmy.codes/nextjs",plugins:{"@next/next":e},rules:await ke()}]},"nextjsConfig"),Ce={"n/no-process-exit":"off","n/prefer-node-protocol":"error"},Ee=r(()=>[{name:"jimmy.codes/node",plugins:{n:h},rules:Ce}],"nodeConfig"),Re={...v.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"},Oe=r(()=>[{name:"jimmy.codes/perfectionist",plugins:{perfectionist:v},rules:Re}],"perfectionistConfig"),Te=r(async()=>({...(await o(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"),_e=r(async()=>[{...(await o(import("eslint-plugin-playwright"))).configs["flat/recommended"],files:C,name:"jimmy.codes/playwright",rules:await Te()}],"playwrightConfig"),qe=r(()=>[{...re,name:"jimmy.codes/prettier"}],"prettierConfig"),Se=r(()=>i("typescript"),"hasTypescript"),Le=r(()=>i("react"),"hasReact"),Ge=r(()=>i("vitest"),"hasVitest"),Ae=r(()=>i("jest"),"hasJest"),Be=r(()=>ae.some(e=>i(e)),"hasTestingLibrary"),Ie=r(()=>i("@tanstack/react-query"),"hasReactQuery"),Ne=r(()=>i("astro"),"hasAstro"),De=r(()=>i("@playwright/test"),"hasPlaywright"),$e=r(()=>i("storybook"),"hasStorybook"),R=r(()=>i("next"),"hasNext"),Ve=r(()=>i("vite"),"hasVite"),Fe=r(e=>e===2?"error":e===1?"warn":"off","toStringSeverity"),O=r((e={})=>Object.fromEntries(Object.entries(e).map(([t,s])=>[t,typeof s=="number"?Fe(s):s])),"normalizeRuleEntries"),Je=["dynamic","dynamicParams","revalidate","fetchCache","runtime","preferredRegion","maxDuration","config","generateStaticParams","metadata","generateMetadata","viewport","generateViewport"],Xe=r(async()=>{const[e,t]=await Promise.all([o(import("eslint-plugin-react")),o(import("eslint-plugin-jsx-a11y"))]),s=R(),n=Ve();return{...t.configs.recommended.rules,...O(e.configs.flat.recommended?.rules),...O(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:n,allowExportNames:s?Je:[]}],"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"),Ue=r(async()=>{const[e,t,s,n,m]=await Promise.all([o(import("eslint-plugin-react")),o(import("eslint-plugin-jsx-a11y")),import("eslint-plugin-react-hooks"),o(import("eslint-plugin-react-refresh")),import("eslint-plugin-react-compiler")]);return[{files:[f,g],languageOptions:{globals:{...u.browser},parserOptions:{ecmaFeatures:{jsx:!0},jsxPragma:null}},name:"jimmy.codes/react",plugins:{"jsx-a11y":t,react:e,"react-compiler":m,"react-hooks":s,"react-refresh":n},rules:await Xe(),settings:{react:{version:"detect"}}}]},"reactConfig"),ze={...w.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"},He=r(()=>[{name:"jimmy.codes/regexp",plugins:{regexp:w},rules:ze}],"regexpConfig"),Me=r(async()=>{const{configs:e}=await o(import("eslint-plugin-storybook")),[t,s,n]=e["flat/recommended"];return[{name:"jimmy.codes/storybook/setup",plugins:t?.plugins},{files:s?.files,name:"jimmy.codes/storybook/stories-rules",rules:{...E(s?.rules),"import-x/no-anonymous-default-export":"off","unicorn/no-anonymous-default-export":"off"}},{files:n?.files,name:"jimmy.codes/storybook/main-rules",rules:{...n?.rules}}]},"storybookConfig"),Qe=r(async()=>{const e=await o(import("@tanstack/eslint-plugin-query"));return[{files:[f,g],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"),Ye=r(async()=>{const[e,t]=await Promise.all([import("eslint-plugin-jest-dom"),o(import("eslint-plugin-testing-library"))]);return{...t.configs["flat/react"].rules,...e.configs["flat/recommended"].rules}},"testingLibraryRules"),We=r(async()=>{const[e,t]=await Promise.all([import("eslint-plugin-jest-dom"),o(import("eslint-plugin-testing-library"))]);return[{files:p,ignores:y,name:"jimmy.codes/testing-library",plugins:{"jest-dom":e,"testing-library":t},rules:await Ye()}]},"testingLibraryConfig"),Ke={"@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"},Ze=r(()=>[...l.strictTypeChecked,...l.stylisticTypeChecked.filter(e=>e.name==="typescript-eslint/stylistic-type-checked"),{languageOptions:{parserOptions:{projectService:!0,tsconfigRootDir:process.cwd()}},name:"jimmy.codes/typescript",rules:Ke},{files:[P,f],...l.disableTypeChecked},{files:p,name:"jimmy.codes/typescript/testing",rules:{"@typescript-eslint/no-unsafe-argument":"off","@typescript-eslint/no-unsafe-assignment":"off"}}],"typescriptConfig"),er={...k.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"},rr=r(()=>[{...k.configs["flat/recommended"],name:"jimmy.codes/unicorn",rules:er}],"unicornConfig"),tr=r(async()=>({...(await o(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"),or=r(async()=>{const e=await o(import("@vitest/eslint-plugin"));return[{files:p,ignores:y,...e.configs.recommended,name:"jimmy.codes/vitest",rules:await tr()}]},"vitestConfig"),sr=r(async({astro:e=!1,autoDetect:t=!0,ignores:s=[],jest:n=!1,nextjs:m=!1,overrides:T=[],playwright:_=!1,react:q=!1,storybook:S=!1,tanstackQuery:L=!1,testingLibrary:G=!1,typescript:A=!1,vitest:B=!1}={},...I)=>{const a=r((Q,Y)=>Q||t&&Y(),"resolveFlag"),j=a(A,Se),N=a(q,Le),D=a(e,Ne),$=a(L,Ie),V=a(G,Be),F=a(_,De),J=a(S,$e),X=a(m,R),U=a(n,Ae),z=a(B,Ge),H=[xe(),Oe(),Ee(),rr(),fe(),He(),we(),ge({typescript:j})],M=[j&&Ze(),N&&await Ue(),$&&await Qe(),D&&await ce(),U&&await be(),z&&await or(),V&&await We(),F&&await _e(),J&&await Me(),X&&await Pe()].filter(Boolean);return[...H,...M,qe(),le(),me(s),T,I].flat()},"eslintConfig");export{sr as default};
|
|
1
|
+
var K=Object.defineProperty;var r=(e,t)=>K(e,"name",{value:t,configurable:!0});import u from"globals";import{parser as Z,configs as l}from"typescript-eslint";import x from"@eslint-community/eslint-plugin-eslint-comments/configs";import{createTypeScriptImportResolver as ee}from"eslint-import-resolver-typescript";import d from"eslint-plugin-import-x";import h from"eslint-plugin-n";import re from"@eslint/js";import b from"eslint-plugin-jsdoc";import v from"eslint-plugin-perfectionist";import te from"eslint-config-prettier/flat";import{isPackageExists as i}from"local-pkg";import*as w from"eslint-plugin-regexp";import k from"eslint-plugin-unicorn";const c="?([cm])[jt]s?(x)",oe=["**/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"],P="**/*.?([cm])js",f="**/*.?([cm])jsx",se="**/*.?([cm])ts",g="**/*.?([cm])tsx",p=[`**/__tests__/**/*.${c}`,`**/*.spec.${c}`,`**/*.test.${c}`,`**/*.bench.${c}`,`**/*.benchmark.${c}`],C=[`**/e2e/**/*.spec.${c}`,`**/e2e/**/*.test.${c}`],y=[...C,`**/cypress/**/*.spec.${c}`,`**/cypress/**/*.test.${c}`],ne=[P,f,se,g],ie="**/*.cjs",ae="**/*.astro",ce=["@testing-library/react"],o=r(async e=>{const t=await e;return t.default??t},"interopDefault"),le=r(async()=>{const e=[ae],[t,s,n]=await Promise.all([import("eslint-plugin-astro"),import("astro-eslint-parser"),o(import("eslint-plugin-jsx-a11y"))]);return[{files:e,languageOptions:{globals:{...u.node,Astro:!1,Fragment:!1},parser:s,parserOptions:{extraFileExtensions:[".astro"],parser:Z},sourceType:"module"},name:"jimmy.codes/astro",plugins:{astro:t,"jsx-a11y":n},processor:"astro/client-side-ts",rules:{...n.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:l.disableTypeChecked.languageOptions?.parserOptions},name:"jimmy.codes/astro/disable-type-checked",rules:l.disableTypeChecked.rules},{name:"jimmy.codes/astro/imports",settings:{"import-x/core-modules":["astro:content"]}}]},"astroConfig"),pe=r(()=>[{files:[ie],languageOptions:{globals:u.commonjs},name:"jimmy.codes/commonjs"}],"commonjsConfig"),fe={...x.recommended.rules,"@eslint-community/eslint-comments/no-unused-disable":"off","@eslint-community/eslint-comments/require-description":"error"},me=r(()=>[{...x.recommended,name:"jimmy.codes/eslint-comments",rules:fe}],"eslintCommentsConfig"),ue=r(e=>[{ignores:[...oe,...e],name:"jimmy.codes/ignores"}],"ignoresConfig"),de={...d.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"},ge=r(()=>{const{rules:e,settings:t}=d.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":[ee({alwaysTryTypes:!0})]}}]},"importsTypescriptConfig"),ye=r(({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":d,n:h},rules:de},...e?ge():[]],"importsConfig"),je={"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"},xe={...re.configs.recommended.rules,...je},he=r(()=>[{linterOptions:{reportUnusedDisableDirectives:!0},name:"jimmy.codes/javascript",rules:xe},{files:p,name:"jimmy.codes/javascript/testing",rules:{"no-magic-numbers":"off"}}],"javascriptConfig"),be=r(async()=>{const e=await o(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"),ve=r(async()=>{const e=await o(import("eslint-plugin-jest"));return[{files:p,ignores:y,...e.configs["flat/recommended"],name:"jimmy.codes/jest",rules:await be()}]},"jestConfig"),we=r(()=>({...b.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,startLines:1}]}),"jsdocRules"),ke=r(()=>[{...b.configs["flat/recommended-typescript-error"],name:"jimmy.codes/jsdoc",rules:we()}],"jsdocConfig"),E=r((e={})=>Object.fromEntries(Object.entries(e).map(([t,s])=>[t,s==="warn"?"error":s])),"warningAsErrors"),Pe=r(async()=>{const e=await o(import("@next/eslint-plugin-next"));return E(e.configs.recommended.rules)},"nextjsRules"),Ce=r(async()=>{const e=await o(import("@next/eslint-plugin-next"));return[{files:ne,name:"jimmy.codes/nextjs",plugins:{"@next/next":e},rules:await Pe()}]},"nextjsConfig"),Ee={"n/no-process-exit":"off","n/prefer-node-protocol":"error"},Re=r(()=>[{name:"jimmy.codes/node",plugins:{n:h},rules:Ee}],"nodeConfig"),Oe={...v.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"},Te=r(()=>[{name:"jimmy.codes/perfectionist",plugins:{perfectionist:v},rules:Oe}],"perfectionistConfig"),_e=r(async()=>({...(await o(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"),qe=r(async()=>[{...(await o(import("eslint-plugin-playwright"))).configs["flat/recommended"],files:C,name:"jimmy.codes/playwright",rules:await _e()}],"playwrightConfig"),Le=r(()=>[{...te,name:"jimmy.codes/prettier"}],"prettierConfig"),Se=r(()=>i("typescript"),"hasTypescript"),Ge=r(()=>i("react"),"hasReact"),Ae=r(()=>i("vitest"),"hasVitest"),Be=r(()=>i("jest"),"hasJest"),Ie=r(()=>ce.some(e=>i(e)),"hasTestingLibrary"),Ne=r(()=>i("@tanstack/react-query"),"hasReactQuery"),De=r(()=>i("astro"),"hasAstro"),$e=r(()=>i("@playwright/test"),"hasPlaywright"),Ve=r(()=>i("storybook"),"hasStorybook"),R=r(()=>i("next"),"hasNext"),Fe=r(()=>i("vite"),"hasVite"),Je=r(e=>e===2?"error":e===1?"warn":"off","toStringSeverity"),O=r((e={})=>Object.fromEntries(Object.entries(e).map(([t,s])=>[t,typeof s=="number"?Je(s):s])),"normalizeRuleEntries"),Xe=["dynamic","dynamicParams","revalidate","fetchCache","runtime","preferredRegion","maxDuration","config","generateStaticParams","metadata","generateMetadata","viewport","generateViewport"],Ue=r(async()=>{const[e,t]=await Promise.all([o(import("eslint-plugin-react")),o(import("eslint-plugin-jsx-a11y"))]),s=R(),n=Fe();return{...t.configs.recommended.rules,...O(e.configs.flat.recommended?.rules),...O(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:n,allowExportNames:s?Xe:[]}],"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"),ze=r(async()=>{const[e,t,s,n,m]=await Promise.all([o(import("eslint-plugin-react")),o(import("eslint-plugin-jsx-a11y")),import("eslint-plugin-react-hooks"),o(import("eslint-plugin-react-refresh")),import("eslint-plugin-react-compiler")]);return[{files:[f,g],languageOptions:{globals:{...u.browser},parserOptions:{ecmaFeatures:{jsx:!0},jsxPragma:null}},name:"jimmy.codes/react",plugins:{"jsx-a11y":t,react:e,"react-compiler":m,"react-hooks":s,"react-refresh":n},rules:await Ue(),settings:{react:{version:"detect"}}}]},"reactConfig"),He={...w.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"},Me=r(()=>[{name:"jimmy.codes/regexp",plugins:{regexp:w},rules:He}],"regexpConfig"),Qe=r(async()=>{const{configs:e}=await o(import("eslint-plugin-storybook")),[t,s,n]=e["flat/recommended"];return[{name:"jimmy.codes/storybook/setup",plugins:t?.plugins},{files:s?.files,name:"jimmy.codes/storybook/stories-rules",rules:{...E(s?.rules),"import-x/no-anonymous-default-export":"off","unicorn/no-anonymous-default-export":"off"}},{files:n?.files,name:"jimmy.codes/storybook/main-rules",rules:{...n?.rules}}]},"storybookConfig"),Ye=r(async()=>{const e=await o(import("@tanstack/eslint-plugin-query"));return[{files:[f,g],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"),We=r(async()=>{const[e,t]=await Promise.all([import("eslint-plugin-jest-dom"),o(import("eslint-plugin-testing-library"))]);return{...t.configs["flat/react"].rules,...e.configs["flat/recommended"].rules}},"testingLibraryRules"),Ke=r(async()=>{const[e,t]=await Promise.all([import("eslint-plugin-jest-dom"),o(import("eslint-plugin-testing-library"))]);return[{files:p,ignores:y,name:"jimmy.codes/testing-library",plugins:{"jest-dom":e,"testing-library":t},rules:await We()}]},"testingLibraryConfig"),Ze={"@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"},er=r(()=>[...l.strictTypeChecked,...l.stylisticTypeChecked.filter(e=>e.name==="typescript-eslint/stylistic-type-checked"),{languageOptions:{parserOptions:{projectService:!0,tsconfigRootDir:process.cwd()}},name:"jimmy.codes/typescript",rules:Ze},{files:[P,f],...l.disableTypeChecked},{files:p,name:"jimmy.codes/typescript/testing",rules:{"@typescript-eslint/no-unsafe-argument":"off","@typescript-eslint/no-unsafe-assignment":"off"}}],"typescriptConfig"),rr={...k.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"},tr=r(()=>[{...k.configs["flat/recommended"],name:"jimmy.codes/unicorn",rules:rr}],"unicornConfig"),or=r(async()=>({...(await o(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"),sr=r(async()=>{const e=await o(import("@vitest/eslint-plugin"));return[{files:p,ignores:y,...e.configs.recommended,name:"jimmy.codes/vitest",rules:await or()}]},"vitestConfig"),T=r(async({astro:e=!1,autoDetect:t=!0,ignores:s=[],jest:n=!1,nextjs:m=!1,overrides:_=[],playwright:q=!1,react:L=!1,storybook:S=!1,tanstackQuery:G=!1,testingLibrary:A=!1,typescript:B=!1,vitest:I=!1}={},...N)=>{const a=r((Y,W)=>Y||t&&W(),"resolveFlag"),j=a(B,Se),D=a(L,Ge),$=a(e,De),V=a(G,Ne),F=a(A,Ie),J=a(q,$e),X=a(S,Ve),U=a(m,R),z=a(n,Be),H=a(I,Ae),M=[he(),Te(),Re(),tr(),me(),Me(),ke(),ye({typescript:j})],Q=[j&&er(),D&&await ze(),V&&await Ye(),$&&await le(),z&&await ve(),H&&await sr(),F&&await Ke(),J&&await qe(),X&&await Qe(),U&&await Ce()].filter(Boolean);return[...M,...Q,Le(),pe(),ue(s),_,N].flat()},"defineConfig");export{T as default,T as defineConfig};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jimmy.codes/eslint-config",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"description": "another opinionated eslint config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"eslint-plugin-import-x": "^4.6.1",
|
|
47
47
|
"eslint-plugin-jest": "^28.11.0",
|
|
48
48
|
"eslint-plugin-jest-dom": "^5.5.0",
|
|
49
|
-
"eslint-plugin-jsdoc": "^50.6.
|
|
49
|
+
"eslint-plugin-jsdoc": "^50.6.6",
|
|
50
50
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
51
51
|
"eslint-plugin-n": "^17.15.1",
|
|
52
52
|
"eslint-plugin-perfectionist": "^4.9.0",
|