@jimmy.codes/eslint-config 3.24.0 → 3.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +152 -93
- package/dist/index.d.mts +152 -93
- package/dist/index.mjs +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var K=Object.defineProperty;var r=(e,t)=>K(e,"name",{value:t,configurable:!0});import d from"globals";import{parser as Z,configs as p}from"typescript-eslint";import P from"@eslint-community/eslint-plugin-eslint-comments/configs";import f from"eslint-plugin-import-x";import C from"eslint-plugin-n";import D from"@eslint/js";import O from"eslint-plugin-perfectionist";import ee 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)",re=["**/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",m="**/*.?([cm])jsx",te="**/*.?([cm])ts",g="**/*.?([cm])tsx",u=[`**/__tests__/**/*.${a}`,`**/*.spec.${a}`,`**/*.test.${a}`,`**/*.bench.${a}`,`**/*.benchmark.${a}`],R=[`**/e2e/**/*.spec.${a}`,`**/e2e/**/*.test.${a}`],y=[...R,`**/cypress/**/*.spec.${a}`,`**/cypress/**/*.test.${a}`],oe=[_,m,te,g],se="**/*.cjs",ne="**/*.astro",ie=["vi.mock","describe","expect","it"],ae=["@testing-library/react"],s=r(async e=>{const t=await e;return t.default??t},"interopDefault"),ce=r(async()=>{const e=[ne],[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:{...d.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:[se],languageOptions:{globals:d.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:[...re,...e],name:"jimmy.codes/ignores"}],"ignoresConfig"),ue={...f.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={name:"jimmy.codes/imports/typescript",rules:f.configs.typescript.rules,settings:{...f.configs.typescript.settings,"import-x/resolver":{...f.configs.typescript.settings["import-x/resolver"],typescript:!0}}},ge=r(({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":f,n:C},rules:ue},...e?[de]:[]],"importsConfig"),ye={...D.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"},je=r(()=>[{linterOptions:{reportUnusedDisableDirectives:!0},name:"jimmy.codes/javascript",rules:ye}],"javascriptConfig"),xe=r(async()=>({...(await s(import("@next/eslint-plugin-next"))).configs["core-web-vitals"].rules}),"nextjsRules"),he=r(async()=>{const e=await s(import("@next/eslint-plugin-next"));return[{files:oe,name:"jimmy.codes/nextjs",plugins:{"@next/next":e},rules:await xe()}]},"nextjsConfig"),be={"n/no-process-exit":"off","n/prefer-node-protocol":"error"},we=r(()=>[{name:"jimmy.codes/node",plugins:{n:C},rules:be}],"nodeConfig"),ke={...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"},ve=r(()=>[{name:"jimmy.codes/perfectionist",plugins:{perfectionist:O},rules:ke}],"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:R,name:"jimmy.codes/playwright",rules:await Pe()}],"playwrightConfig"),Oe=r(()=>[{name:"jimmy.codes/prettier",...ee}],"prettierConfig"),Ee=r(()=>i("typescript"),"hasTypescript"),Te=r(()=>i("react"),"hasReact"),L=r(()=>i("vitest"),"hasVitest"),S=r(()=>i("jest"),"hasJest"),_e=r(()=>L()||S(),"hasTesting"),Re=r(()=>ae.some(e=>i(e)),"hasTestingLibrary"),Le=r(()=>i("@tanstack/react-query"),"hasReactQuery"),Se=r(()=>i("astro"),"hasAstro"),qe=r(()=>i("@playwright/test"),"hasPlaywright"),Ge=r(()=>i("storybook"),"hasStorybook"),q=r(()=>i("next"),"hasNext"),Ae=r(()=>i("vite"),"hasVite"),Ie=r(e=>e===2?"error":e===1?"warn":"off","toStringSeverity"),G=r((e={})=>Object.fromEntries(Object.entries(e).map(([t,o])=>[t,typeof o=="number"?Ie(o):o])),"normalizeRuleEntries"),Ne=["dynamic","dynamicParams","revalidate","fetchCache","runtime","preferredRegion","maxDuration","config","generateStaticParams","metadata","generateMetadata","viewport","generateViewport"],Be=r(async()=>{const[e,t]=await Promise.all([s(import("eslint-plugin-react")),s(import("eslint-plugin-jsx-a11y"))]),o=q(),n=Ae();return{...t.configs.recommended.rules,...G(e.configs.flat?.recommended?.rules),...G(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?Ne:[]}],"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:[m,g],languageOptions:{globals:{...d.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 Be(),settings:{react:{version:"detect"}}}]},"reactConfig"),Fe={...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:Fe}],"regexpConfig"),Je=r((e={})=>Object.fromEntries(Object.entries(e).map(([t,o])=>[t,o==="warn"?"error":o])),"warningAsErrors"),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:{...Je(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:[m,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"),A=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"),Qe=r(async()=>({...await A(),"jest/no-deprecated-functions":"off","jest/require-hook":["error",{allowedFunctionCalls:ie}]}),"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("eslint-plugin-jest"));c.push({files:u,ignores:y,...l.configs["flat/recommended"],name:"jimmy.codes/vitest",rules:await Qe()})}if(n){const l=await s(import("eslint-plugin-jest"));c.push({files:u,ignores:y,...l.configs["flat/recommended"],name:"jimmy.codes/jest",rules:await A()})}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:u,ignores:y,name:"jimmy.codes/testing-library",plugins:{"jest-dom":e,"testing-library":t},rules:await He()}]},"testingLibraryConfig"),We={"@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"},Ye=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:We},{files:[_,m],...p.disableTypeChecked},{files:u,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&&Le(),"shouldEnableTanstackQuery"),or=r(({utilities:e=[]},t)=>e.includes("testing-library")||t&&Re(),"shouldEnableTestingLibrary"),sr=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:B=!1,tanstackQuery:$=!1,testing:x=!1,testingLibrary:F=!1,typescript:h=!1,vitest:b=!1}={},...V)=>{const J=rr(j),w=er(x,{jest:c,testingLibrary:F,vitest:b}),k=De(h),v=h||!!k||t&&Ee(),U=j||t&&Te(),X=x||c||b||t&&_e(),Q=e||t&&Se(),z=tr(J,$,t),H=or(w,t),M=N||t&&qe(),W=B||t&&Ge(),Y=l||t&&q();return[je(),ve(),we(),Ze(),fe(),Ve(),ge({typescript:v}),v?Ye(k):[],U?await $e():[],z?await Xe():[],Q?await ce():[],X?await ze(w,t):[],H?await Me():[],M?await Ce():[],W?await Ue():[],Y?await he():[],Oe(),le(),me(n),o,I,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-perfectionist";import te 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)",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"],R="**/*.?([cm])js",m="**/*.?([cm])jsx",se="**/*.?([cm])ts",g="**/*.?([cm])tsx",f=[`**/__tests__/**/*.${a}`,`**/*.spec.${a}`,`**/*.test.${a}`,`**/*.bench.${a}`,`**/*.benchmark.${a}`],_=[`**/e2e/**/*.spec.${a}`,`**/e2e/**/*.test.${a}`],y=[..._,`**/cypress/**/*.spec.${a}`,`**/cypress/**/*.test.${a}`],ne=[R,m,se,g],ie="**/*.cjs",ae="**/*.astro",ce=["vi.mock","describe","expect","it"],le=["@testing-library/react"],s=r(async e=>{const t=await e;return t.default??t},"interopDefault"),pe=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"),me=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"},ue=r(()=>[{...P.recommended,name:"jimmy.codes/eslint-comments",rules:fe}],"eslintCommentsConfig"),de=r(e=>[{ignores:[...oe,...e],name:"jimmy.codes/ignores"}],"ignoresConfig"),ge={...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"},ye=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"),je=r(({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":d,n:C},rules:ge},...e?ye():[]],"importsConfig"),xe={...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:xe}],"javascriptConfig"),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"},ve=r(()=>[{name:"jimmy.codes/node",plugins:{n:C},rules:ke}],"nodeConfig"),Pe={...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"},Ce=r(()=>[{name:"jimmy.codes/perfectionist",plugins:{perfectionist:O},rules:Pe}],"perfectionistConfig"),Oe=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"),Ee=r(async()=>[{...(await s(import("eslint-plugin-playwright"))).configs["flat/recommended"],files:_,name:"jimmy.codes/playwright",rules:await Oe()}],"playwrightConfig"),Te=r(()=>[{name:"jimmy.codes/prettier",...te}],"prettierConfig"),Re=r(()=>i("typescript"),"hasTypescript"),_e=r(()=>i("react"),"hasReact"),S=r(()=>i("vitest"),"hasVitest"),q=r(()=>i("jest"),"hasJest"),Le=r(()=>S()||q(),"hasTesting"),Se=r(()=>le.some(e=>i(e)),"hasTestingLibrary"),qe=r(()=>i("@tanstack/react-query"),"hasReactQuery"),Ge=r(()=>i("astro"),"hasAstro"),Ae=r(()=>i("@playwright/test"),"hasPlaywright"),Ie=r(()=>i("storybook"),"hasStorybook"),G=r(()=>i("next"),"hasNext"),Ne=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"),$e=["dynamic","dynamicParams","revalidate","fetchCache","runtime","preferredRegion","maxDuration","config","generateStaticParams","metadata","generateMetadata","viewport","generateViewport"],Fe=r(async()=>{const[e,t]=await Promise.all([s(import("eslint-plugin-react")),s(import("eslint-plugin-jsx-a11y"))]),o=G(),n=Ne();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?$e:[]}],"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"),Ve=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:[m,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 Fe(),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"},Ue=r(()=>[{name:"jimmy.codes/regexp",plugins:{regexp:E},rules:Je}],"regexpConfig"),Xe=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"),Qe=r(async()=>{const e=await s(import("@tanstack/eslint-plugin-query"));return[{files:[m,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"),I=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"),ze=r(async()=>({...await I(),"jest/no-deprecated-functions":"off","jest/require-hook":["error",{allowedFunctionCalls:ce}]}),"vitestRules"),He=r(async({framework:e="vitest"}={},t=!0)=>{const o=t?S():e==="vitest",n=e==="jest"||t&&q(),c=[];if(o){const l=await s(import("eslint-plugin-jest"));c.push({files:f,ignores:y,...l.configs["flat/recommended"],name:"jimmy.codes/vitest",rules:await ze()})}if(n){const l=await s(import("eslint-plugin-jest"));c.push({files:f,ignores:y,...l.configs["flat/recommended"],name:"jimmy.codes/jest",rules:await I()})}return c},"testingConfig"),Me=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"),We=r(async()=>{const[e,t]=await Promise.all([import("eslint-plugin-jest-dom"),s(import("eslint-plugin-testing-library"))]);return[{files:f,ignores:y,name:"jimmy.codes/testing-library",plugins:{"jest-dom":e,"testing-library":t},rules:await Me()}]},"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"},Ke=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,m],...p.disableTypeChecked},{files:f,name:"jimmy.codes/typescript/testing",rules:{"@typescript-eslint/no-unsafe-argument":"off","@typescript-eslint/no-unsafe-assignment":"off"}}],"typescriptConfig"),Ze={...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"},De=r(()=>[{...T.configs["flat/recommended"],name:"jimmy.codes/unicorn",rules:Ze}],"unicornConfig"),er=r(e=>typeof e=="object"?e:void 0,"getTypescriptOptions"),rr=r((e,t)=>typeof e=="object"?e:{framework:t.vitest?"vitest":t.jest?"jest":"vitest",...t.testingLibrary&&{utilities:["testing-library"]}},"getTestingOptions"),tr=r(e=>typeof e=="object"?e:{utilities:[]},"getReactOptions"),or=r(({utilities:e=[]},t,o)=>t||e.includes("@tanstack/query")||o&&qe(),"shouldEnableTanstackQuery"),sr=r(({utilities:e=[]},t)=>e.includes("testing-library")||t&&Se(),"shouldEnableTestingLibrary"),nr=r(async({astro:e=!1,autoDetect:t=!0,configs:o=[],ignores:n=[],jest:c=!1,nextjs:l=!1,overrides:N=[],playwright:B=!1,react:j=!1,storybook:$=!1,tanstackQuery:F=!1,testing:x=!1,testingLibrary:V=!1,typescript:h=!1,vitest:b=!1}={},...J)=>{const U=tr(j),w=rr(x,{jest:c,testingLibrary:V,vitest:b}),k=er(h),v=h||!!k||t&&Re(),X=j||t&&_e(),Q=x||c||b||t&&Le(),z=e||t&&Ge(),H=or(U,F,t),M=sr(w,t),W=B||t&&Ae(),Y=$||t&&Ie(),K=l||t&&G();return[he(),Ce(),ve(),De(),ue(),Ue(),je({typescript:v}),v?Ke(k):[],X?await Ve():[],H?await Qe():[],z?await pe():[],Q?await He(w,t):[],M?await We():[],W?await Ee():[],Y?await Xe():[],K?await we():[],Te(),me(),de(n),o,N,J].flat()},"eslintConfig");export{nr 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.26.0",
|
|
4
4
|
"description": "another opinionated eslint config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"@typescript-eslint/utils": "^8.17.0",
|
|
41
41
|
"astro-eslint-parser": "^1.1.0",
|
|
42
42
|
"eslint-config-prettier": "^9.1.0",
|
|
43
|
-
"eslint-import-resolver-typescript": "^3.
|
|
43
|
+
"eslint-import-resolver-typescript": "^3.7.0",
|
|
44
44
|
"eslint-plugin-astro": "^1.3.1",
|
|
45
|
-
"eslint-plugin-import-x": "^4.
|
|
45
|
+
"eslint-plugin-import-x": "^4.5.0",
|
|
46
46
|
"eslint-plugin-jest": "^28.9.0",
|
|
47
47
|
"eslint-plugin-jest-dom": "^5.5.0",
|
|
48
48
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
49
49
|
"eslint-plugin-n": "^17.14.0",
|
|
50
|
-
"eslint-plugin-perfectionist": "^4.
|
|
50
|
+
"eslint-plugin-perfectionist": "^4.2.0",
|
|
51
51
|
"eslint-plugin-playwright": "^2.1.0",
|
|
52
52
|
"eslint-plugin-react": "^7.37.2",
|
|
53
53
|
"eslint-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
|