@jimmy.codes/eslint-config 3.27.1 → 3.28.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/dist/index.cjs +1 -1
- package/dist/index.d.cts +765 -1
- package/dist/index.d.mts +765 -1
- package/dist/index.mjs +1 -1
- package/package.json +4 -3
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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 p}from"typescript-eslint";import P from"@eslint-community/eslint-plugin-eslint-comments/configs";import{createTypeScriptImportResolver as D}from"eslint-import-resolver-typescript";import d from"eslint-plugin-import-x";import C from"eslint-plugin-n";import ee from"@eslint/js";import O from"eslint-plugin-perfectionist";import re from"eslint-config-prettier";import{isPackageExists as i}from"local-pkg";import*as E from"eslint-plugin-regexp";import T from"eslint-plugin-unicorn";const a="?([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"],R="**/*.?([cm])js",f="**/*.?([cm])jsx",oe="**/*.?([cm])ts",g="**/*.?([cm])tsx",m=[`**/__tests__/**/*.${a}`,`**/*.spec.${a}`,`**/*.test.${a}`,`**/*.bench.${a}`,`**/*.benchmark.${a}`],_=[`**/e2e/**/*.spec.${a}`,`**/e2e/**/*.test.${a}`],y=[..._,`**/cypress/**/*.spec.${a}`,`**/cypress/**/*.test.${a}`],se=[R,f,oe,g],ne="**/*.cjs",ie="**/*.astro",ae=["@testing-library/react"],s=r(async e=>{const t=await e;return t.default??t},"interopDefault"),ce=r(async()=>{const e=[ie],[t,o,n]=await Promise.all([import("eslint-plugin-astro"),import("astro-eslint-parser"),s(import("eslint-plugin-jsx-a11y"))]);return[{files:e,languageOptions:{globals:{...u.node,Astro:!1,Fragment:!1},parser:o,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:p.disableTypeChecked.languageOptions?.parserOptions},name:"jimmy.codes/astro/disable-type-checked",rules:p.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={...P.recommended.rules,"@eslint-community/eslint-comments/no-unused-disable":"off","@eslint-community/eslint-comments/require-description":"error"},fe=r(()=>[{...P.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":[D({alwaysTryTypes:!0})]}}]},"importsTypescriptConfig"),ge=r(({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":d,n:C},rules:ue},...e?de():[]],"importsConfig"),ye={...ee.configs.recommended.rules,"array-callback-return":["error",{allowImplicit:!0}],"arrow-body-style":["error","always"],curly:["error","all"],"no-console":"warn","no-self-compare":"error","no-template-curly-in-string":"error","no-unmodified-loop-condition":"error","no-unreachable-loop":"error","no-use-before-define":["error",{allowNamedExports:!1,classes:!1,functions:!1,variables:!0}],"no-useless-rename":"error","object-shorthand":"error","prefer-arrow-callback":"error"},he=r(()=>[{linterOptions:{reportUnusedDisableDirectives:!0},name:"jimmy.codes/javascript",rules:ye}],"javascriptConfig"),q=r((e={})=>Object.fromEntries(Object.entries(e).map(([t,o])=>[t,o==="warn"?"error":o])),"warningAsErrors"),xe=r(async()=>{const e=await s(import("@next/eslint-plugin-next"));return q(e.configs.recommended.rules)},"nextjsRules"),je=r(async()=>{const e=await s(import("@next/eslint-plugin-next"));return[{files:se,name:"jimmy.codes/nextjs",plugins:{"@next/next":e},rules:await xe()}]},"nextjsConfig"),ve={"n/no-process-exit":"off","n/prefer-node-protocol":"error"},be=r(()=>[{name:"jimmy.codes/node",plugins:{n:C},rules:ve}],"nodeConfig"),we={...O.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"},ke=r(()=>[{name:"jimmy.codes/perfectionist",plugins:{perfectionist:O},rules:we}],"perfectionistConfig"),Pe=r(async()=>({...(await s(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-useless-await":"error","playwright/no-useless-not":"error","playwright/no-wait-for-selector":"error","playwright/no-wait-for-timeout":"error"}),"playwrightRules"),Ce=r(async()=>[{...(await s(import("eslint-plugin-playwright"))).configs["flat/recommended"],files:_,name:"jimmy.codes/playwright",rules:await Pe()}],"playwrightConfig"),Oe=r(()=>[{name:"jimmy.codes/prettier",...re}],"prettierConfig"),Ee=r(()=>i("typescript"),"hasTypescript"),Te=r(()=>i("react"),"hasReact"),L=r(()=>i("vitest"),"hasVitest"),S=r(()=>i("jest"),"hasJest"),Re=r(()=>L()||S(),"hasTesting"),_e=r(()=>ae.some(e=>i(e)),"hasTestingLibrary"),qe=r(()=>i("@tanstack/react-query"),"hasReactQuery"),Le=r(()=>i("astro"),"hasAstro"),Se=r(()=>i("@playwright/test"),"hasPlaywright"),Ge=r(()=>i("storybook"),"hasStorybook"),G=r(()=>i("next"),"hasNext"),Ae=r(()=>i("vite"),"hasVite"),Be=r(e=>e===2?"error":e===1?"warn":"off","toStringSeverity"),A=r((e={})=>Object.fromEntries(Object.entries(e).map(([t,o])=>[t,typeof o=="number"?Be(o):o])),"normalizeRuleEntries"),Ie=["dynamic","dynamicParams","revalidate","fetchCache","runtime","preferredRegion","maxDuration","config","generateStaticParams","metadata","generateMetadata","viewport","generateViewport"],Ne=r(async()=>{const[e,t]=await Promise.all([s(import("eslint-plugin-react")),s(import("eslint-plugin-jsx-a11y"))]),o=G(),n=Ae();return{...t.configs.recommended.rules,...A(e.configs.flat?.recommended?.rules),...A(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:o?Ie:[]}],"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"),$e=r(async()=>{const[e,t,o,n,c]=await Promise.all([s(import("eslint-plugin-react")),s(import("eslint-plugin-jsx-a11y")),import("eslint-plugin-react-hooks"),s(import("eslint-plugin-react-refresh")),s(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":c,"react-hooks":o,"react-refresh":n},rules:await Ne(),settings:{react:{version:"detect"}}}]},"reactConfig"),Je={...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"},Ve=r(()=>[{name:"jimmy.codes/regexp",plugins:{regexp:E},rules:Je}],"regexpConfig"),Fe=r(async()=>{const{configs:e}=await s(import("eslint-plugin-storybook")),[t,o,n]=e["flat/recommended"];return[{name:"jimmy.codes/storybook/setup",plugins:t?.plugins},{files:o?.files,name:"jimmy.codes/storybook/stories-rules",rules:{...q(o?.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"),Xe=r(async()=>{const e=await s(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"),Qe=r(async()=>{const e=await s(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"),Ue=r(async()=>({...(await s(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-done-callback":"error","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-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-describe-callback":"error","vitest/valid-expect":"error","vitest/valid-expect-in-promise":"error","vitest/valid-title":"error"}),"vitestRules"),ze=r(async({framework:e="vitest"}={},t=!0)=>{const o=t?L():e==="vitest",n=e==="jest"||t&&S(),c=[];if(o){const l=await s(import("@vitest/eslint-plugin"));c.push({files:m,ignores:y,...l.configs.recommended,name:"jimmy.codes/vitest",rules:await Ue()})}if(n){const l=await s(import("eslint-plugin-jest"));c.push({files:m,ignores:y,...l.configs["flat/recommended"],name:"jimmy.codes/jest",rules:await Qe()})}return c},"testingConfig"),He=r(async()=>{const[e,t]=await Promise.all([import("eslint-plugin-jest-dom"),s(import("eslint-plugin-testing-library"))]);return{...t.configs["flat/react"].rules,...e.configs["flat/recommended"].rules}},"testingLibraryRules"),Me=r(async()=>{const[e,t]=await Promise.all([import("eslint-plugin-jest-dom"),s(import("eslint-plugin-testing-library"))]);return[{files:m,ignores:y,name:"jimmy.codes/testing-library",plugins:{"jest-dom":e,"testing-library":t},rules:await He()}]},"testingLibraryConfig"),Ye={"@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"},We=r(e=>[...p.strictTypeChecked,...p.stylisticTypeChecked.filter(t=>t.name==="typescript-eslint/stylistic-type-checked"),{languageOptions:{parserOptions:{...e?.project?{project:e.project}:{projectService:!0},tsconfigRootDir:process.cwd()}},name:"jimmy.codes/typescript",rules:Ye},{files:[R,f],...p.disableTypeChecked},{files:m,name:"jimmy.codes/typescript/testing",rules:{"@typescript-eslint/no-unsafe-argument":"off","@typescript-eslint/no-unsafe-assignment":"off"}}],"typescriptConfig"),Ke={...T.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"},Ze=r(()=>[{...T.configs["flat/recommended"],name:"jimmy.codes/unicorn",rules:Ke}],"unicornConfig"),De=r(e=>typeof e=="object"?e:void 0,"getTypescriptOptions"),er=r((e,t)=>typeof e=="object"?e:{framework:t.vitest?"vitest":t.jest?"jest":"vitest",...t.testingLibrary&&{utilities:["testing-library"]}},"getTestingOptions"),rr=r(e=>typeof e=="object"?e:{utilities:[]},"getReactOptions"),tr=r(({utilities:e=[]},t,o)=>t||e.includes("@tanstack/query")||o&&qe(),"shouldEnableTanstackQuery"),or=r(({utilities:e=[]},t)=>e.includes("testing-library")||t&&_e(),"shouldEnableTestingLibrary"),sr=r(async({astro:e=!1,autoDetect:t=!0,configs:o=[],ignores:n=[],jest:c=!1,nextjs:l=!1,overrides:B=[],playwright:I=!1,react:h=!1,storybook:N=!1,tanstackQuery:$=!1,testing:x=!1,testingLibrary:J=!1,typescript:j=!1,vitest:v=!1}={},...V)=>{const F=rr(h),b=er(x,{jest:c,testingLibrary:J,vitest:v}),w=De(j),k=j||!!w||t&&Ee(),X=h||t&&Te(),Q=x||c||v||t&&Re(),U=e||t&&Le(),z=tr(F,$,t),H=or(b,t),M=I||t&&Se(),Y=N||t&&Ge(),W=l||t&&G();return[he(),ke(),be(),Ze(),fe(),Ve(),ge({typescript:k}),k?We(w):[],X?await $e():[],z?await Xe():[],U?await ce():[],Q?await ze(b,t):[],H?await Me():[],M?await Ce():[],Y?await Fe():[],W?await je():[],Oe(),le(),me(n),o,B,V].flat()},"eslintConfig");export{sr as default};
|
|
1
|
+
var Z=Object.defineProperty;var r=(e,t)=>Z(e,"name",{value:t,configurable:!0});import u from"globals";import{parser as D,configs as p}from"typescript-eslint";import P 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 C from"eslint-plugin-n";import re from"@eslint/js";import O from"eslint-plugin-jsdoc";import E from"eslint-plugin-perfectionist";import te from"eslint-config-prettier";import{isPackageExists as i}from"local-pkg";import*as T from"eslint-plugin-regexp";import R from"eslint-plugin-unicorn";const a="?([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"],_="**/*.?([cm])js",f="**/*.?([cm])jsx",se="**/*.?([cm])ts",g="**/*.?([cm])tsx",m=[`**/__tests__/**/*.${a}`,`**/*.spec.${a}`,`**/*.test.${a}`,`**/*.bench.${a}`,`**/*.benchmark.${a}`],q=[`**/e2e/**/*.spec.${a}`,`**/e2e/**/*.test.${a}`],y=[...q,`**/cypress/**/*.spec.${a}`,`**/cypress/**/*.test.${a}`],ne=[_,f,se,g],ie="**/*.cjs",ae="**/*.astro",ce=["@testing-library/react"],s=r(async e=>{const t=await e;return t.default??t},"interopDefault"),le=r(async()=>{const e=[ae],[t,o,n]=await Promise.all([import("eslint-plugin-astro"),import("astro-eslint-parser"),s(import("eslint-plugin-jsx-a11y"))]);return[{files:e,languageOptions:{globals:{...u.node,Astro:!1,Fragment:!1},parser:o,parserOptions:{extraFileExtensions:[".astro"],parser:D},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:p.disableTypeChecked.languageOptions?.parserOptions},name:"jimmy.codes/astro/disable-type-checked",rules:p.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={...P.recommended.rules,"@eslint-community/eslint-comments/no-unused-disable":"off","@eslint-community/eslint-comments/require-description":"error"},me=r(()=>[{...P.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:C},rules:de},...e?ge():[]],"importsConfig"),je={...re.configs.recommended.rules,"array-callback-return":["error",{allowImplicit:!0}],"arrow-body-style":["error","always"],curly:["error","all"],"no-console":"warn","no-self-compare":"error","no-template-curly-in-string":"error","no-unmodified-loop-condition":"error","no-unreachable-loop":"error","no-use-before-define":["error",{allowNamedExports:!1,classes:!1,functions:!1,variables:!0}],"no-useless-rename":"error","object-shorthand":"error","prefer-arrow-callback":"error"},he=r(()=>[{linterOptions:{reportUnusedDisableDirectives:!0},name:"jimmy.codes/javascript",rules:je}],"javascriptConfig"),xe=r(()=>({...O.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"),ve=r(()=>[{...O.configs["flat/recommended-typescript-error"],name:"jimmy.codes/jsdoc",rules:xe()}],"jsdocConfig"),L=r((e={})=>Object.fromEntries(Object.entries(e).map(([t,o])=>[t,o==="warn"?"error":o])),"warningAsErrors"),be=r(async()=>{const e=await s(import("@next/eslint-plugin-next"));return L(e.configs.recommended.rules)},"nextjsRules"),we=r(async()=>{const e=await s(import("@next/eslint-plugin-next"));return[{files:ne,name:"jimmy.codes/nextjs",plugins:{"@next/next":e},rules:await be()}]},"nextjsConfig"),ke={"n/no-process-exit":"off","n/prefer-node-protocol":"error"},Pe=r(()=>[{name:"jimmy.codes/node",plugins:{n:C},rules:ke}],"nodeConfig"),Ce={...E.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:E},rules:Ce}],"perfectionistConfig"),Ee=r(async()=>({...(await s(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-useless-await":"error","playwright/no-useless-not":"error","playwright/no-wait-for-selector":"error","playwright/no-wait-for-timeout":"error"}),"playwrightRules"),Te=r(async()=>[{...(await s(import("eslint-plugin-playwright"))).configs["flat/recommended"],files:q,name:"jimmy.codes/playwright",rules:await Ee()}],"playwrightConfig"),Re=r(()=>[{name:"jimmy.codes/prettier",...te}],"prettierConfig"),_e=r(()=>i("typescript"),"hasTypescript"),qe=r(()=>i("react"),"hasReact"),S=r(()=>i("vitest"),"hasVitest"),G=r(()=>i("jest"),"hasJest"),Le=r(()=>S()||G(),"hasTesting"),Se=r(()=>ce.some(e=>i(e)),"hasTestingLibrary"),Ge=r(()=>i("@tanstack/react-query"),"hasReactQuery"),Ae=r(()=>i("astro"),"hasAstro"),Be=r(()=>i("@playwright/test"),"hasPlaywright"),Ie=r(()=>i("storybook"),"hasStorybook"),A=r(()=>i("next"),"hasNext"),Ne=r(()=>i("vite"),"hasVite"),$e=r(e=>e===2?"error":e===1?"warn":"off","toStringSeverity"),B=r((e={})=>Object.fromEntries(Object.entries(e).map(([t,o])=>[t,typeof o=="number"?$e(o):o])),"normalizeRuleEntries"),Je=["dynamic","dynamicParams","revalidate","fetchCache","runtime","preferredRegion","maxDuration","config","generateStaticParams","metadata","generateMetadata","viewport","generateViewport"],Ve=r(async()=>{const[e,t]=await Promise.all([s(import("eslint-plugin-react")),s(import("eslint-plugin-jsx-a11y"))]),o=A(),n=Ne();return{...t.configs.recommended.rules,...B(e.configs.flat?.recommended?.rules),...B(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:o?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"),Fe=r(async()=>{const[e,t,o,n,c]=await Promise.all([s(import("eslint-plugin-react")),s(import("eslint-plugin-jsx-a11y")),import("eslint-plugin-react-hooks"),s(import("eslint-plugin-react-refresh")),s(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":c,"react-hooks":o,"react-refresh":n},rules:await Ve(),settings:{react:{version:"detect"}}}]},"reactConfig"),Xe={...T.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"},Qe=r(()=>[{name:"jimmy.codes/regexp",plugins:{regexp:T},rules:Xe}],"regexpConfig"),Ue=r(async()=>{const{configs:e}=await s(import("eslint-plugin-storybook")),[t,o,n]=e["flat/recommended"];return[{name:"jimmy.codes/storybook/setup",plugins:t?.plugins},{files:o?.files,name:"jimmy.codes/storybook/stories-rules",rules:{...L(o?.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"),ze=r(async()=>{const e=await s(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"),He=r(async()=>{const e=await s(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"),Me=r(async()=>({...(await s(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-done-callback":"error","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-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-describe-callback":"error","vitest/valid-expect":"error","vitest/valid-expect-in-promise":"error","vitest/valid-title":"error"}),"vitestRules"),Ye=r(async({framework:e="vitest"}={},t=!0)=>{const o=t?S():e==="vitest",n=e==="jest"||t&&G(),c=[];if(o){const l=await s(import("@vitest/eslint-plugin"));c.push({files:m,ignores:y,...l.configs.recommended,name:"jimmy.codes/vitest",rules:await Me()})}if(n){const l=await s(import("eslint-plugin-jest"));c.push({files:m,ignores:y,...l.configs["flat/recommended"],name:"jimmy.codes/jest",rules:await He()})}return c},"testingConfig"),We=r(async()=>{const[e,t]=await Promise.all([import("eslint-plugin-jest-dom"),s(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"),s(import("eslint-plugin-testing-library"))]);return[{files:m,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"},De=r(e=>[...p.strictTypeChecked,...p.stylisticTypeChecked.filter(t=>t.name==="typescript-eslint/stylistic-type-checked"),{languageOptions:{parserOptions:{...e?.project?{project:e.project}:{projectService:!0},tsconfigRootDir:process.cwd()}},name:"jimmy.codes/typescript",rules:Ze},{files:[_,f],...p.disableTypeChecked},{files:m,name:"jimmy.codes/typescript/testing",rules:{"@typescript-eslint/no-unsafe-argument":"off","@typescript-eslint/no-unsafe-assignment":"off"}}],"typescriptConfig"),er={...R.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(()=>[{...R.configs["flat/recommended"],name:"jimmy.codes/unicorn",rules:er}],"unicornConfig"),tr=r(e=>typeof e=="object"?e:void 0,"getTypescriptOptions"),or=r((e,t)=>typeof e=="object"?e:{framework:t.vitest?"vitest":t.jest?"jest":"vitest",...t.testingLibrary&&{utilities:["testing-library"]}},"getTestingOptions"),sr=r(e=>typeof e=="object"?e:{utilities:[]},"getReactOptions"),nr=r(({utilities:e=[]},t,o)=>t||e.includes("@tanstack/query")||o&&Ge(),"shouldEnableTanstackQuery"),ir=r(({utilities:e=[]},t)=>e.includes("testing-library")||t&&Se(),"shouldEnableTestingLibrary"),ar=r(async({astro:e=!1,autoDetect:t=!0,configs:o=[],ignores:n=[],jest:c=!1,nextjs:l=!1,overrides:I=[],playwright:N=!1,react:j=!1,storybook:$=!1,tanstackQuery:J=!1,testing:h=!1,testingLibrary:V=!1,typescript:x=!1,vitest:v=!1}={},...F)=>{const X=sr(j),b=or(h,{jest:c,testingLibrary:V,vitest:v}),w=tr(x),k=x||!!w||t&&_e(),Q=j||t&&qe(),U=h||c||v||t&&Le(),z=e||t&&Ae(),H=nr(X,J,t),M=ir(b,t),Y=N||t&&Be(),W=$||t&&Ie(),K=l||t&&A();return[he(),Oe(),Pe(),rr(),me(),Qe(),ve(),ye({typescript:k}),k?De(w):[],Q?await Fe():[],H?await ze():[],z?await le():[],U?await Ye(b,t):[],M?await Ke():[],Y?await Te():[],W?await Ue():[],K?await we():[],Re(),pe(),ue(n),o,I,F].flat()},"eslintConfig");export{ar as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jimmy.codes/eslint-config",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.28.1",
|
|
4
4
|
"description": "another opinionated eslint config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@types/eslint": "9.6.1",
|
|
39
39
|
"@typescript-eslint/parser": "^8.17.0",
|
|
40
40
|
"@typescript-eslint/utils": "^8.17.0",
|
|
41
|
-
"@vitest/eslint-plugin": "^1.1.
|
|
41
|
+
"@vitest/eslint-plugin": "^1.1.16",
|
|
42
42
|
"astro-eslint-parser": "^1.1.0",
|
|
43
43
|
"eslint-config-prettier": "^9.1.0",
|
|
44
44
|
"eslint-import-resolver-typescript": "^3.7.0",
|
|
@@ -46,12 +46,13 @@
|
|
|
46
46
|
"eslint-plugin-import-x": "^4.5.0",
|
|
47
47
|
"eslint-plugin-jest": "^28.9.0",
|
|
48
48
|
"eslint-plugin-jest-dom": "^5.5.0",
|
|
49
|
+
"eslint-plugin-jsdoc": "^50.6.1",
|
|
49
50
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
50
51
|
"eslint-plugin-n": "^17.14.0",
|
|
51
52
|
"eslint-plugin-perfectionist": "^4.2.0",
|
|
52
53
|
"eslint-plugin-playwright": "^2.1.0",
|
|
53
54
|
"eslint-plugin-react": "^7.37.2",
|
|
54
|
-
"eslint-plugin-react-compiler": "19.0.0-beta-
|
|
55
|
+
"eslint-plugin-react-compiler": "19.0.0-beta-37ed2a7-20241206",
|
|
55
56
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
56
57
|
"eslint-plugin-react-refresh": "0.4.16",
|
|
57
58
|
"eslint-plugin-regexp": "^2.7.0",
|