@jimmy.codes/eslint-config 3.17.3 → 3.19.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 CHANGED
@@ -1 +1 @@
1
- "use strict";var $=Object.create;var d=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var t=(e,r)=>d(e,"name",{value:r,configurable:!0});var Q=(e,r,s,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of J(r))!D.call(e,i)&&i!==s&&d(e,i,{get:()=>r[i],enumerable:!(n=F(r,i))||n.enumerable});return e};var o=(e,r,s)=>(s=e!=null?$(z(e)):{},Q(r||!e||!e.__esModule?d(s,"default",{value:e,enumerable:!0}):s,e));var g=require("globals"),f=require("typescript-eslint"),k=require("@eslint-community/eslint-plugin-eslint-comments/configs"),u=require("eslint-plugin-import-x"),w=require("eslint-plugin-n"),V=require("@eslint/js"),O=require("eslint-plugin-perfectionist"),X=require("eslint-config-prettier"),U=require("eslint-plugin-regexp"),l=require("local-pkg"),P=require("eslint-plugin-unicorn");function H(e){var r=Object.create(null);return e&&Object.keys(e).forEach(function(s){if(s!=="default"){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(r,s,n.get?n:{enumerable:!0,get:t(function(){return e[s]},"get")})}}),r.default=e,Object.freeze(r)}t(H,"_interopNamespaceDefault");var E=H(U);const c="?([cm])[jt]s?(x)",M=["**/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"],W="**/*.?([cm])js",y="**/*.?([cm])jsx",q="**/*.?([cm])tsx",m=[`**/__tests__/**/*.${c}`,`**/*.spec.${c}`,`**/*.test.${c}`,`**/*.bench.${c}`,`**/*.benchmark.${c}`],j=[`**/e2e/**/*.spec.${c}`,`**/e2e/**/*.test.${c}`,`**/cypress/**/*.spec.${c}`,`**/cypress/**/*.test.${c}`],Y="**/*.cjs",K="**/*.astro",Z=["vi.mock","describe","expect","it"],ee=["@testing-library/react"],a=t(async e=>{const r=await e;return r.default??r},"interopDefault"),re=t(async()=>{const e=[K],[r,s,n]=await Promise.all([import("eslint-plugin-astro"),import("astro-eslint-parser"),a(import("eslint-plugin-jsx-a11y"))]);return[{files:e,languageOptions:{globals:{...g.node,Astro:!1,Fragment:!1},parser:s,parserOptions:{extraFileExtensions:[".astro"],parser:f.parser},sourceType:"module"},name:"jimmy.codes/astro",plugins:{astro:r,"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: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"),te=t(()=>[{files:[Y],languageOptions:{globals:g.commonjs},name:"jimmy.codes/commonjs"}],"commonjsConfig"),se={...k.recommended.rules,"@eslint-community/eslint-comments/no-unused-disable":"off","@eslint-community/eslint-comments/require-description":"error"},oe=t(()=>[{...k.recommended,name:"jimmy.codes/eslint-comments",rules:se}],"eslintCommentsConfig"),ne=t(e=>[{ignores:[...M,...e],name:"jimmy.codes/ignores"}],"ignoresConfig"),ie={...u.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"},ae={name:"jimmy.codes/imports/typescript",rules:u.configs.typescript.rules,settings:{...u.configs.typescript.settings,"import-x/resolver":{...u.configs.typescript.settings["import-x/resolver"],typescript:!0}}},ce=t(({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":u,n:w},rules:ie},...e?[ae]:[]],"importsConfig"),le={...V.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"},pe=t(()=>[{linterOptions:{reportUnusedDisableDirectives:!0},name:"jimmy.codes/javascript",rules:le}],"javascriptConfig"),fe={"n/no-process-exit":"off","n/prefer-node-protocol":"error"},ue=t(()=>[{name:"jimmy.codes/node",plugins:{n:w},rules:fe}],"nodeConfig"),me={...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"},de=t(()=>[{name:"jimmy.codes/perfectionist",plugins:{perfectionist:O},rules:me}],"perfectionistConfig"),ge=t(()=>[{name:"jimmy.codes/prettier",...X}],"prettierConfig"),ye=t(e=>e===2?"error":e===1?"warn":"off","toStringSeverity"),_=t((e={})=>Object.fromEntries(Object.entries(e).map(([r,s])=>[r,typeof s=="number"?ye(s):s])),"normalizeRuleEntries"),je=t(async()=>{const[e,r]=await Promise.all([a(import("eslint-plugin-react")),a(import("eslint-plugin-jsx-a11y"))]);return{...r.configs.recommended.rules,..._(e.configs.flat?.recommended?.rules),..._(e.configs.flat?.["jsx-runtime"]?.rules),"react-hooks/exhaustive-deps":"error","react-hooks/rules-of-hooks":"error","react-refresh/only-export-components":["warn",{allowConstantExport:!0}],"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"),xe=t(async()=>{const[e,r,s,n]=await Promise.all([a(import("eslint-plugin-react")),a(import("eslint-plugin-jsx-a11y")),import("eslint-plugin-react-hooks"),import("eslint-plugin-react-refresh")]);return[{files:[y,q],languageOptions:{globals:{...g.browser},parserOptions:{ecmaFeatures:{jsx:!0},jsxPragma:null}},name:"jimmy.codes/react",plugins:{"jsx-a11y":r,react:e,"react-hooks":s,"react-refresh":n},rules:await je(),settings:{react:{version:"detect"}}}]},"reactConfig"),be={...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"},he=t(()=>[{name:"jimmy.codes/regexp",plugins:{regexp:E},rules:be}],"regexpConfig"),ve=t(async()=>{const e=await a(import("@tanstack/eslint-plugin-query"));return[{files:[y,q],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"}}]},"tanstackQuery"),C=t(async()=>{const e=await a(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"),ke=t(async()=>({...await C(),"jest/no-deprecated-functions":"off","jest/require-hook":["error",{allowedFunctionCalls:Z}]}),"vitestRules"),we=t(()=>l.isPackageExists("typescript"),"hasTypescript"),Oe=t(()=>l.isPackageExists("react"),"hasReact"),T=t(()=>l.isPackageExists("vitest"),"hasVitest"),R=t(()=>l.isPackageExists("jest"),"hasJest"),Pe=t(()=>T()||R(),"hasTesting"),Ee=t(()=>ee.some(e=>l.isPackageExists(e)),"hasTestingLibrary"),qe=t(()=>l.isPackageExists("@tanstack/react-query"),"hasReactQuery"),_e=t(()=>l.isPackageExists("astro"),"hasAstro"),Ce=t(async({framework:e="vitest"}={},r=!0)=>{const s=r?T():e==="vitest",n=e==="jest"||r&&R(),i=[];if(s){const p=await a(import("eslint-plugin-jest"));i.push({files:m,ignores:j,...p.configs["flat/recommended"],name:"jimmy.codes/vitest",rules:await ke()})}if(n){const p=await a(import("eslint-plugin-jest"));i.push({files:m,ignores:j,...p.configs["flat/recommended"],name:"jimmy.codes/jest",rules:await C()})}return i},"testingConfig"),Te=t(async()=>{const[e,r]=await Promise.all([import("eslint-plugin-jest-dom"),a(import("eslint-plugin-testing-library"))]);return{...r.configs["flat/react"].rules,...e.configs["flat/recommended"].rules}},"testingLibraryRules"),Re=t(async()=>{const[e,r]=await Promise.all([import("eslint-plugin-jest-dom"),a(import("eslint-plugin-testing-library"))]);return[{files:m,ignores:j,name:"jimmy.codes/testing-library",plugins:{"jest-dom":e,"testing-library":r},rules:await Te()}]},"testingLibrary"),Le={"@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"},Se=t(e=>[...f.configs.strictTypeChecked,...f.configs.stylisticTypeChecked.filter(r=>r.name==="typescript-eslint/stylistic-type-checked"),{languageOptions:{parserOptions:{...e?.project?{project:e.project}:{projectService:!0},tsconfigRootDir:process.cwd()}},name:"jimmy.codes/typescript",rules:Le},{files:[W,y],...f.configs.disableTypeChecked},{files:m,name:"jimmy.codes/typescript/testing",rules:{"@typescript-eslint/no-unsafe-argument":"off","@typescript-eslint/no-unsafe-assignment":"off"}}],"typescriptConfig"),Ae={...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"},Ge=t(()=>[{...P.configs["flat/recommended"],name:"jimmy.codes/unicorn",rules:Ae}],"unicornConfig"),Ie=t(e=>typeof e=="object"?e:void 0,"getTypescriptOptions"),Be=t(e=>typeof e=="object"?e:{framework:"vitest"},"getTestingOptions"),Ne=t(e=>typeof e=="object"?e:{utilities:[]},"getReactOptions"),$e=t(({utilities:e=[]},r)=>e.includes("@tanstack/query")||r&&qe(),"shouldEnableTanstackQuery"),Fe=t(({utilities:e=[]},r)=>e.includes("testing-library")||r&&Ee(),"shouldEnableTestingLibrary"),Je=t(async({astro:e=!1,autoDetect:r=!0,configs:s=[],ignores:n=[],react:i=!1,testing:p=!1,typescript:x=!1}={},...L)=>{const S=Ne(i),b=Be(p),h=Ie(x),v=x||!!h||r&&we(),A=i||r&&Oe(),G=p||r&&Pe(),I=e||r&&_e(),B=$e(S,r),N=Fe(b,r);return[pe(),de(),ue(),Ge(),oe(),he(),ce({typescript:v}),v?Se(h):[],A?await xe():[],B?await ve():[],I?await re():[],G?await Ce(b,r):[],N?await Re():[],ge(),te(),ne(n),s,L].flat()},"jimmyDotCodes");module.exports=Je;
1
+ "use strict";var z=Object.create;var d=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var t=(e,r)=>d(e,"name",{value:r,configurable:!0});var H=(e,r,s,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of V(r))!D.call(e,a)&&a!==s&&d(e,a,{get:()=>r[a],enumerable:!(n=Q(r,a))||n.enumerable});return e};var o=(e,r,s)=>(s=e!=null?z(X(e)):{},H(r||!e||!e.__esModule?d(s,"default",{value:e,enumerable:!0}):s,e));var g=require("globals"),f=require("typescript-eslint"),k=require("@eslint-community/eslint-plugin-eslint-comments/configs"),u=require("eslint-plugin-import-x"),P=require("eslint-plugin-n"),U=require("@eslint/js"),O=require("eslint-plugin-perfectionist"),W=require("eslint-config-prettier"),Y=require("eslint-plugin-regexp"),l=require("local-pkg"),E=require("eslint-plugin-unicorn");function M(e){var r=Object.create(null);return e&&Object.keys(e).forEach(function(s){if(s!=="default"){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(r,s,n.get?n:{enumerable:!0,get:t(function(){return e[s]},"get")})}}),r.default=e,Object.freeze(r)}t(M,"_interopNamespaceDefault");var q=M(Y);const c="?([cm])[jt]s?(x)",K=["**/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"],Z="**/*.?([cm])js",y="**/*.?([cm])jsx",_="**/*.?([cm])tsx",m=[`**/__tests__/**/*.${c}`,`**/*.spec.${c}`,`**/*.test.${c}`,`**/*.bench.${c}`,`**/*.benchmark.${c}`],C=[`**/e2e/**/*.spec.${c}`,`**/e2e/**/*.test.${c}`],j=[...C,`**/cypress/**/*.spec.${c}`,`**/cypress/**/*.test.${c}`],ee="**/*.cjs",re="**/*.astro",te=["vi.mock","describe","expect","it"],se=["@testing-library/react"],i=t(async e=>{const r=await e;return r.default??r},"interopDefault"),oe=t(async()=>{const e=[re],[r,s,n]=await Promise.all([import("eslint-plugin-astro"),import("astro-eslint-parser"),i(import("eslint-plugin-jsx-a11y"))]);return[{files:e,languageOptions:{globals:{...g.node,Astro:!1,Fragment:!1},parser:s,parserOptions:{extraFileExtensions:[".astro"],parser:f.parser},sourceType:"module"},name:"jimmy.codes/astro",plugins:{astro:r,"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: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"),ne=t(()=>[{files:[ee],languageOptions:{globals:g.commonjs},name:"jimmy.codes/commonjs"}],"commonjsConfig"),ie={...k.recommended.rules,"@eslint-community/eslint-comments/no-unused-disable":"off","@eslint-community/eslint-comments/require-description":"error"},ae=t(()=>[{...k.recommended,name:"jimmy.codes/eslint-comments",rules:ie}],"eslintCommentsConfig"),ce=t(e=>[{ignores:[...K,...e],name:"jimmy.codes/ignores"}],"ignoresConfig"),le={...u.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"},pe={name:"jimmy.codes/imports/typescript",rules:u.configs.typescript.rules,settings:{...u.configs.typescript.settings,"import-x/resolver":{...u.configs.typescript.settings["import-x/resolver"],typescript:!0}}},fe=t(({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":u,n:P},rules:le},...e?[pe]:[]],"importsConfig"),ue={...U.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"},me=t(()=>[{linterOptions:{reportUnusedDisableDirectives:!0},name:"jimmy.codes/javascript",rules:ue}],"javascriptConfig"),de={"n/no-process-exit":"off","n/prefer-node-protocol":"error"},ge=t(()=>[{name:"jimmy.codes/node",plugins:{n:P},rules:de}],"nodeConfig"),ye={...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"},je=t(()=>[{name:"jimmy.codes/perfectionist",plugins:{perfectionist:O},rules:ye}],"perfectionistConfig"),he=t(async()=>({...(await i(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"),xe=t(async()=>[{...(await i(import("eslint-plugin-playwright"))).configs["flat/recommended"],files:C,name:"jimmy.codes/playwright",rules:await he()}],"playwrightConfig"),be=t(()=>[{name:"jimmy.codes/prettier",...W}],"prettierConfig"),we=t(e=>e===2?"error":e===1?"warn":"off","toStringSeverity"),T=t((e={})=>Object.fromEntries(Object.entries(e).map(([r,s])=>[r,typeof s=="number"?we(s):s])),"normalizeRuleEntries"),ve=t(async()=>{const[e,r]=await Promise.all([i(import("eslint-plugin-react")),i(import("eslint-plugin-jsx-a11y"))]);return{...r.configs.recommended.rules,...T(e.configs.flat?.recommended?.rules),...T(e.configs.flat?.["jsx-runtime"]?.rules),"react-hooks/exhaustive-deps":"error","react-hooks/rules-of-hooks":"error","react-refresh/only-export-components":["warn",{allowConstantExport:!0}],"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"),ke=t(async()=>{const[e,r,s,n]=await Promise.all([i(import("eslint-plugin-react")),i(import("eslint-plugin-jsx-a11y")),import("eslint-plugin-react-hooks"),import("eslint-plugin-react-refresh")]);return[{files:[y,_],languageOptions:{globals:{...g.browser},parserOptions:{ecmaFeatures:{jsx:!0},jsxPragma:null}},name:"jimmy.codes/react",plugins:{"jsx-a11y":r,react:e,"react-hooks":s,"react-refresh":n},rules:await ve(),settings:{react:{version:"detect"}}}]},"reactConfig"),Pe={...q.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"},Oe=t(()=>[{name:"jimmy.codes/regexp",plugins:{regexp:q},rules:Pe}],"regexpConfig"),Ee=t(async()=>{const e=await i(import("@tanstack/eslint-plugin-query"));return[{files:[y,_],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"}}]},"tanstackQuery"),R=t(async()=>{const e=await i(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=t(async()=>({...await R(),"jest/no-deprecated-functions":"off","jest/require-hook":["error",{allowedFunctionCalls:te}]}),"vitestRules"),_e=t(()=>l.isPackageExists("typescript"),"hasTypescript"),Ce=t(()=>l.isPackageExists("react"),"hasReact"),L=t(()=>l.isPackageExists("vitest"),"hasVitest"),S=t(()=>l.isPackageExists("jest"),"hasJest"),Te=t(()=>L()||S(),"hasTesting"),Re=t(()=>se.some(e=>l.isPackageExists(e)),"hasTestingLibrary"),Le=t(()=>l.isPackageExists("@tanstack/react-query"),"hasReactQuery"),Se=t(()=>l.isPackageExists("astro"),"hasAstro"),Ge=t(()=>l.isPackageExists("@playwright/test"),"hasPlaywright"),Ae=t(async({framework:e="vitest"}={},r=!0)=>{const s=r?L():e==="vitest",n=e==="jest"||r&&S(),a=[];if(s){const p=await i(import("eslint-plugin-jest"));a.push({files:m,ignores:j,...p.configs["flat/recommended"],name:"jimmy.codes/vitest",rules:await qe()})}if(n){const p=await i(import("eslint-plugin-jest"));a.push({files:m,ignores:j,...p.configs["flat/recommended"],name:"jimmy.codes/jest",rules:await R()})}return a},"testingConfig"),Ie=t(async()=>{const[e,r]=await Promise.all([import("eslint-plugin-jest-dom"),i(import("eslint-plugin-testing-library"))]);return{...r.configs["flat/react"].rules,...e.configs["flat/recommended"].rules}},"testingLibraryRules"),Be=t(async()=>{const[e,r]=await Promise.all([import("eslint-plugin-jest-dom"),i(import("eslint-plugin-testing-library"))]);return[{files:m,ignores:j,name:"jimmy.codes/testing-library",plugins:{"jest-dom":e,"testing-library":r},rules:await Ie()}]},"testingLibrary"),Ne={"@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"},$e=t(e=>[...f.configs.strictTypeChecked,...f.configs.stylisticTypeChecked.filter(r=>r.name==="typescript-eslint/stylistic-type-checked"),{languageOptions:{parserOptions:{...e?.project?{project:e.project}:{projectService:!0},tsconfigRootDir:process.cwd()}},name:"jimmy.codes/typescript",rules:Ne},{files:[Z,y],...f.configs.disableTypeChecked},{files:m,name:"jimmy.codes/typescript/testing",rules:{"@typescript-eslint/no-unsafe-argument":"off","@typescript-eslint/no-unsafe-assignment":"off"}}],"typescriptConfig"),Fe={...E.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"},Je=t(()=>[{...E.configs["flat/recommended"],name:"jimmy.codes/unicorn",rules:Fe}],"unicornConfig"),ze=t(e=>typeof e=="object"?e:void 0,"getTypescriptOptions"),Qe=t(e=>typeof e=="object"?e:{framework:"vitest"},"getTestingOptions"),Ve=t(e=>typeof e=="object"?e:{utilities:[]},"getReactOptions"),Xe=t(({utilities:e=[]},r)=>e.includes("@tanstack/query")||r&&Le(),"shouldEnableTanstackQuery"),De=t(({utilities:e=[]},r)=>e.includes("testing-library")||r&&Re(),"shouldEnableTestingLibrary"),He=t(async({astro:e=!1,autoDetect:r=!0,configs:s=[],ignores:n=[],playwright:a=!1,react:p=!1,testing:h=!1,typescript:x=!1}={},...G)=>{const A=Ve(p),b=Qe(h),w=ze(x),v=x||!!w||r&&_e(),I=p||r&&Ce(),B=h||r&&Te(),N=e||r&&Se(),$=Xe(A,r),F=De(b,r),J=a||r&&Ge();return[me(),je(),ge(),Je(),ae(),Oe(),fe({typescript:v}),v?$e(w):[],I?await ke():[],$?await Ee():[],N?await oe():[],B?await Ae(b,r):[],F?await Be():[],J?await xe():[],be(),ne(),ce(n),s,G].flat()},"jimmyDotCodes");module.exports=He;
package/dist/index.d.cts CHANGED
@@ -3386,6 +3386,246 @@ interface RuleOptions {
3386
3386
  * @see https://perfectionist.dev/rules/sort-variable-declarations
3387
3387
  */
3388
3388
  'perfectionist/sort-variable-declarations'?: Linter.RuleEntry<PerfectionistSortVariableDeclarations>
3389
+ /**
3390
+ * Enforce assertion to be made in a test body
3391
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/expect-expect.md
3392
+ */
3393
+ 'playwright/expect-expect'?: Linter.RuleEntry<PlaywrightExpectExpect>
3394
+ /**
3395
+ * Enforces a maximum number assertion calls in a test body
3396
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/max-expects.md
3397
+ */
3398
+ 'playwright/max-expects'?: Linter.RuleEntry<PlaywrightMaxExpects>
3399
+ /**
3400
+ * Enforces a maximum depth to nested describe calls
3401
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/max-nested-describe.md
3402
+ */
3403
+ 'playwright/max-nested-describe'?: Linter.RuleEntry<PlaywrightMaxNestedDescribe>
3404
+ /**
3405
+ * Identify false positives when async Playwright APIs are not properly awaited.
3406
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/missing-playwright-await.md
3407
+ */
3408
+ 'playwright/missing-playwright-await'?: Linter.RuleEntry<PlaywrightMissingPlaywrightAwait>
3409
+ /**
3410
+ * Disallow commented out tests
3411
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-commented-out-tests.md
3412
+ */
3413
+ 'playwright/no-commented-out-tests'?: Linter.RuleEntry<[]>
3414
+ /**
3415
+ * Disallow calling `expect` conditionally
3416
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-conditional-expect.md
3417
+ */
3418
+ 'playwright/no-conditional-expect'?: Linter.RuleEntry<[]>
3419
+ /**
3420
+ * Disallow conditional logic in tests
3421
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-conditional-in-test.md
3422
+ */
3423
+ 'playwright/no-conditional-in-test'?: Linter.RuleEntry<[]>
3424
+ /**
3425
+ * Disallow duplicate setup and teardown hooks
3426
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-duplicate-hooks.md
3427
+ */
3428
+ 'playwright/no-duplicate-hooks'?: Linter.RuleEntry<[]>
3429
+ /**
3430
+ * The use of ElementHandle is discouraged, use Locator instead
3431
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-element-handle.md
3432
+ */
3433
+ 'playwright/no-element-handle'?: Linter.RuleEntry<[]>
3434
+ /**
3435
+ * The use of `page.$eval` and `page.$$eval` are discouraged, use `locator.evaluate` or `locator.evaluateAll` instead
3436
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-eval.md
3437
+ */
3438
+ 'playwright/no-eval'?: Linter.RuleEntry<[]>
3439
+ /**
3440
+ * Prevent usage of `.only()` focus test annotation
3441
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-focused-test.md
3442
+ */
3443
+ 'playwright/no-focused-test'?: Linter.RuleEntry<[]>
3444
+ /**
3445
+ * Prevent usage of `{ force: true }` option.
3446
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-force-option.md
3447
+ */
3448
+ 'playwright/no-force-option'?: Linter.RuleEntry<[]>
3449
+ /**
3450
+ * Disallows the usage of getByTitle()
3451
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-get-by-title.md
3452
+ */
3453
+ 'playwright/no-get-by-title'?: Linter.RuleEntry<[]>
3454
+ /**
3455
+ * Disallow setup and teardown hooks
3456
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-hooks.md
3457
+ */
3458
+ 'playwright/no-hooks'?: Linter.RuleEntry<PlaywrightNoHooks>
3459
+ /**
3460
+ * Disallow nested `test.step()` methods
3461
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-nested-step.md
3462
+ */
3463
+ 'playwright/no-nested-step'?: Linter.RuleEntry<[]>
3464
+ /**
3465
+ * Prevent usage of the networkidle option
3466
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-networkidle.md
3467
+ */
3468
+ 'playwright/no-networkidle'?: Linter.RuleEntry<[]>
3469
+ /**
3470
+ * Disallow usage of nth methods
3471
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-nth-methods.md
3472
+ */
3473
+ 'playwright/no-nth-methods'?: Linter.RuleEntry<[]>
3474
+ /**
3475
+ * Prevent usage of page.pause()
3476
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-page-pause.md
3477
+ */
3478
+ 'playwright/no-page-pause'?: Linter.RuleEntry<[]>
3479
+ /**
3480
+ * Disallows the usage of raw locators
3481
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-raw-locators.md
3482
+ */
3483
+ 'playwright/no-raw-locators'?: Linter.RuleEntry<PlaywrightNoRawLocators>
3484
+ /**
3485
+ * Disallow specific matchers & modifiers
3486
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-restricted-matchers.md
3487
+ */
3488
+ 'playwright/no-restricted-matchers'?: Linter.RuleEntry<PlaywrightNoRestrictedMatchers>
3489
+ /**
3490
+ * Prevent usage of the `.skip()` skip test annotation.
3491
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-skipped-test.md
3492
+ */
3493
+ 'playwright/no-skipped-test'?: Linter.RuleEntry<PlaywrightNoSkippedTest>
3494
+ /**
3495
+ * Disallow using `expect` outside of `test` blocks
3496
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-standalone-expect.md
3497
+ */
3498
+ 'playwright/no-standalone-expect'?: Linter.RuleEntry<[]>
3499
+ /**
3500
+ * Prevent unsafe variable references in page.evaluate()
3501
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-unsafe-references.md
3502
+ */
3503
+ 'playwright/no-unsafe-references'?: Linter.RuleEntry<[]>
3504
+ /**
3505
+ * Disallow unnecessary awaits for Playwright methods
3506
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-useless-await.md
3507
+ */
3508
+ 'playwright/no-useless-await'?: Linter.RuleEntry<[]>
3509
+ /**
3510
+ * Disallow usage of 'not' matchers when a more specific matcher exists
3511
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-useless-not.md
3512
+ */
3513
+ 'playwright/no-useless-not'?: Linter.RuleEntry<[]>
3514
+ /**
3515
+ * Prevent usage of page.waitForSelector()
3516
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-wait-for-selector.md
3517
+ */
3518
+ 'playwright/no-wait-for-selector'?: Linter.RuleEntry<[]>
3519
+ /**
3520
+ * Prevent usage of page.waitForTimeout()
3521
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-wait-for-timeout.md
3522
+ */
3523
+ 'playwright/no-wait-for-timeout'?: Linter.RuleEntry<[]>
3524
+ /**
3525
+ * Suggest using the built-in comparison matchers
3526
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-comparision-matcher.md
3527
+ */
3528
+ 'playwright/prefer-comparison-matcher'?: Linter.RuleEntry<[]>
3529
+ /**
3530
+ * Suggest using the built-in equality matchers
3531
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-equality-matcher.md
3532
+ */
3533
+ 'playwright/prefer-equality-matcher'?: Linter.RuleEntry<[]>
3534
+ /**
3535
+ * Prefer having hooks in a consistent order
3536
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-hooks-in-order.md
3537
+ */
3538
+ 'playwright/prefer-hooks-in-order'?: Linter.RuleEntry<[]>
3539
+ /**
3540
+ * Suggest having hooks before any test cases
3541
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-hooks-on-top.md
3542
+ */
3543
+ 'playwright/prefer-hooks-on-top'?: Linter.RuleEntry<[]>
3544
+ /**
3545
+ * Suggest locators over page methods
3546
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-locator.md
3547
+ */
3548
+ 'playwright/prefer-locator'?: Linter.RuleEntry<[]>
3549
+ /**
3550
+ * Enforce lowercase test names
3551
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-lowercase-title.md
3552
+ */
3553
+ 'playwright/prefer-lowercase-title'?: Linter.RuleEntry<PlaywrightPreferLowercaseTitle>
3554
+ /**
3555
+ * Prefer native locator functions
3556
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-native-locators.md
3557
+ */
3558
+ 'playwright/prefer-native-locators'?: Linter.RuleEntry<PlaywrightPreferNativeLocators>
3559
+ /**
3560
+ * Suggest using `toStrictEqual()`
3561
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-strict-equal.md
3562
+ */
3563
+ 'playwright/prefer-strict-equal'?: Linter.RuleEntry<[]>
3564
+ /**
3565
+ * Suggest using `toBe()` for primitive literals
3566
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-to-be.md
3567
+ */
3568
+ 'playwright/prefer-to-be'?: Linter.RuleEntry<[]>
3569
+ /**
3570
+ * Suggest using toContain()
3571
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-to-contain.md
3572
+ */
3573
+ 'playwright/prefer-to-contain'?: Linter.RuleEntry<[]>
3574
+ /**
3575
+ * Suggest using `toHaveCount()`
3576
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-to-have-count.md
3577
+ */
3578
+ 'playwright/prefer-to-have-count'?: Linter.RuleEntry<[]>
3579
+ /**
3580
+ * Suggest using `toHaveLength()`
3581
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-to-have-length.md
3582
+ */
3583
+ 'playwright/prefer-to-have-length'?: Linter.RuleEntry<[]>
3584
+ /**
3585
+ * Prefer web first assertions
3586
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-web-first-assertions.md
3587
+ */
3588
+ 'playwright/prefer-web-first-assertions'?: Linter.RuleEntry<[]>
3589
+ /**
3590
+ * Require setup and teardown code to be within a hook
3591
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/require-hook.md
3592
+ */
3593
+ 'playwright/require-hook'?: Linter.RuleEntry<PlaywrightRequireHook>
3594
+ /**
3595
+ * Require all assertions to use `expect.soft`
3596
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/require-soft-assertions.md
3597
+ */
3598
+ 'playwright/require-soft-assertions'?: Linter.RuleEntry<[]>
3599
+ /**
3600
+ * Require a message for `toThrow()`
3601
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/require-to-throw-message.md
3602
+ */
3603
+ 'playwright/require-to-throw-message'?: Linter.RuleEntry<[]>
3604
+ /**
3605
+ * Require test cases and hooks to be inside a `test.describe` block
3606
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/require-top-level-describe.md
3607
+ */
3608
+ 'playwright/require-top-level-describe'?: Linter.RuleEntry<PlaywrightRequireTopLevelDescribe>
3609
+ /**
3610
+ * Enforce valid `describe()` callback
3611
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/valid-describe-callback.md
3612
+ */
3613
+ 'playwright/valid-describe-callback'?: Linter.RuleEntry<[]>
3614
+ /**
3615
+ * Enforce valid `expect()` usage
3616
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/valid-expect.md
3617
+ */
3618
+ 'playwright/valid-expect'?: Linter.RuleEntry<PlaywrightValidExpect>
3619
+ /**
3620
+ * Require promises that have expectations in their chain to be valid
3621
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/valid-expect-in-promise.md
3622
+ */
3623
+ 'playwright/valid-expect-in-promise'?: Linter.RuleEntry<[]>
3624
+ /**
3625
+ * Enforce valid titles
3626
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/valid-title.md
3627
+ */
3628
+ 'playwright/valid-title'?: Linter.RuleEntry<PlaywrightValidTitle>
3389
3629
  /**
3390
3630
  * Require using arrow functions for callbacks
3391
3631
  * @see https://eslint.org/docs/latest/rules/prefer-arrow-callback
@@ -9255,12 +9495,19 @@ type PerfectionistSortObjectTypes = []|[{
9255
9495
  // ----- perfectionist/sort-objects -----
9256
9496
  type PerfectionistSortObjects = []|[{
9257
9497
 
9498
+ destructuredObjects?: (boolean | {
9499
+
9500
+ groups?: boolean
9501
+ })
9502
+
9258
9503
  ignorePattern?: string[]
9259
9504
 
9260
9505
  partitionByComment?: (string[] | boolean | string)
9261
9506
 
9262
9507
  destructureOnly?: boolean
9263
9508
 
9509
+ objectDeclarations?: boolean
9510
+
9264
9511
  styledComponents?: boolean
9265
9512
 
9266
9513
  partitionByNewLine?: boolean
@@ -9353,6 +9600,72 @@ type PerfectionistSortVariableDeclarations = []|[{
9353
9600
 
9354
9601
  type?: ("alphabetical" | "natural" | "line-length")
9355
9602
  }]
9603
+ // ----- playwright/expect-expect -----
9604
+ type PlaywrightExpectExpect = []|[{
9605
+ assertFunctionNames?: []|[string]
9606
+ }]
9607
+ // ----- playwright/max-expects -----
9608
+ type PlaywrightMaxExpects = []|[{
9609
+ max?: number
9610
+ }]
9611
+ // ----- playwright/max-nested-describe -----
9612
+ type PlaywrightMaxNestedDescribe = []|[{
9613
+ max?: number
9614
+ }]
9615
+ // ----- playwright/missing-playwright-await -----
9616
+ type PlaywrightMissingPlaywrightAwait = []|[{
9617
+ customMatchers?: string[]
9618
+ }]
9619
+ // ----- playwright/no-hooks -----
9620
+ type PlaywrightNoHooks = []|[{
9621
+ allow?: unknown[]
9622
+ }]
9623
+ // ----- playwright/no-raw-locators -----
9624
+ type PlaywrightNoRawLocators = []|[{
9625
+ allowed?: string[]
9626
+ }]
9627
+ // ----- playwright/no-restricted-matchers -----
9628
+ type PlaywrightNoRestrictedMatchers = []|[{
9629
+ [k: string]: (string | null) | undefined
9630
+ }]
9631
+ // ----- playwright/no-skipped-test -----
9632
+ type PlaywrightNoSkippedTest = []|[{
9633
+ allowConditional?: boolean
9634
+ }]
9635
+ // ----- playwright/prefer-lowercase-title -----
9636
+ type PlaywrightPreferLowercaseTitle = []|[{
9637
+ allowedPrefixes?: string[]
9638
+ ignore?: ("test.describe" | "test")[]
9639
+ ignoreTopLevelDescribe?: boolean
9640
+ }]
9641
+ // ----- playwright/prefer-native-locators -----
9642
+ type PlaywrightPreferNativeLocators = []|[{
9643
+ testIdAttribute?: string
9644
+ }]
9645
+ // ----- playwright/require-hook -----
9646
+ type PlaywrightRequireHook = []|[{
9647
+ allowedFunctionCalls?: string[]
9648
+ }]
9649
+ // ----- playwright/require-top-level-describe -----
9650
+ type PlaywrightRequireTopLevelDescribe = []|[{
9651
+ maxTopLevelDescribes?: number
9652
+ }]
9653
+ // ----- playwright/valid-expect -----
9654
+ type PlaywrightValidExpect = []|[{
9655
+ maxArgs?: number
9656
+ minArgs?: number
9657
+ }]
9658
+ // ----- playwright/valid-title -----
9659
+ type PlaywrightValidTitle = []|[{
9660
+ disallowedWords?: string[]
9661
+ ignoreSpaces?: boolean
9662
+ ignoreTypeOfDescribeName?: boolean
9663
+ ignoreTypeOfStepName?: boolean
9664
+ ignoreTypeOfTestName?: boolean
9665
+ [k: string]: (string | [string]|[string, string] | {
9666
+ [k: string]: (string | [string]|[string, string]) | undefined
9667
+ })
9668
+ }]
9356
9669
  // ----- prefer-arrow-callback -----
9357
9670
  type PreferArrowCallback = []|[{
9358
9671
  allowNamedFunctions?: boolean
@@ -10456,14 +10769,15 @@ interface Options {
10456
10769
  */
10457
10770
  ignores?: string[];
10458
10771
  /**
10459
- * Are React rules enabled?
10772
+ * Are playwright rules enabled?
10460
10773
  * @default false
10461
10774
  */
10462
- react?: boolean | ReactOptions;
10775
+ playwright?: boolean;
10463
10776
  /**
10464
- * Are Jest rules enabled?
10777
+ * Are React rules enabled?
10465
10778
  * @default false
10466
10779
  */
10780
+ react?: boolean | ReactOptions;
10467
10781
  /**
10468
10782
  * Are testing rules enabled?
10469
10783
  * @default false
@@ -10476,7 +10790,7 @@ interface Options {
10476
10790
  typescript?: boolean | TypescriptOptions;
10477
10791
  }
10478
10792
 
10479
- declare const jimmyDotCodes: ({ astro, autoDetect, configs, ignores, react, testing, typescript, }?: Options, ...moreConfigs: Linter.Config[] | TypedConfigItem[]) => Promise<(TypedConfigItem | Linter.Config<Linter.RulesRecord> | _typescript_eslint_utils_ts_eslint.FlatConfig.Config | {
10793
+ declare const jimmyDotCodes: ({ astro, autoDetect, configs, ignores, playwright, react, testing, typescript, }?: Options, ...moreConfigs: Linter.Config[] | TypedConfigItem[]) => Promise<(TypedConfigItem | Linter.Config<Linter.RulesRecord> | _typescript_eslint_utils_ts_eslint.FlatConfig.Config | {
10480
10794
  files: string[];
10481
10795
  languageOptions: {
10482
10796
  globals: {
@@ -11155,6 +11469,32 @@ declare const jimmyDotCodes: ({ astro, autoDetect, configs, ignores, react, test
11155
11469
  }];
11156
11470
  "perfectionist/sort-modules": "off";
11157
11471
  };
11472
+ } | {
11473
+ files: string[];
11474
+ name: string;
11475
+ rules: {
11476
+ "playwright/expect-expect": "error";
11477
+ "playwright/max-nested-describe": "error";
11478
+ "playwright/no-conditional-expect": "error";
11479
+ "playwright/no-conditional-in-test": "error";
11480
+ "playwright/no-element-handle": "error";
11481
+ "playwright/no-eval": "error";
11482
+ "playwright/no-force-option": "error";
11483
+ "playwright/no-nested-step": "error";
11484
+ "playwright/no-page-pause": "error";
11485
+ "playwright/no-skipped-test": "error";
11486
+ "playwright/no-useless-await": "error";
11487
+ "playwright/no-useless-not": "error";
11488
+ "playwright/no-wait-for-selector": "error";
11489
+ "playwright/no-wait-for-timeout": "error";
11490
+ };
11491
+ ignores?: string[];
11492
+ language?: string;
11493
+ languageOptions?: Linter.LanguageOptions;
11494
+ linterOptions?: Linter.LinterOptions;
11495
+ processor?: string | Linter.Processor;
11496
+ plugins?: Record<string, eslint.ESLint.Plugin>;
11497
+ settings?: Record<string, unknown>;
11158
11498
  } | {
11159
11499
  rules: Linter.RulesRecord;
11160
11500
  name: string;
package/dist/index.d.mts CHANGED
@@ -3386,6 +3386,246 @@ interface RuleOptions {
3386
3386
  * @see https://perfectionist.dev/rules/sort-variable-declarations
3387
3387
  */
3388
3388
  'perfectionist/sort-variable-declarations'?: Linter.RuleEntry<PerfectionistSortVariableDeclarations>
3389
+ /**
3390
+ * Enforce assertion to be made in a test body
3391
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/expect-expect.md
3392
+ */
3393
+ 'playwright/expect-expect'?: Linter.RuleEntry<PlaywrightExpectExpect>
3394
+ /**
3395
+ * Enforces a maximum number assertion calls in a test body
3396
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/max-expects.md
3397
+ */
3398
+ 'playwright/max-expects'?: Linter.RuleEntry<PlaywrightMaxExpects>
3399
+ /**
3400
+ * Enforces a maximum depth to nested describe calls
3401
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/max-nested-describe.md
3402
+ */
3403
+ 'playwright/max-nested-describe'?: Linter.RuleEntry<PlaywrightMaxNestedDescribe>
3404
+ /**
3405
+ * Identify false positives when async Playwright APIs are not properly awaited.
3406
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/missing-playwright-await.md
3407
+ */
3408
+ 'playwright/missing-playwright-await'?: Linter.RuleEntry<PlaywrightMissingPlaywrightAwait>
3409
+ /**
3410
+ * Disallow commented out tests
3411
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-commented-out-tests.md
3412
+ */
3413
+ 'playwright/no-commented-out-tests'?: Linter.RuleEntry<[]>
3414
+ /**
3415
+ * Disallow calling `expect` conditionally
3416
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-conditional-expect.md
3417
+ */
3418
+ 'playwright/no-conditional-expect'?: Linter.RuleEntry<[]>
3419
+ /**
3420
+ * Disallow conditional logic in tests
3421
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-conditional-in-test.md
3422
+ */
3423
+ 'playwright/no-conditional-in-test'?: Linter.RuleEntry<[]>
3424
+ /**
3425
+ * Disallow duplicate setup and teardown hooks
3426
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-duplicate-hooks.md
3427
+ */
3428
+ 'playwright/no-duplicate-hooks'?: Linter.RuleEntry<[]>
3429
+ /**
3430
+ * The use of ElementHandle is discouraged, use Locator instead
3431
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-element-handle.md
3432
+ */
3433
+ 'playwright/no-element-handle'?: Linter.RuleEntry<[]>
3434
+ /**
3435
+ * The use of `page.$eval` and `page.$$eval` are discouraged, use `locator.evaluate` or `locator.evaluateAll` instead
3436
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-eval.md
3437
+ */
3438
+ 'playwright/no-eval'?: Linter.RuleEntry<[]>
3439
+ /**
3440
+ * Prevent usage of `.only()` focus test annotation
3441
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-focused-test.md
3442
+ */
3443
+ 'playwright/no-focused-test'?: Linter.RuleEntry<[]>
3444
+ /**
3445
+ * Prevent usage of `{ force: true }` option.
3446
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-force-option.md
3447
+ */
3448
+ 'playwright/no-force-option'?: Linter.RuleEntry<[]>
3449
+ /**
3450
+ * Disallows the usage of getByTitle()
3451
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-get-by-title.md
3452
+ */
3453
+ 'playwright/no-get-by-title'?: Linter.RuleEntry<[]>
3454
+ /**
3455
+ * Disallow setup and teardown hooks
3456
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-hooks.md
3457
+ */
3458
+ 'playwright/no-hooks'?: Linter.RuleEntry<PlaywrightNoHooks>
3459
+ /**
3460
+ * Disallow nested `test.step()` methods
3461
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-nested-step.md
3462
+ */
3463
+ 'playwright/no-nested-step'?: Linter.RuleEntry<[]>
3464
+ /**
3465
+ * Prevent usage of the networkidle option
3466
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-networkidle.md
3467
+ */
3468
+ 'playwright/no-networkidle'?: Linter.RuleEntry<[]>
3469
+ /**
3470
+ * Disallow usage of nth methods
3471
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-nth-methods.md
3472
+ */
3473
+ 'playwright/no-nth-methods'?: Linter.RuleEntry<[]>
3474
+ /**
3475
+ * Prevent usage of page.pause()
3476
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-page-pause.md
3477
+ */
3478
+ 'playwright/no-page-pause'?: Linter.RuleEntry<[]>
3479
+ /**
3480
+ * Disallows the usage of raw locators
3481
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-raw-locators.md
3482
+ */
3483
+ 'playwright/no-raw-locators'?: Linter.RuleEntry<PlaywrightNoRawLocators>
3484
+ /**
3485
+ * Disallow specific matchers & modifiers
3486
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-restricted-matchers.md
3487
+ */
3488
+ 'playwright/no-restricted-matchers'?: Linter.RuleEntry<PlaywrightNoRestrictedMatchers>
3489
+ /**
3490
+ * Prevent usage of the `.skip()` skip test annotation.
3491
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-skipped-test.md
3492
+ */
3493
+ 'playwright/no-skipped-test'?: Linter.RuleEntry<PlaywrightNoSkippedTest>
3494
+ /**
3495
+ * Disallow using `expect` outside of `test` blocks
3496
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-standalone-expect.md
3497
+ */
3498
+ 'playwright/no-standalone-expect'?: Linter.RuleEntry<[]>
3499
+ /**
3500
+ * Prevent unsafe variable references in page.evaluate()
3501
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-unsafe-references.md
3502
+ */
3503
+ 'playwright/no-unsafe-references'?: Linter.RuleEntry<[]>
3504
+ /**
3505
+ * Disallow unnecessary awaits for Playwright methods
3506
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-useless-await.md
3507
+ */
3508
+ 'playwright/no-useless-await'?: Linter.RuleEntry<[]>
3509
+ /**
3510
+ * Disallow usage of 'not' matchers when a more specific matcher exists
3511
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-useless-not.md
3512
+ */
3513
+ 'playwright/no-useless-not'?: Linter.RuleEntry<[]>
3514
+ /**
3515
+ * Prevent usage of page.waitForSelector()
3516
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-wait-for-selector.md
3517
+ */
3518
+ 'playwright/no-wait-for-selector'?: Linter.RuleEntry<[]>
3519
+ /**
3520
+ * Prevent usage of page.waitForTimeout()
3521
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/no-wait-for-timeout.md
3522
+ */
3523
+ 'playwright/no-wait-for-timeout'?: Linter.RuleEntry<[]>
3524
+ /**
3525
+ * Suggest using the built-in comparison matchers
3526
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-comparision-matcher.md
3527
+ */
3528
+ 'playwright/prefer-comparison-matcher'?: Linter.RuleEntry<[]>
3529
+ /**
3530
+ * Suggest using the built-in equality matchers
3531
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-equality-matcher.md
3532
+ */
3533
+ 'playwright/prefer-equality-matcher'?: Linter.RuleEntry<[]>
3534
+ /**
3535
+ * Prefer having hooks in a consistent order
3536
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-hooks-in-order.md
3537
+ */
3538
+ 'playwright/prefer-hooks-in-order'?: Linter.RuleEntry<[]>
3539
+ /**
3540
+ * Suggest having hooks before any test cases
3541
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-hooks-on-top.md
3542
+ */
3543
+ 'playwright/prefer-hooks-on-top'?: Linter.RuleEntry<[]>
3544
+ /**
3545
+ * Suggest locators over page methods
3546
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-locator.md
3547
+ */
3548
+ 'playwright/prefer-locator'?: Linter.RuleEntry<[]>
3549
+ /**
3550
+ * Enforce lowercase test names
3551
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-lowercase-title.md
3552
+ */
3553
+ 'playwright/prefer-lowercase-title'?: Linter.RuleEntry<PlaywrightPreferLowercaseTitle>
3554
+ /**
3555
+ * Prefer native locator functions
3556
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-native-locators.md
3557
+ */
3558
+ 'playwright/prefer-native-locators'?: Linter.RuleEntry<PlaywrightPreferNativeLocators>
3559
+ /**
3560
+ * Suggest using `toStrictEqual()`
3561
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-strict-equal.md
3562
+ */
3563
+ 'playwright/prefer-strict-equal'?: Linter.RuleEntry<[]>
3564
+ /**
3565
+ * Suggest using `toBe()` for primitive literals
3566
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-to-be.md
3567
+ */
3568
+ 'playwright/prefer-to-be'?: Linter.RuleEntry<[]>
3569
+ /**
3570
+ * Suggest using toContain()
3571
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-to-contain.md
3572
+ */
3573
+ 'playwright/prefer-to-contain'?: Linter.RuleEntry<[]>
3574
+ /**
3575
+ * Suggest using `toHaveCount()`
3576
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-to-have-count.md
3577
+ */
3578
+ 'playwright/prefer-to-have-count'?: Linter.RuleEntry<[]>
3579
+ /**
3580
+ * Suggest using `toHaveLength()`
3581
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-to-have-length.md
3582
+ */
3583
+ 'playwright/prefer-to-have-length'?: Linter.RuleEntry<[]>
3584
+ /**
3585
+ * Prefer web first assertions
3586
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/prefer-web-first-assertions.md
3587
+ */
3588
+ 'playwright/prefer-web-first-assertions'?: Linter.RuleEntry<[]>
3589
+ /**
3590
+ * Require setup and teardown code to be within a hook
3591
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/require-hook.md
3592
+ */
3593
+ 'playwright/require-hook'?: Linter.RuleEntry<PlaywrightRequireHook>
3594
+ /**
3595
+ * Require all assertions to use `expect.soft`
3596
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/require-soft-assertions.md
3597
+ */
3598
+ 'playwright/require-soft-assertions'?: Linter.RuleEntry<[]>
3599
+ /**
3600
+ * Require a message for `toThrow()`
3601
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/require-to-throw-message.md
3602
+ */
3603
+ 'playwright/require-to-throw-message'?: Linter.RuleEntry<[]>
3604
+ /**
3605
+ * Require test cases and hooks to be inside a `test.describe` block
3606
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/require-top-level-describe.md
3607
+ */
3608
+ 'playwright/require-top-level-describe'?: Linter.RuleEntry<PlaywrightRequireTopLevelDescribe>
3609
+ /**
3610
+ * Enforce valid `describe()` callback
3611
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/valid-describe-callback.md
3612
+ */
3613
+ 'playwright/valid-describe-callback'?: Linter.RuleEntry<[]>
3614
+ /**
3615
+ * Enforce valid `expect()` usage
3616
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/valid-expect.md
3617
+ */
3618
+ 'playwright/valid-expect'?: Linter.RuleEntry<PlaywrightValidExpect>
3619
+ /**
3620
+ * Require promises that have expectations in their chain to be valid
3621
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/valid-expect-in-promise.md
3622
+ */
3623
+ 'playwright/valid-expect-in-promise'?: Linter.RuleEntry<[]>
3624
+ /**
3625
+ * Enforce valid titles
3626
+ * @see https://github.com/playwright-community/eslint-plugin-playwright/tree/main/docs/rules/valid-title.md
3627
+ */
3628
+ 'playwright/valid-title'?: Linter.RuleEntry<PlaywrightValidTitle>
3389
3629
  /**
3390
3630
  * Require using arrow functions for callbacks
3391
3631
  * @see https://eslint.org/docs/latest/rules/prefer-arrow-callback
@@ -9255,12 +9495,19 @@ type PerfectionistSortObjectTypes = []|[{
9255
9495
  // ----- perfectionist/sort-objects -----
9256
9496
  type PerfectionistSortObjects = []|[{
9257
9497
 
9498
+ destructuredObjects?: (boolean | {
9499
+
9500
+ groups?: boolean
9501
+ })
9502
+
9258
9503
  ignorePattern?: string[]
9259
9504
 
9260
9505
  partitionByComment?: (string[] | boolean | string)
9261
9506
 
9262
9507
  destructureOnly?: boolean
9263
9508
 
9509
+ objectDeclarations?: boolean
9510
+
9264
9511
  styledComponents?: boolean
9265
9512
 
9266
9513
  partitionByNewLine?: boolean
@@ -9353,6 +9600,72 @@ type PerfectionistSortVariableDeclarations = []|[{
9353
9600
 
9354
9601
  type?: ("alphabetical" | "natural" | "line-length")
9355
9602
  }]
9603
+ // ----- playwright/expect-expect -----
9604
+ type PlaywrightExpectExpect = []|[{
9605
+ assertFunctionNames?: []|[string]
9606
+ }]
9607
+ // ----- playwright/max-expects -----
9608
+ type PlaywrightMaxExpects = []|[{
9609
+ max?: number
9610
+ }]
9611
+ // ----- playwright/max-nested-describe -----
9612
+ type PlaywrightMaxNestedDescribe = []|[{
9613
+ max?: number
9614
+ }]
9615
+ // ----- playwright/missing-playwright-await -----
9616
+ type PlaywrightMissingPlaywrightAwait = []|[{
9617
+ customMatchers?: string[]
9618
+ }]
9619
+ // ----- playwright/no-hooks -----
9620
+ type PlaywrightNoHooks = []|[{
9621
+ allow?: unknown[]
9622
+ }]
9623
+ // ----- playwright/no-raw-locators -----
9624
+ type PlaywrightNoRawLocators = []|[{
9625
+ allowed?: string[]
9626
+ }]
9627
+ // ----- playwright/no-restricted-matchers -----
9628
+ type PlaywrightNoRestrictedMatchers = []|[{
9629
+ [k: string]: (string | null) | undefined
9630
+ }]
9631
+ // ----- playwright/no-skipped-test -----
9632
+ type PlaywrightNoSkippedTest = []|[{
9633
+ allowConditional?: boolean
9634
+ }]
9635
+ // ----- playwright/prefer-lowercase-title -----
9636
+ type PlaywrightPreferLowercaseTitle = []|[{
9637
+ allowedPrefixes?: string[]
9638
+ ignore?: ("test.describe" | "test")[]
9639
+ ignoreTopLevelDescribe?: boolean
9640
+ }]
9641
+ // ----- playwright/prefer-native-locators -----
9642
+ type PlaywrightPreferNativeLocators = []|[{
9643
+ testIdAttribute?: string
9644
+ }]
9645
+ // ----- playwright/require-hook -----
9646
+ type PlaywrightRequireHook = []|[{
9647
+ allowedFunctionCalls?: string[]
9648
+ }]
9649
+ // ----- playwright/require-top-level-describe -----
9650
+ type PlaywrightRequireTopLevelDescribe = []|[{
9651
+ maxTopLevelDescribes?: number
9652
+ }]
9653
+ // ----- playwright/valid-expect -----
9654
+ type PlaywrightValidExpect = []|[{
9655
+ maxArgs?: number
9656
+ minArgs?: number
9657
+ }]
9658
+ // ----- playwright/valid-title -----
9659
+ type PlaywrightValidTitle = []|[{
9660
+ disallowedWords?: string[]
9661
+ ignoreSpaces?: boolean
9662
+ ignoreTypeOfDescribeName?: boolean
9663
+ ignoreTypeOfStepName?: boolean
9664
+ ignoreTypeOfTestName?: boolean
9665
+ [k: string]: (string | [string]|[string, string] | {
9666
+ [k: string]: (string | [string]|[string, string]) | undefined
9667
+ })
9668
+ }]
9356
9669
  // ----- prefer-arrow-callback -----
9357
9670
  type PreferArrowCallback = []|[{
9358
9671
  allowNamedFunctions?: boolean
@@ -10456,14 +10769,15 @@ interface Options {
10456
10769
  */
10457
10770
  ignores?: string[];
10458
10771
  /**
10459
- * Are React rules enabled?
10772
+ * Are playwright rules enabled?
10460
10773
  * @default false
10461
10774
  */
10462
- react?: boolean | ReactOptions;
10775
+ playwright?: boolean;
10463
10776
  /**
10464
- * Are Jest rules enabled?
10777
+ * Are React rules enabled?
10465
10778
  * @default false
10466
10779
  */
10780
+ react?: boolean | ReactOptions;
10467
10781
  /**
10468
10782
  * Are testing rules enabled?
10469
10783
  * @default false
@@ -10476,7 +10790,7 @@ interface Options {
10476
10790
  typescript?: boolean | TypescriptOptions;
10477
10791
  }
10478
10792
 
10479
- declare const jimmyDotCodes: ({ astro, autoDetect, configs, ignores, react, testing, typescript, }?: Options, ...moreConfigs: Linter.Config[] | TypedConfigItem[]) => Promise<(TypedConfigItem | Linter.Config<Linter.RulesRecord> | _typescript_eslint_utils_ts_eslint.FlatConfig.Config | {
10793
+ declare const jimmyDotCodes: ({ astro, autoDetect, configs, ignores, playwright, react, testing, typescript, }?: Options, ...moreConfigs: Linter.Config[] | TypedConfigItem[]) => Promise<(TypedConfigItem | Linter.Config<Linter.RulesRecord> | _typescript_eslint_utils_ts_eslint.FlatConfig.Config | {
10480
10794
  files: string[];
10481
10795
  languageOptions: {
10482
10796
  globals: {
@@ -11155,6 +11469,32 @@ declare const jimmyDotCodes: ({ astro, autoDetect, configs, ignores, react, test
11155
11469
  }];
11156
11470
  "perfectionist/sort-modules": "off";
11157
11471
  };
11472
+ } | {
11473
+ files: string[];
11474
+ name: string;
11475
+ rules: {
11476
+ "playwright/expect-expect": "error";
11477
+ "playwright/max-nested-describe": "error";
11478
+ "playwright/no-conditional-expect": "error";
11479
+ "playwright/no-conditional-in-test": "error";
11480
+ "playwright/no-element-handle": "error";
11481
+ "playwright/no-eval": "error";
11482
+ "playwright/no-force-option": "error";
11483
+ "playwright/no-nested-step": "error";
11484
+ "playwright/no-page-pause": "error";
11485
+ "playwright/no-skipped-test": "error";
11486
+ "playwright/no-useless-await": "error";
11487
+ "playwright/no-useless-not": "error";
11488
+ "playwright/no-wait-for-selector": "error";
11489
+ "playwright/no-wait-for-timeout": "error";
11490
+ };
11491
+ ignores?: string[];
11492
+ language?: string;
11493
+ languageOptions?: Linter.LanguageOptions;
11494
+ linterOptions?: Linter.LinterOptions;
11495
+ processor?: string | Linter.Processor;
11496
+ plugins?: Record<string, eslint.ESLint.Plugin>;
11497
+ settings?: Record<string, unknown>;
11158
11498
  } | {
11159
11499
  rules: Linter.RulesRecord;
11160
11500
  name: string;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var B=Object.defineProperty;var r=(e,t)=>B(e,"name",{value:t,configurable:!0});import u from"globals";import{parser as $,configs as l}from"typescript-eslint";import h from"@eslint-community/eslint-plugin-eslint-comments/configs";import f from"eslint-plugin-import-x";import k from"eslint-plugin-n";import N from"@eslint/js";import v from"eslint-plugin-perfectionist";import F from"eslint-config-prettier";import*as w from"eslint-plugin-regexp";import{isPackageExists as a}from"local-pkg";import O from"eslint-plugin-unicorn";const n="?([cm])[jt]s?(x)",J=["**/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"],Q="**/*.?([cm])js",d="**/*.?([cm])jsx",C="**/*.?([cm])tsx",m=[`**/__tests__/**/*.${n}`,`**/*.spec.${n}`,`**/*.test.${n}`,`**/*.bench.${n}`,`**/*.benchmark.${n}`],y=[`**/e2e/**/*.spec.${n}`,`**/e2e/**/*.test.${n}`,`**/cypress/**/*.spec.${n}`,`**/cypress/**/*.test.${n}`],V="**/*.cjs",X="**/*.astro",z=["vi.mock","describe","expect","it"],U=["@testing-library/react"],s=r(async e=>{const t=await e;return t.default??t},"interopDefault"),D=r(async()=>{const e=[X],[t,o,i]=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:$},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: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"),H=r(()=>[{files:[V],languageOptions:{globals:u.commonjs},name:"jimmy.codes/commonjs"}],"commonjsConfig"),M={...h.recommended.rules,"@eslint-community/eslint-comments/no-unused-disable":"off","@eslint-community/eslint-comments/require-description":"error"},W=r(()=>[{...h.recommended,name:"jimmy.codes/eslint-comments",rules:M}],"eslintCommentsConfig"),Y=r(e=>[{ignores:[...J,...e],name:"jimmy.codes/ignores"}],"ignoresConfig"),K={...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"},Z={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}}},ee=r(({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":f,n:k},rules:K},...e?[Z]:[]],"importsConfig"),re={...N.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"},te=r(()=>[{linterOptions:{reportUnusedDisableDirectives:!0},name:"jimmy.codes/javascript",rules:re}],"javascriptConfig"),oe={"n/no-process-exit":"off","n/prefer-node-protocol":"error"},se=r(()=>[{name:"jimmy.codes/node",plugins:{n:k},rules:oe}],"nodeConfig"),ne={...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"},ie=r(()=>[{name:"jimmy.codes/perfectionist",plugins:{perfectionist:v},rules:ne}],"perfectionistConfig"),ae=r(()=>[{name:"jimmy.codes/prettier",...F}],"prettierConfig"),ce=r(e=>e===2?"error":e===1?"warn":"off","toStringSeverity"),E=r((e={})=>Object.fromEntries(Object.entries(e).map(([t,o])=>[t,typeof o=="number"?ce(o):o])),"normalizeRuleEntries"),pe=r(async()=>{const[e,t]=await Promise.all([s(import("eslint-plugin-react")),s(import("eslint-plugin-jsx-a11y"))]);return{...t.configs.recommended.rules,...E(e.configs.flat?.recommended?.rules),...E(e.configs.flat?.["jsx-runtime"]?.rules),"react-hooks/exhaustive-deps":"error","react-hooks/rules-of-hooks":"error","react-refresh/only-export-components":["warn",{allowConstantExport:!0}],"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"),le=r(async()=>{const[e,t,o,i]=await Promise.all([s(import("eslint-plugin-react")),s(import("eslint-plugin-jsx-a11y")),import("eslint-plugin-react-hooks"),import("eslint-plugin-react-refresh")]);return[{files:[d,C],languageOptions:{globals:{...u.browser},parserOptions:{ecmaFeatures:{jsx:!0},jsxPragma:null}},name:"jimmy.codes/react",plugins:{"jsx-a11y":t,react:e,"react-hooks":o,"react-refresh":i},rules:await pe(),settings:{react:{version:"detect"}}}]},"reactConfig"),fe={...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:fe}],"regexpConfig"),ue=r(async()=>{const e=await s(import("@tanstack/eslint-plugin-query"));return[{files:[d,C],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"}}]},"tanstackQuery"),P=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"),de=r(async()=>({...await P(),"jest/no-deprecated-functions":"off","jest/require-hook":["error",{allowedFunctionCalls:z}]}),"vitestRules"),ye=r(()=>a("typescript"),"hasTypescript"),ge=r(()=>a("react"),"hasReact"),T=r(()=>a("vitest"),"hasVitest"),_=r(()=>a("jest"),"hasJest"),je=r(()=>T()||_(),"hasTesting"),xe=r(()=>U.some(e=>a(e)),"hasTestingLibrary"),be=r(()=>a("@tanstack/react-query"),"hasReactQuery"),he=r(()=>a("astro"),"hasAstro"),ke=r(async({framework:e="vitest"}={},t=!0)=>{const o=t?T():e==="vitest",i=e==="jest"||t&&_(),c=[];if(o){const p=await s(import("eslint-plugin-jest"));c.push({files:m,ignores:y,...p.configs["flat/recommended"],name:"jimmy.codes/vitest",rules:await de()})}if(i){const p=await s(import("eslint-plugin-jest"));c.push({files:m,ignores:y,...p.configs["flat/recommended"],name:"jimmy.codes/jest",rules:await P()})}return c},"testingConfig"),ve=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:m,ignores:y,name:"jimmy.codes/testing-library",plugins:{"jest-dom":e,"testing-library":t},rules:await ve()}]},"testingLibrary"),Oe={"@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"},Ce=r(e=>[...l.strictTypeChecked,...l.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:Oe},{files:[Q,d],...l.disableTypeChecked},{files:m,name:"jimmy.codes/typescript/testing",rules:{"@typescript-eslint/no-unsafe-argument":"off","@typescript-eslint/no-unsafe-assignment":"off"}}],"typescriptConfig"),Ee={...O.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"},Pe=r(()=>[{...O.configs["flat/recommended"],name:"jimmy.codes/unicorn",rules:Ee}],"unicornConfig"),Te=r(e=>typeof e=="object"?e:void 0,"getTypescriptOptions"),_e=r(e=>typeof e=="object"?e:{framework:"vitest"},"getTestingOptions"),Re=r(e=>typeof e=="object"?e:{utilities:[]},"getReactOptions"),Le=r(({utilities:e=[]},t)=>e.includes("@tanstack/query")||t&&be(),"shouldEnableTanstackQuery"),qe=r(({utilities:e=[]},t)=>e.includes("testing-library")||t&&xe(),"shouldEnableTestingLibrary"),Se=r(async({astro:e=!1,autoDetect:t=!0,configs:o=[],ignores:i=[],react:c=!1,testing:p=!1,typescript:g=!1}={},...R)=>{const L=Re(c),j=_e(p),x=Te(g),b=g||!!x||t&&ye(),q=c||t&&ge(),S=p||t&&je(),A=e||t&&he(),G=Le(L,t),I=qe(j,t);return[te(),ie(),se(),Pe(),W(),me(),ee({typescript:b}),b?Ce(x):[],q?await le():[],G?await ue():[],A?await D():[],S?await ke(j,t):[],I?await we():[],ae(),H(),Y(i),o,R].flat()},"jimmyDotCodes");export{Se as default};
1
+ var F=Object.defineProperty;var r=(e,t)=>F(e,"name",{value:t,configurable:!0});import u from"globals";import{parser as J,configs as p}from"typescript-eslint";import w from"@eslint-community/eslint-plugin-eslint-comments/configs";import f from"eslint-plugin-import-x";import k from"eslint-plugin-n";import Q from"@eslint/js";import v from"eslint-plugin-perfectionist";import V from"eslint-config-prettier";import*as P from"eslint-plugin-regexp";import{isPackageExists as a}from"local-pkg";import O from"eslint-plugin-unicorn";const n="?([cm])[jt]s?(x)",X=["**/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"],z="**/*.?([cm])js",d="**/*.?([cm])jsx",C="**/*.?([cm])tsx",m=[`**/__tests__/**/*.${n}`,`**/*.spec.${n}`,`**/*.test.${n}`,`**/*.bench.${n}`,`**/*.benchmark.${n}`],E=[`**/e2e/**/*.spec.${n}`,`**/e2e/**/*.test.${n}`],g=[...E,`**/cypress/**/*.spec.${n}`,`**/cypress/**/*.test.${n}`],H="**/*.cjs",U="**/*.astro",W=["vi.mock","describe","expect","it"],Y=["@testing-library/react"],o=r(async e=>{const t=await e;return t.default??t},"interopDefault"),M=r(async()=>{const e=[U],[t,s,i]=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:J},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: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"),D=r(()=>[{files:[H],languageOptions:{globals:u.commonjs},name:"jimmy.codes/commonjs"}],"commonjsConfig"),K={...w.recommended.rules,"@eslint-community/eslint-comments/no-unused-disable":"off","@eslint-community/eslint-comments/require-description":"error"},Z=r(()=>[{...w.recommended,name:"jimmy.codes/eslint-comments",rules:K}],"eslintCommentsConfig"),ee=r(e=>[{ignores:[...X,...e],name:"jimmy.codes/ignores"}],"ignoresConfig"),re={...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"},te={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}}},oe=r(({typescript:e=!1}={})=>[{name:"jimmy.codes/imports",plugins:{"import-x":f,n:k},rules:re},...e?[te]:[]],"importsConfig"),se={...Q.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"},ne=r(()=>[{linterOptions:{reportUnusedDisableDirectives:!0},name:"jimmy.codes/javascript",rules:se}],"javascriptConfig"),ie={"n/no-process-exit":"off","n/prefer-node-protocol":"error"},ae=r(()=>[{name:"jimmy.codes/node",plugins:{n:k},rules:ie}],"nodeConfig"),ce={...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"},le=r(()=>[{name:"jimmy.codes/perfectionist",plugins:{perfectionist:v},rules:ce}],"perfectionistConfig"),pe=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-useless-await":"error","playwright/no-useless-not":"error","playwright/no-wait-for-selector":"error","playwright/no-wait-for-timeout":"error"}),"playwrightRules"),fe=r(async()=>[{...(await o(import("eslint-plugin-playwright"))).configs["flat/recommended"],files:E,name:"jimmy.codes/playwright",rules:await pe()}],"playwrightConfig"),me=r(()=>[{name:"jimmy.codes/prettier",...V}],"prettierConfig"),ue=r(e=>e===2?"error":e===1?"warn":"off","toStringSeverity"),T=r((e={})=>Object.fromEntries(Object.entries(e).map(([t,s])=>[t,typeof s=="number"?ue(s):s])),"normalizeRuleEntries"),de=r(async()=>{const[e,t]=await Promise.all([o(import("eslint-plugin-react")),o(import("eslint-plugin-jsx-a11y"))]);return{...t.configs.recommended.rules,...T(e.configs.flat?.recommended?.rules),...T(e.configs.flat?.["jsx-runtime"]?.rules),"react-hooks/exhaustive-deps":"error","react-hooks/rules-of-hooks":"error","react-refresh/only-export-components":["warn",{allowConstantExport:!0}],"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"),ge=r(async()=>{const[e,t,s,i]=await Promise.all([o(import("eslint-plugin-react")),o(import("eslint-plugin-jsx-a11y")),import("eslint-plugin-react-hooks"),import("eslint-plugin-react-refresh")]);return[{files:[d,C],languageOptions:{globals:{...u.browser},parserOptions:{ecmaFeatures:{jsx:!0},jsxPragma:null}},name:"jimmy.codes/react",plugins:{"jsx-a11y":t,react:e,"react-hooks":s,"react-refresh":i},rules:await de(),settings:{react:{version:"detect"}}}]},"reactConfig"),ye={...P.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"},je=r(()=>[{name:"jimmy.codes/regexp",plugins:{regexp:P},rules:ye}],"regexpConfig"),he=r(async()=>{const e=await o(import("@tanstack/eslint-plugin-query"));return[{files:[d,C],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"}}]},"tanstackQuery"),_=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"),xe=r(async()=>({...await _(),"jest/no-deprecated-functions":"off","jest/require-hook":["error",{allowedFunctionCalls:W}]}),"vitestRules"),be=r(()=>a("typescript"),"hasTypescript"),we=r(()=>a("react"),"hasReact"),R=r(()=>a("vitest"),"hasVitest"),L=r(()=>a("jest"),"hasJest"),ke=r(()=>R()||L(),"hasTesting"),ve=r(()=>Y.some(e=>a(e)),"hasTestingLibrary"),Pe=r(()=>a("@tanstack/react-query"),"hasReactQuery"),Oe=r(()=>a("astro"),"hasAstro"),Ce=r(()=>a("@playwright/test"),"hasPlaywright"),Ee=r(async({framework:e="vitest"}={},t=!0)=>{const s=t?R():e==="vitest",i=e==="jest"||t&&L(),l=[];if(s){const c=await o(import("eslint-plugin-jest"));l.push({files:m,ignores:g,...c.configs["flat/recommended"],name:"jimmy.codes/vitest",rules:await xe()})}if(i){const c=await o(import("eslint-plugin-jest"));l.push({files:m,ignores:g,...c.configs["flat/recommended"],name:"jimmy.codes/jest",rules:await _()})}return l},"testingConfig"),Te=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"),_e=r(async()=>{const[e,t]=await Promise.all([import("eslint-plugin-jest-dom"),o(import("eslint-plugin-testing-library"))]);return[{files:m,ignores:g,name:"jimmy.codes/testing-library",plugins:{"jest-dom":e,"testing-library":t},rules:await Te()}]},"testingLibrary"),Re={"@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"},Le=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:Re},{files:[z,d],...p.disableTypeChecked},{files:m,name:"jimmy.codes/typescript/testing",rules:{"@typescript-eslint/no-unsafe-argument":"off","@typescript-eslint/no-unsafe-assignment":"off"}}],"typescriptConfig"),qe={...O.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"},Se=r(()=>[{...O.configs["flat/recommended"],name:"jimmy.codes/unicorn",rules:qe}],"unicornConfig"),Ge=r(e=>typeof e=="object"?e:void 0,"getTypescriptOptions"),Ae=r(e=>typeof e=="object"?e:{framework:"vitest"},"getTestingOptions"),Ie=r(e=>typeof e=="object"?e:{utilities:[]},"getReactOptions"),Be=r(({utilities:e=[]},t)=>e.includes("@tanstack/query")||t&&Pe(),"shouldEnableTanstackQuery"),$e=r(({utilities:e=[]},t)=>e.includes("testing-library")||t&&ve(),"shouldEnableTestingLibrary"),Ne=r(async({astro:e=!1,autoDetect:t=!0,configs:s=[],ignores:i=[],playwright:l=!1,react:c=!1,testing:y=!1,typescript:j=!1}={},...q)=>{const S=Ie(c),h=Ae(y),x=Ge(j),b=j||!!x||t&&be(),G=c||t&&we(),A=y||t&&ke(),I=e||t&&Oe(),B=Be(S,t),$=$e(h,t),N=l||t&&Ce();return[ne(),le(),ae(),Se(),Z(),je(),oe({typescript:b}),b?Le(x):[],G?await ge():[],B?await he():[],I?await M():[],A?await Ee(h,t):[],$?await _e():[],N?await fe():[],me(),D(),ee(i),s,q].flat()},"jimmyDotCodes");export{Ne as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jimmy.codes/eslint-config",
3
- "version": "3.17.3",
3
+ "version": "3.19.0",
4
4
  "description": "another opinionated eslint config",
5
5
  "keywords": [
6
6
  "eslint",
@@ -33,10 +33,10 @@
33
33
  "dependencies": {
34
34
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
35
35
  "@eslint/js": "^9.15.0",
36
- "@tanstack/eslint-plugin-query": "^5.60.1",
36
+ "@tanstack/eslint-plugin-query": "^5.61.3",
37
37
  "@types/eslint": "9.6.1",
38
- "@typescript-eslint/parser": "^8.15.0",
39
- "@typescript-eslint/utils": "^8.15.0",
38
+ "@typescript-eslint/parser": "^8.16.0",
39
+ "@typescript-eslint/utils": "^8.16.0",
40
40
  "astro-eslint-parser": "^1.1.0",
41
41
  "eslint-config-prettier": "^9.1.0",
42
42
  "eslint-import-resolver-typescript": "^3.6.3",
@@ -46,7 +46,8 @@
46
46
  "eslint-plugin-jest-dom": "^5.5.0",
47
47
  "eslint-plugin-jsx-a11y": "^6.10.2",
48
48
  "eslint-plugin-n": "^17.14.0",
49
- "eslint-plugin-perfectionist": "^4.0.3",
49
+ "eslint-plugin-perfectionist": "^4.1.2",
50
+ "eslint-plugin-playwright": "^2.1.0",
50
51
  "eslint-plugin-react": "^7.37.2",
51
52
  "eslint-plugin-react-hooks": "^5.0.0",
52
53
  "eslint-plugin-react-refresh": "0.4.14",
@@ -55,7 +56,7 @@
55
56
  "eslint-plugin-unicorn": "^56.0.1",
56
57
  "globals": "^15.12.0",
57
58
  "local-pkg": "0.5.1",
58
- "typescript-eslint": "^8.15.0"
59
+ "typescript-eslint": "^8.16.0"
59
60
  },
60
61
  "peerDependencies": {
61
62
  "eslint": "^9.10.0"