@nicksp/eslint-config 1.4.0 → 1.5.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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{FlatConfigComposer as e}from"eslint-flat-config-utils";import{isPackageExists as t}from"local-pkg";import n from"globals";import r from"@eslint-community/eslint-plugin-eslint-comments/configs";import i from"@eslint/js";import a from"@vitest/eslint-plugin";import o from"eslint-config-flat-gitignore";import s from"eslint-plugin-antfu";import c from"eslint-plugin-de-morgan";import l from"eslint-plugin-erasable-syntax-only";import u from"eslint-plugin-import-lite";import d from"eslint-plugin-jsdoc";import f from"eslint-plugin-jsonc";import p from"eslint-plugin-n";import m from"eslint-plugin-no-only-tests";import h from"eslint-plugin-perfectionist";import ee from"eslint-plugin-unicorn";import g from"eslint-plugin-unused-imports";import _ from"eslint-plugin-yml";import v from"jsonc-eslint-parser";import y from"typescript-eslint";import te from"yaml-eslint-parser";import b from"node:process";import{fileURLToPath as ne}from"node:url";import{AST_NODE_TYPES as x}from"@typescript-eslint/utils";import{configs as re}from"eslint-plugin-regexp";import{defineConfig as ie}from"eslint/config";const S=`?([cm])[jt]s?(x)`,C=`**/*.?([cm])[jt]s?(x)`,w=`**/*.?([cm])js`,T=`**/*.?([cm])jsx`,E=`**/*.?([cm])ts`,D=`**/*.?([cm])tsx`,O=`**/*.json`,k=`**/*.json5`,ae=`**/*.jsonc`,A=`**/*.md`,oe=`**/*.y?(a)ml`,j=`**/*.astro`,M=`**/*.astro/*.js`,N=`**/*.astro/*.ts`,P=[`**/__tests__/**/*.${S}`,`**/*.spec.${S}`,`**/*.test.${S}`,`**/*.bench.${S}`,`**/*.benchmark.${S}`],F=`**/node_modules`,I=`**/dist`,L=[`**/package-lock.json`,`**/yarn.lock`,`**/pnpm-lock.yaml`,`**/bun.lockb`],R=[F,I,...L,`**/output`,`**/coverage`,`**/temp`,`**/.temp`,`**/tmp`,`**/.tmp`,`**/.history`,`**/.nuxt`,`**/.next`,`**/.vercel`,`**/.changeset`,`**/.idea`,`**/.cache`,`**/.output`,`**/.vite-inspect`,`**/.yarn`,`**/vite.config.*.timestamp-*`,`**/CHANGELOG*.md`,`**/*.min.*`,`**/LICENSE*`,`**/__snapshots__`,`**/auto-import?(s).d.ts`,`**/components.d.ts`],se=ne(new URL(`.`,import.meta.url)),ce=t(`@nicksp/eslint-config`);function z(e){return t(e,{paths:[se]})}async function B(e){if(b.env.CI!=null||b.stdout.isTTY===!1||ce===!1)return;let t=e.filter(e=>typeof e==`string`&&!z(e));t.length!==0&&await(await import(`@clack/prompts`)).confirm({message:`${t.length===1?`Package is`:`Packages are`} required for this config: ${t.join(`, `)}. Do you want to install them?`})===!0&&await import(`@antfu/install-pkg`).then(async e=>e.installPackage(t,{dev:!0}))}async function V(e){let t=await e;return t.default??t}function H(){return b.env.CI!=null||U()?!1:b.env.VSCODE_PID!=null||b.env.VSCODE_CWD!=null||b.env.JETBRAINS_IDE!=null||b.env.VIM!=null||b.env.NVIM!=null}function U(){return!!(b.env.GIT_PARAMS!=null||b.env.VSCODE_GIT_COMMAND!=null||b.env.npm_lifecycle_script?.startsWith(`lint-staged`))}function W(e,t){return typeof e[t]==`boolean`?{}:e[t]??{}}function G(e,t){let n=W(e,t);return{...typeof n==`object`&&`overrides`in n?n.overrides:{}}}async function K(e={}){let{files:t=[j],overrides:r={}}=e,[i,a]=await Promise.all([V(import(`astro-eslint-parser`)),V(import(`eslint-plugin-astro`))]);return[{name:`nicksp/astro/setup`,plugins:{astro:a}},{files:t,languageOptions:{globals:a.environments.astro.globals,parser:i,parserOptions:{extraFileExtensions:[`.astro`]},sourceType:`module`},name:`nicksp/astro/rules`,processor:`astro/client-side-ts`,rules:{"antfu/no-top-level-await":`off`,"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-unused-define-vars-in-style":`error`,"astro/valid-compile":`error`,...r}},{files:[M],languageOptions:{globals:{...n.browser},sourceType:`module`},name:`nicksp/astro/script/javascript`,rules:{"prettier/prettier":`off`}},{files:[N],languageOptions:{globals:{...n.browser},parser:y.parser,parserOptions:{project:null},sourceType:`module`},name:`nicksp/astro/script/typescript`,rules:{"prettier/prettier":`off`}},{files:[j,N],name:`nicksp/astro/disables`,rules:{"react-dom/no-unknown-property":`off`}}]}function q(){return[{...r.recommended,name:`nicksp/comments/recommended`},{name:`nicksp/comments/rules`,rules:{"@eslint-community/eslint-comments/disable-enable-pair":[`error`,{allowWholeFile:!0}]}}]}function J(){return[{files:[`**/scripts/${C}`],name:`nicksp/disables/scripts`,rules:{"@typescript-eslint/explicit-function-return-type":`off`,"antfu/no-top-level-await":`off`,"no-console":`off`}},{files:[`**/bin/**/*`,`**/bin.${S}`],name:`nicksp/disables/bin`,rules:{"antfu/no-import-dist":`off`,"antfu/no-import-node-modules-by-path":`off`}},{files:[`**/*.d.?([cm])ts`],name:`nicksp/disables/dts`,rules:{"@eslint-community/eslint-comments/no-unlimited-disable":`off`,"no-restricted-syntax":`off`,"unused-imports/no-unused-vars":`off`}},{files:P,name:`nicksp/disables/tests`,rules:{"@typescript-eslint/explicit-function-return-type":`off`,"antfu/no-top-level-await":`off`,"no-unused-expressions":`off`,"node/prefer-global/process":`off`,"unicorn/consistent-function-scoping":`off`}},{files:[`**/*.js`,`**/*.cjs`],name:`nicksp/disables/cjs`,rules:{"@typescript-eslint/no-require-imports":`off`}},{files:[`**/*.config.${S}`,`**/*.config.*.${S}`],name:`nicksp/disables/config-files`,rules:{"@typescript-eslint/explicit-function-return-type":`off`,"antfu/no-top-level-await":`off`,"no-console":`off`}}]}function Y(e=[]){return[{ignores:[...R,...e],name:`nicksp/ignores/global`},{...o({strict:!1}),name:`nicksp/ignores/gitignore`}]}function X(){return[{name:`nicksp/imports/rules`,plugins:{antfu:s,import:u},rules:{"antfu/import-dedupe":`error`,"antfu/no-import-dist":`error`,"antfu/no-import-node-modules-by-path":`error`,"import/first":`error`,"import/no-duplicates":`error`,"import/no-mutable-exports":`error`,"import/no-named-default":`error`}}]}const Z=[x.ForInStatement,x.LabeledStatement,x.TSExportAssignment];function le(e={}){let{isInEditor:t=!1,overrides:r={}}=e;return[{...i.configs.recommended,name:`nicksp/javascript/recommended`},{languageOptions:{ecmaVersion:`latest`,globals:{...n.browser,...n.es2026,...n.node,document:`readonly`,navigator:`readonly`,window:`readonly`},parserOptions:{ecmaFeatures:{jsx:!0},ecmaVersion:`latest`,sourceType:`module`},sourceType:`module`},linterOptions:{reportUnusedDisableDirectives:!0},name:`nicksp/javascript/setup`},{name:`nicksp/javascript/rules`,plugins:{antfu:s,"de-morgan":c,"unused-imports":g},rules:{"accessor-pairs":[`error`,{enforceForClassMembers:!0,setWithoutGet:!0}],"antfu/no-top-level-await":`error`,"array-callback-return":`error`,"block-scoped-var":`error`,"default-case-last":`error`,"dot-notation":t?`warn`:`error`,eqeqeq:[`error`,`smart`],"new-cap":[`error`,{capIsNew:!1,newIsCap:!0,properties:!0}],"no-alert":t?`warn`:`error`,"no-array-constructor":`error`,"no-caller":`error`,"no-cond-assign":[`error`,`always`],"no-console":[t?`warn`:`error`,{allow:[`warn`,`error`]}],"no-debugger":t?`warn`:`error`,"no-duplicate-imports":`error`,"no-empty":[`error`,{allowEmptyCatch:!0}],"no-eval":`error`,"no-extend-native":`error`,"no-extra-bind":`error`,"no-implied-eval":`error`,"no-inner-declarations":`error`,"no-iterator":`error`,"no-labels":[`error`,{allowLoop:!1,allowSwitch:!1}],"no-lone-blocks":`error`,"no-lonely-if":`error`,"no-multi-str":`error`,"no-new":`error`,"no-new-func":`error`,"no-new-wrappers":`error`,"no-octal-escape":`error`,"no-proto":`error`,"no-restricted-globals":[`error`,{message:"Use `globalThis` instead.",name:`global`},{message:"Use `globalThis` instead.",name:`self`}],"no-restricted-properties":[`error`,{message:"Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",property:`__proto__`},{message:"Use `Object.defineProperty` instead.",property:`__defineGetter__`},{message:"Use `Object.defineProperty` instead.",property:`__defineSetter__`},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:`__lookupGetter__`},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:`__lookupSetter__`}],"no-restricted-syntax":[`error`,...Z,`TSEnumDeclaration[const=true]`],"no-self-compare":`error`,"no-sequences":`error`,"no-template-curly-in-string":`error`,"no-throw-literal":`error`,"no-undef-init":`error`,"no-unmodified-loop-condition":`error`,"no-unneeded-ternary":[`error`,{defaultAssignment:!1}],"no-unreachable-loop":`error`,"no-unused-expressions":[`error`,{allowShortCircuit:!0,allowTaggedTemplates:!0,allowTernary:!0}],"no-unused-vars":[`error`,{args:`none`,caughtErrors:`none`,ignoreRestSiblings:!0,vars:`all`}],"no-use-before-define":[`error`,{classes:!1,functions:!1,variables:!0}],"no-useless-call":`error`,"no-useless-computed-key":`error`,"no-useless-constructor":`error`,"no-useless-rename":`error`,"no-useless-return":`error`,"no-var":`error`,"no-void":`error`,"object-shorthand":[`error`,`always`,{avoidQuotes:!0,ignoreConstructors:!1}],"one-var":[`error`,{initialized:`never`}],"prefer-arrow-callback":[`error`,{allowNamedFunctions:!1,allowUnboundThis:!0}],"prefer-const":[t?`warn`:`error`,{destructuring:`all`,ignoreReadBeforeAssign:!0}],"prefer-exponentiation-operator":`error`,"prefer-promise-reject-errors":`error`,"prefer-regex-literals":[`error`,{disallowRedundantWrapping:!0}],"prefer-rest-params":`error`,"prefer-spread":`error`,"prefer-template":`error`,"symbol-description":`error`,"unicode-bom":[`error`,`never`],"unused-imports/no-unused-imports":t?`warn`:`error`,"unused-imports/no-unused-vars":[`error`,{args:`after-used`,argsIgnorePattern:`^_`,ignoreRestSiblings:!0,varsIgnorePattern:`^_`}],"use-isnan":[`error`,{enforceForIndexOf:!0,enforceForSwitchCase:!0}],"valid-typeof":[`error`,{requireStringLiterals:!0}],"vars-on-top":`error`,yoda:[`error`,`never`],...c.configs.recommended.rules,...r}}]}function ue(){return[{name:`nicksp/jsdoc/rules`,plugins:{jsdoc:d},rules:{"jsdoc/check-access":`warn`,"jsdoc/check-param-names":`warn`,"jsdoc/check-property-names":`warn`,"jsdoc/check-types":`warn`,"jsdoc/empty-tags":`warn`,"jsdoc/implements-on-classes":`warn`,"jsdoc/no-defaults":`warn`,"jsdoc/no-multi-asterisks":`warn`,"jsdoc/require-param-name":`warn`,"jsdoc/require-property":`warn`,"jsdoc/require-property-description":`warn`,"jsdoc/require-property-name":`warn`,"jsdoc/require-returns-check":`warn`,"jsdoc/require-returns-description":`warn`,"jsdoc/require-yields-check":`warn`,"jsdoc/type-formatting":[`warn`,{stringQuotes:`single`}]}}]}function de(){return[{name:`nicksp/jsonc/setup`,plugins:{jsonc:f}},{files:[O,k,ae],languageOptions:{parser:v},name:`nicksp/jsonc/rules`,rules:{...f.configs[`recommended-with-jsonc`].rules,"jsonc/no-octal-escape":`error`,"jsonc/quote-props":`off`,"jsonc/quotes":`off`}}]}async function fe(e={}){let{a11y:t}=e,n={files:[T,D],languageOptions:{parserOptions:{ecmaFeatures:{jsx:!0}}},name:`nicksp/jsx/setup`,plugins:{},rules:{}};if(t===!1||t===void 0)return[n];await B([`eslint-plugin-jsx-a11y`]);let r=await V(import(`eslint-plugin-jsx-a11y`)),i=r.flatConfigs.recommended,a={...i.rules,...typeof t==`object`&&t.overrides?t.overrides:{}};return[{...n,...i,files:n.files,languageOptions:{...n.languageOptions,...i.languageOptions},name:n.name,plugins:{...n.plugins,"jsx-a11y":r},rules:{...n.rules,...a}}]}async function pe(e={}){let{files:t=[C],overrides:n={}}=e;await B([`@next/eslint-plugin-next`]);let r=await V(import(`@next/eslint-plugin-next`));return[{name:`nicksp/nextjs/setup`,plugins:{"@next/next":r}},{files:t,languageOptions:{parserOptions:{ecmaFeatures:{jsx:!0}},sourceType:`module`},name:`nicksp/nextjs/rules`,rules:{...r.configs.recommended.rules,...r.configs[`core-web-vitals`].rules,...n},settings:{react:{version:`detect`}}}]}function me(){return[{name:`nicksp/node/rules`,plugins:{node:p},rules:{"node/handle-callback-err":[`error`,`^(err|error)$`],"node/hashbang":`error`,"node/no-deprecated-api":`error`,"node/no-exports-assign":`error`,"node/no-extraneous-import":`error`,"node/no-extraneous-require":`error`,"node/no-new-require":`error`,"node/no-path-concat":`error`,"node/no-process-env":[`error`,{allowedVariables:[`NODE_ENV`]}],"node/no-unpublished-bin":`error`,"node/no-unpublished-import":`error`,"node/no-unpublished-require":`error`,"node/no-unsupported-features/es-builtins":`error`,"node/no-unsupported-features/es-syntax":[`error`,{ignores:[`modules`]}],"node/prefer-global/buffer":[`error`,`never`],"node/prefer-global/process":[`error`,`never`],"node/process-exit-as-throw":`error`}}]}async function he(e={}){let{enableAstro:t=z(`prettier-plugin-astro`),options:n={}}=e;await B([`@nicksp/prettier-config`,t?`prettier-plugin-astro`:void 0]);let[r,i]=await Promise.all([V(import(`eslint-plugin-prettier`)),V(import(`eslint-plugin-prettier/recommended`))]),a={...await import(`@nicksp/prettier-config`),...n},o=[{name:`nicksp/prettier/setup`,plugins:{antfu:s,prettier:r}}];return t&&o.push({files:[j],name:`nicksp/prettier/astro`,rules:{"prettier/prettier":[`warn`,{...a,parser:`astro`,plugins:[`prettier-plugin-astro`]}]}}),o.push({name:`nicksp/prettier/rules`,rules:{...i.rules,"antfu/consistent-chaining":`error`,"antfu/consistent-list-newline":`error`,"antfu/top-level-function":`error`,curly:[`error`,`all`],"prettier/prettier":[`warn`,a]}}),o}const ge=[`vite`],_e=[`@react-router/node`,`@react-router/react`,`@react-router/serve`,`@react-router/dev`],ve=[`next`];async function ye(e={}){let{files:n=[C],filesTypeAware:r=[E,D],ignoresTypeAware:i=[`${A}/**`,N],overrides:a={},typeAware:o}=e;await B([`@eslint-react/eslint-plugin`,`eslint-plugin-react-hooks`,`eslint-plugin-react-refresh`]);let[s,c,l]=await Promise.all([V(import(`@eslint-react/eslint-plugin`)),V(import(`eslint-plugin-react-hooks`)),V(import(`eslint-plugin-react-refresh`))]),u={"react-x/no-leaked-conditional-rendering":`warn`},d=ge.some(e=>t(e)),f=_e.some(e=>t(e)),p=ve.some(e=>t(e)),m=s.configs.all.plugins;return[{name:`nicksp/react/setup`,plugins:{"react-dom":m[`@eslint-react/dom`],"react-hooks":c,"react-hooks-extra":m[`@eslint-react/hooks-extra`],"react-naming-convention":m[`@eslint-react/naming-convention`],"react-refresh":l,"react-web-api":m[`@eslint-react/web-api`],"react-x":m[`@eslint-react`]}},{files:n,languageOptions:{parserOptions:{ecmaFeatures:{jsx:!0}},sourceType:`module`},name:`nicksp/react/rules`,rules:{...m[`@eslint-react`].configs.recommended.rules,...m[`@eslint-react/dom`].configs.recommended.rules,...c.configs.recommended.rules,...m[`@eslint-react/hooks-extra`].configs.recommended.rules,...m[`@eslint-react/naming-convention`].configs.recommended.rules,...m[`@eslint-react/web-api`].configs.recommended.rules,"react-refresh/only-export-components":[`error`,{allowConstantExport:d,allowExportNames:[...p?[`experimental_ppr`,`dynamic`,`dynamicParams`,`revalidate`,`fetchCache`,`runtime`,`preferredRegion`,`maxDuration`,`viewport`]:[],...f?[`action`,`headers`,`links`,`loader`,`meta`,`clientLoader`,`clientAction`,`handle`,`shouldRevalidate`]:[]]}],...a}},...o?[{files:r,ignores:i,name:`nicksp/react/type-aware-rules`,rules:{...u}}]:[]]}function be(e={}){let t=re[`flat/recommended`],n={...t.rules};if(e.level===`warn`)for(let[e,t]of Object.entries(n))t===`error`&&(n[e]=`warn`);return[{...t,name:`nicksp/regexp/rules`,rules:{...n,...e.overrides}}]}function xe(){return[{files:[`**/package.json`],name:`nicksp/sort/package-json`,rules:{"jsonc/sort-array-values":[`error`,{order:{type:`asc`},pathPattern:`^files$`}],"jsonc/sort-keys":[`error`,{order:`publisher.name.displayName.description.version.type.private.packageManager.author.contributors.license.funding.homepage.repository.bugs.keywords.categories.sideEffects.main.imports.exports.module.types.unpkg.jsdelivr.typesVersions.bin.icon.files.engines.activationEvents.contributes.directories.publishConfig.scripts.peerDependencies.peerDependenciesMeta.optionalDependencies.dependencies.devDependencies.pnpm.overrides.resolutions.browserslist.husky.simple-git-hooks.lint-staged.eslintConfig.prettier.tsdown`.split(`.`),pathPattern:`^$`},{order:{type:`asc`},pathPattern:`^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$`},{order:{type:`asc`},pathPattern:`^(?:resolutions|overrides|pnpm.overrides)$`},{order:{type:`asc`},pathPattern:String.raw`^workspaces\.catalog$`},{order:{type:`asc`},pathPattern:String.raw`^workspaces\.catalogs\.[^.]+$`},{order:[`types`,`require`,`import`,`default`],pathPattern:`^exports.*$`},{order:[`pre-commit`,`prepare-commit-msg`,`commit-msg`,`post-commit`,`pre-rebase`,`post-rewrite`,`post-checkout`,`post-merge`,`pre-push`,`pre-auto-gc`],pathPattern:`^(?:gitHooks|husky|simple-git-hooks)$`}]}}]}function Se(){return[{files:[`**/[jt]sconfig.json`,`**/[jt]sconfig.*.json`],name:`nicksp/sort/tsconfig`,rules:{"jsonc/sort-keys":[`error`,{order:[`extends`,`compilerOptions`,`references`,`files`,`include`,`exclude`],pathPattern:`^$`},{order:`incremental.composite.tsBuildInfoFile.disableSourceOfProjectReferenceRedirect.disableSolutionSearching.disableReferencedProjectLoad.target.jsx.jsxFactory.jsxFragmentFactory.jsxImportSource.lib.moduleDetection.noLib.reactNamespace.useDefineForClassFields.emitDecoratorMetadata.experimentalDecorators.libReplacement.baseUrl.rootDir.rootDirs.customConditions.module.moduleResolution.moduleSuffixes.noResolve.paths.resolveJsonModule.resolvePackageJsonExports.resolvePackageJsonImports.typeRoots.types.allowArbitraryExtensions.allowImportingTsExtensions.allowUmdGlobalAccess.allowJs.checkJs.maxNodeModuleJsDepth.strict.strictBindCallApply.strictFunctionTypes.strictNullChecks.strictPropertyInitialization.allowUnreachableCode.allowUnusedLabels.alwaysStrict.exactOptionalPropertyTypes.noFallthroughCasesInSwitch.noImplicitAny.noImplicitOverride.noImplicitReturns.noImplicitThis.noPropertyAccessFromIndexSignature.noUncheckedIndexedAccess.noUnusedLocals.noUnusedParameters.useUnknownInCatchVariables.declaration.declarationDir.declarationMap.downlevelIteration.emitBOM.emitDeclarationOnly.importHelpers.importsNotUsedAsValues.inlineSourceMap.inlineSources.mapRoot.newLine.noEmit.noEmitHelpers.noEmitOnError.outDir.outFile.preserveConstEnums.preserveValueImports.removeComments.sourceMap.sourceRoot.stripInternal.allowSyntheticDefaultImports.erasableSyntaxOnly.esModuleInterop.forceConsistentCasingInFileNames.isolatedDeclarations.isolatedModules.preserveSymlinks.verbatimModuleSyntax.skipDefaultLibCheck.skipLibCheck`.split(`.`),pathPattern:`^compilerOptions$`}]}}]}function Ce(){return[{name:`nicksp/sort/imports`,plugins:{perfectionist:h},rules:{"perfectionist/sort-exports":[`error`,{type:`natural`}],"perfectionist/sort-imports":[`error`,{customGroups:[{elementNamePattern:[`^react$`,`^react-.+`],groupName:`react`,selector:`type`},{elementNamePattern:[`^next$`,`^next[/-].+`],groupName:`next`,selector:`type`},{elementNamePattern:[`^react$`,`^react-.+`],groupName:`react`},{elementNamePattern:[`^next$`,`^next[/-].+`],groupName:`next`}],groups:[`react`,`next`,{newlinesBetween:1},`builtin`,`external`,{newlinesBetween:1},`internal`,[`parent`,`sibling`,`index`],{newlinesBetween:1},`type`,[`internal-type`,`parent-type`,`sibling-type`,`index-type`],{newlinesBetween:1},`side-effect`,`side-effect-style`,`style`,`unknown`],newlinesBetween:`never`,type:`natural`}],"perfectionist/sort-named-exports":[`error`,{type:`natural`}],"perfectionist/sort-named-imports":[`error`,{type:`natural`}]}}]}let Q;function $(e={}){let{files:t=P,isInEditor:n=!1,overrides:r={}}=e;return Q=!!Q||{...a,rules:{...a.rules,...m.rules}},[{name:`nicksp/test/setup`,plugins:{test:Q}},{files:t,name:`nicksp/test/rules`,rules:{"test/consistent-test-it":[`error`,{fn:`it`,withinDescribe:`it`}],"test/no-identical-title":`error`,"test/no-import-node-test":`error`,"test/no-only-tests":n?`warn`:`error`,"test/padding-around-all":`error`,"test/prefer-hooks-in-order":`error`,"test/prefer-lowercase-title":[`error`,{ignore:[`describe`]}],...r}}]}function we(e){let t={};for(let n of e)n.rules&&Object.assign(t,n.rules);return t}const Te=ie(y.configs.strict,y.configs.stylistic),Ee=we(Te),De=ie(y.configs.strictTypeChecked,y.configs.stylisticTypeChecked),Oe=we(De);function ke(e={}){let{overrides:t={},overridesTypeAware:n={},type:r=`app`,typeAware:i}=e,a=e.files??[E,D],o=e.filesTypeAware??[E,D],s=e.ignoresTypeAware??[`${A}/**`,N],c={"@typescript-eslint/consistent-type-exports":[`error`,{fixMixedExportsWithInlineTypeSpecifier:!0}],"@typescript-eslint/promise-function-async":`error`,"@typescript-eslint/restrict-plus-operands":`error`,"@typescript-eslint/restrict-template-expressions":`error`,"@typescript-eslint/return-await":[`error`,`in-try-catch`],"@typescript-eslint/strict-boolean-expressions":[`error`,{allowNullableBoolean:!0,allowNullableObject:!0}],"@typescript-eslint/switch-exhaustiveness-check":`error`};function u(e,t,n){return{files:t,...n?{ignores:n}:{},languageOptions:{parser:y.parser,parserOptions:{sourceType:`module`,...e?{projectService:{allowDefaultProject:[`*.js`]},tsconfigRootDir:b.cwd()}:{}},sourceType:`module`},name:`nicksp/typescript/${e?`type-aware-parser`:`parser`}`}}return[{name:`nicksp/typescript/setup`,plugins:{"@typescript-eslint":y.plugin,"erasable-syntax-only":l}},...i?[u(!0,o,s)]:[u(!1,a)],{files:a,name:`nicksp/typescript/recommended`,rules:{...i?Oe:Ee}},{files:a,name:`nicksp/typescript/rules`,rules:{"@typescript-eslint/ban-ts-comment":[`error`,{"ts-expect-error":`allow-with-description`}],"@typescript-eslint/consistent-type-assertions":[`error`,{objectLiteralTypeAssertions:`allow-as-parameter`}],"@typescript-eslint/consistent-type-imports":[`error`,{disallowTypeAnnotations:!1,fixStyle:`inline-type-imports`}],"@typescript-eslint/method-signature-style":[`error`,`property`],"@typescript-eslint/no-dupe-class-members":`error`,"@typescript-eslint/no-dynamic-delete":`off`,"@typescript-eslint/no-empty-object-type":[`error`,{allowInterfaces:`with-single-extends`}],"@typescript-eslint/no-explicit-any":`off`,"@typescript-eslint/no-extraneous-class":`off`,"@typescript-eslint/no-import-type-side-effects":`error`,"@typescript-eslint/no-invalid-void-type":`off`,"@typescript-eslint/no-redeclare":`error`,"@typescript-eslint/no-unnecessary-boolean-literal-compare":`off`,"@typescript-eslint/no-unnecessary-parameter-property-assignment":`error`,"@typescript-eslint/no-unsafe-function-type":`off`,"@typescript-eslint/no-unused-expressions":[`error`,{allowShortCircuit:!0,allowTaggedTemplates:!0,allowTernary:!0}],"@typescript-eslint/no-unused-vars":`off`,"@typescript-eslint/no-use-before-define":[`error`,{classes:!1,functions:!1,variables:!0}],"@typescript-eslint/no-useless-constructor":`error`,"@typescript-eslint/no-useless-empty-export":`error`,"@typescript-eslint/prefer-as-const":`warn`,"@typescript-eslint/prefer-literal-enum-member":[`error`,{allowBitwiseExpressions:!0}],"no-dupe-class-members":`off`,"no-redeclare":`off`,"no-restricted-syntax":[`error`,...Z,`TSEnumDeclaration[const=true]`],"no-use-before-define":`off`,"no-useless-constructor":`off`,...l.configs.recommended.rules,...r===`lib`?{"@typescript-eslint/explicit-function-return-type":[`error`,{allowExpressions:!0,allowHigherOrderFunctions:!0,allowIIFEs:!0}]}:{},...t}},...i?[{files:o,ignores:s,name:`nicksp/typescript/type-aware-rules`,rules:{...c,...n}}]:[],{files:[`**/*.d.ts`],name:`nicksp/typescript/dts-rules`,rules:{"eslint-comments/no-unlimited-disable":`off`,"import/no-duplicates":`off`,"no-restricted-syntax":`off`,"unused-imports/no-unused-vars":`off`}},{files:[w,`**/*.cjs`],name:`nicksp/typescript/cjs-rules`,rules:{"@typescript-eslint/no-require-imports":`off`}}]}const Ae=[String.raw`README\.md$`,String.raw`CODE_OF_CONDUCT\.md$`,String.raw`CONTRIBUTING\.md$`,String.raw`FUNDING\.yml$`,String.raw`GOVERNANCE\.md$`,String.raw`SECURITY\.md$`,String.raw`SUPPORT\.md$`,String.raw`CHANGELOG.*\.md$`,`LICENSE.*$`];function je(e={}){let{overrides:t={}}=e;return[{...ee.configs.unopinionated,name:`nicksp/unicorn/unopinionated`},{name:`nicksp/unicorn/rules`,rules:{"unicorn/consistent-empty-array-spread":`error`,"unicorn/consistent-function-scoping":[`error`,{checkArrowFunctions:!1}],"unicorn/custom-error-definition":`error`,"unicorn/filename-case":[`error`,{cases:{kebabCase:!0,pascalCase:!0},ignore:[...Ae]}],"unicorn/import-style":[`warn`,{styles:{chalk:{default:!0},"node:child_process":{named:!0},"node:fs":{named:!0},"node:fs/promises":{named:!0},"node:os":{default:!0},"node:path":{default:!0},"node:readline":{default:!0},"node:util":{named:!0}}}],"unicorn/no-for-loop":`error`,"unicorn/no-process-exit":`off`,"unicorn/no-useless-undefined":[`error`,{checkArguments:!1,checkArrowFunctionBody:!1}],"unicorn/prefer-global-this":`off`,"unicorn/prefer-query-selector":`error`,"unicorn/prefer-set-has":`off`,"unicorn/prefer-ternary":`off`,"unicorn/prefer-top-level-await":`off`,"unicorn/require-module-specifiers":`off`,...t}}]}function Me(e={}){let{files:t=[oe],overrides:n={}}=e;return[{name:`nicksp/yaml/setup`,plugins:{yml:_}},{files:t,languageOptions:{parser:te},name:`nicksp/yaml/rules`,rules:{..._.configs.standard.rules,..._.configs.prettier.rules,...n}},{files:[`pnpm-workspace.yaml`],name:`nicksp/yaml/pnpm-workspace`,rules:{"yml/sort-keys":[`error`,{order:[`packages`,`overrides`,`patchedDependencies`,`hoistPattern`,`catalog`,`catalogs`,`allowedDeprecatedVersions`,`allowNonAppliedPatches`,`configDependencies`,`ignoredBuiltDependencies`,`ignoredOptionalDependencies`,`neverBuiltDependencies`,`onlyBuiltDependencies`,`onlyBuiltDependenciesFile`,`packageExtensions`,`peerDependencyRules`,`supportedArchitectures`],pathPattern:`^$`},{order:{type:`asc`},pathPattern:`.*`}]}}]}function Ne(n={},...r){let{astro:i=!1,jsx:a=!0,nextjs:o=!1,prettier:s=!0,react:c=!1,regexp:l=!0,test:u=!0,type:d=`app`,typescript:f=t(`typescript`),yaml:p=!0}=n,m=H();m&&console.log(`[@nicksp/eslint-config] Detected running in editor, some rules are disabled.`);let h=[],ee=typeof s==`object`?s.options:{},g=W(n,`typescript`),_=g.typeAware??!0;if(h.push(Y(n.ignores),le({isInEditor:m,overrides:G(n,`javascript`)}),je(),q(),me(),ue(),X(),Ce()),a!==!1&&h.push(fe(a===!0?{}:a)),f!==!1&&h.push(ke({...g,overrides:G(n,`typescript`),type:d,typeAware:_})),s!==!1&&h.push(he({enableAstro:!!i,options:ee})),l!==!1&&h.push(be(typeof l==`boolean`?{}:l)),u!==!1&&h.push($({isInEditor:m,overrides:G(n,`test`)})),c!==!1&&h.push(ye({...g,overrides:G(n,`react`),typeAware:_})),o!==!1&&h.push(pe({overrides:G(n,`nextjs`)})),i!==!1&&h.push(K({overrides:G(n,`astro`)})),h.push(de(),xe(),Se()),p!==!1&&h.push(Me({overrides:G(n,`yaml`)})),h.push(J()),`files`in n)throw Error(`[@nicksp/eslint-config] The first argument should not contain the "files" property as the options are supposed to be global. Place it in the second or later config instead.`);let v=new e(...h,...r);return m&&(v=v.disableRulesFix([`unused-imports/no-unused-imports`,`test/no-only-tests`,`prefer-const`],{builtinRules:async()=>import([`eslint`,`use-at-your-own-risk`].join(`/`)).then(e=>e.builtinRules)})),v}var Pe=Ne;export{j as GLOB_ASTRO,M as GLOB_ASTRO_JS,N as GLOB_ASTRO_TS,I as GLOB_DIST,R as GLOB_EXCLUDE,w as GLOB_JS,O as GLOB_JSON,k as GLOB_JSON5,ae as GLOB_JSONC,T as GLOB_JSX,L as GLOB_LOCKFILE,A as GLOB_MARKDOWN,F as GLOB_NODE_MODULES,C as GLOB_SRC,S as GLOB_SRC_EXT,P as GLOB_TESTS,E as GLOB_TS,D as GLOB_TSX,oe as GLOB_YAML,K as astro,q as comments,Pe as default,Ne as defineConfig,J as disables,B as ensurePackages,G as getOverrides,Y as ignores,X as imports,V as interopDefault,H as isInEditorEnv,U as isInGitHooksOrLintStaged,z as isPackageInScope,le as javascript,ue as jsdoc,de as jsonc,fe as jsx,pe as nextjs,me as node,he as prettier,ye as react,be as regexp,W as resolveSubOptions,Z as restrictedSyntaxJs,Ce as sortImports,xe as sortPackageJson,Se as sortTsconfig,$ as test,ke as typescript,Te as typescriptRecommended,De as typescriptTypeCheckedRecommended,je as unicorn,Me as yaml};
1
+ import{FlatConfigComposer as e}from"eslint-flat-config-utils";import{isPackageExists as t}from"local-pkg";import n from"globals";import r from"@eslint-community/eslint-plugin-eslint-comments/configs";import i from"@eslint/js";import a from"@vitest/eslint-plugin";import o from"eslint-config-flat-gitignore";import s from"eslint-plugin-antfu";import c from"eslint-plugin-de-morgan";import l from"eslint-plugin-erasable-syntax-only";import u from"eslint-plugin-import-lite";import d from"eslint-plugin-jsdoc";import f from"eslint-plugin-jsonc";import p from"eslint-plugin-n";import m from"eslint-plugin-no-only-tests";import h from"eslint-plugin-perfectionist";import ee from"eslint-plugin-unicorn";import g from"eslint-plugin-unused-imports";import _ from"eslint-plugin-yml";import v from"jsonc-eslint-parser";import y from"typescript-eslint";import te from"yaml-eslint-parser";import b from"node:process";import{fileURLToPath as ne}from"node:url";import{AST_NODE_TYPES as x}from"@typescript-eslint/utils";import{configs as re}from"eslint-plugin-regexp";import{defineConfig as ie}from"eslint/config";const S=`?([cm])[jt]s?(x)`,C=`**/*.?([cm])[jt]s?(x)`,w=`**/*.?([cm])js`,T=`**/*.?([cm])jsx`,E=`**/*.?([cm])ts`,D=`**/*.?([cm])tsx`,O=`**/*.json`,k=`**/*.json5`,ae=`**/*.jsonc`,A=`**/*.md`,oe=`**/*.y?(a)ml`,j=`**/*.astro`,M=`**/*.astro/*.js`,N=`**/*.astro/*.ts`,P=[`**/__tests__/**/*.${S}`,`**/*.spec.${S}`,`**/*.test.${S}`,`**/*.bench.${S}`,`**/*.benchmark.${S}`],F=`**/node_modules`,I=`**/dist`,L=[`**/package-lock.json`,`**/yarn.lock`,`**/pnpm-lock.yaml`,`**/bun.lockb`],R=[F,I,...L,`**/output`,`**/coverage`,`**/temp`,`**/.temp`,`**/tmp`,`**/.tmp`,`**/.history`,`**/.nuxt`,`**/.next`,`**/.vercel`,`**/.changeset`,`**/.idea`,`**/.cache`,`**/.output`,`**/.vite-inspect`,`**/.yarn`,`**/vite.config.*.timestamp-*`,`**/CHANGELOG*.md`,`**/*.min.*`,`**/LICENSE*`,`**/__snapshots__`,`**/auto-import?(s).d.ts`,`**/components.d.ts`],se=ne(new URL(`.`,import.meta.url)),ce=t(`@nicksp/eslint-config`);function z(e){return t(e,{paths:[se]})}async function B(e){if(b.env.CI!=null||b.stdout.isTTY===!1||ce===!1)return;let t=e.filter(e=>typeof e==`string`&&!z(e));t.length!==0&&await(await import(`@clack/prompts`)).confirm({message:`${t.length===1?`Package is`:`Packages are`} required for this config: ${t.join(`, `)}. Do you want to install them?`})===!0&&await import(`@antfu/install-pkg`).then(async e=>e.installPackage(t,{dev:!0}))}async function V(e){let t=await e;return t.default??t}function H(){return b.env.CI!=null||U()?!1:b.env.VSCODE_PID!=null||b.env.VSCODE_CWD!=null||b.env.JETBRAINS_IDE!=null||b.env.VIM!=null||b.env.NVIM!=null}function U(){return!!(b.env.GIT_PARAMS!=null||b.env.VSCODE_GIT_COMMAND!=null||b.env.npm_lifecycle_script?.startsWith(`lint-staged`))}function W(e,t){return typeof e[t]==`boolean`?{}:e[t]??{}}function G(e,t){let n=W(e,t);return{...typeof n==`object`&&`overrides`in n?n.overrides:{}}}async function K(e={}){let{files:t=[j],overrides:r={}}=e,[i,a]=await Promise.all([V(import(`astro-eslint-parser`)),V(import(`eslint-plugin-astro`))]);return[{name:`nicksp/astro/setup`,plugins:{astro:a}},{files:t,languageOptions:{globals:a.environments.astro.globals,parser:i,parserOptions:{extraFileExtensions:[`.astro`]},sourceType:`module`},name:`nicksp/astro/rules`,processor:`astro/client-side-ts`,rules:{"antfu/no-top-level-await":`off`,"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-unused-define-vars-in-style":`error`,"astro/valid-compile":`error`,...r}},{files:[M],languageOptions:{globals:{...n.browser},sourceType:`module`},name:`nicksp/astro/script/javascript`,rules:{"prettier/prettier":`off`}},{files:[N],languageOptions:{globals:{...n.browser},parser:y.parser,parserOptions:{project:null},sourceType:`module`},name:`nicksp/astro/script/typescript`,rules:{"prettier/prettier":`off`}},{files:[j,N],name:`nicksp/astro/disables`,rules:{"react-dom/no-unknown-property":`off`}}]}function q(){return[{...r.recommended,name:`nicksp/comments/recommended`},{name:`nicksp/comments/rules`,rules:{"@eslint-community/eslint-comments/disable-enable-pair":[`error`,{allowWholeFile:!0}]}}]}function J(){return[{files:[`**/scripts/${C}`],name:`nicksp/disables/scripts`,rules:{"@typescript-eslint/explicit-function-return-type":`off`,"antfu/no-top-level-await":`off`,"no-console":`off`}},{files:[`**/bin/**/*`,`**/bin.${S}`],name:`nicksp/disables/bin`,rules:{"antfu/no-import-dist":`off`,"antfu/no-import-node-modules-by-path":`off`}},{files:[`**/*.d.?([cm])ts`],name:`nicksp/disables/dts`,rules:{"@eslint-community/eslint-comments/no-unlimited-disable":`off`,"no-restricted-syntax":`off`,"unused-imports/no-unused-vars":`off`}},{files:P,name:`nicksp/disables/tests`,rules:{"@typescript-eslint/explicit-function-return-type":`off`,"antfu/no-top-level-await":`off`,"no-unused-expressions":`off`,"node/prefer-global/process":`off`,"unicorn/consistent-function-scoping":`off`}},{files:[`**/*.js`,`**/*.cjs`],name:`nicksp/disables/cjs`,rules:{"@typescript-eslint/no-require-imports":`off`}},{files:[`**/*.config.${S}`,`**/*.config.*.${S}`],name:`nicksp/disables/config-files`,rules:{"@typescript-eslint/explicit-function-return-type":`off`,"antfu/no-top-level-await":`off`,"no-console":`off`}}]}function Y(e=[]){return[{ignores:[...R,...e],name:`nicksp/ignores/global`},{...o({strict:!1}),name:`nicksp/ignores/gitignore`}]}function X(){return[{name:`nicksp/imports/rules`,plugins:{antfu:s,import:u},rules:{"antfu/import-dedupe":`error`,"antfu/no-import-dist":`error`,"antfu/no-import-node-modules-by-path":`error`,"import/first":`error`,"import/no-duplicates":`error`,"import/no-mutable-exports":`error`,"import/no-named-default":`error`}}]}const Z=[x.ForInStatement,x.LabeledStatement,x.TSExportAssignment];function le(e={}){let{isInEditor:t=!1,overrides:r={}}=e;return[{...i.configs.recommended,name:`nicksp/javascript/recommended`},{languageOptions:{ecmaVersion:`latest`,globals:{...n.browser,...n.es2026,...n.node,document:`readonly`,navigator:`readonly`,window:`readonly`},parserOptions:{ecmaFeatures:{jsx:!0},ecmaVersion:`latest`,sourceType:`module`},sourceType:`module`},linterOptions:{reportUnusedDisableDirectives:!0},name:`nicksp/javascript/setup`},{name:`nicksp/javascript/rules`,plugins:{antfu:s,"de-morgan":c,"unused-imports":g},rules:{"accessor-pairs":[`error`,{enforceForClassMembers:!0,setWithoutGet:!0}],"antfu/no-top-level-await":`error`,"array-callback-return":`error`,"block-scoped-var":`error`,"default-case-last":`error`,"dot-notation":t?`warn`:`error`,eqeqeq:[`error`,`smart`],"new-cap":[`error`,{capIsNew:!1,newIsCap:!0,properties:!0}],"no-alert":t?`warn`:`error`,"no-array-constructor":`error`,"no-caller":`error`,"no-cond-assign":[`error`,`always`],"no-console":[t?`warn`:`error`,{allow:[`warn`,`error`]}],"no-debugger":t?`warn`:`error`,"no-duplicate-imports":`error`,"no-empty":[`error`,{allowEmptyCatch:!0}],"no-eval":`error`,"no-extend-native":`error`,"no-extra-bind":`error`,"no-implied-eval":`error`,"no-inner-declarations":`error`,"no-iterator":`error`,"no-labels":[`error`,{allowLoop:!1,allowSwitch:!1}],"no-lone-blocks":`error`,"no-lonely-if":`error`,"no-multi-str":`error`,"no-new":`error`,"no-new-func":`error`,"no-new-wrappers":`error`,"no-octal-escape":`error`,"no-proto":`error`,"no-restricted-globals":[`error`,{message:"Use `globalThis` instead.",name:`global`},{message:"Use `globalThis` instead.",name:`self`}],"no-restricted-properties":[`error`,{message:"Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",property:`__proto__`},{message:"Use `Object.defineProperty` instead.",property:`__defineGetter__`},{message:"Use `Object.defineProperty` instead.",property:`__defineSetter__`},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:`__lookupGetter__`},{message:"Use `Object.getOwnPropertyDescriptor` instead.",property:`__lookupSetter__`}],"no-restricted-syntax":[`error`,...Z,`TSEnumDeclaration[const=true]`],"no-self-compare":`error`,"no-sequences":`error`,"no-template-curly-in-string":`error`,"no-throw-literal":`error`,"no-undef-init":`error`,"no-unmodified-loop-condition":`error`,"no-unneeded-ternary":[`error`,{defaultAssignment:!1}],"no-unreachable-loop":`error`,"no-unused-expressions":[`error`,{allowShortCircuit:!0,allowTaggedTemplates:!0,allowTernary:!0}],"no-unused-vars":[`error`,{args:`none`,caughtErrors:`none`,ignoreRestSiblings:!0,vars:`all`}],"no-use-before-define":[`error`,{classes:!1,functions:!1,variables:!0}],"no-useless-call":`error`,"no-useless-computed-key":`error`,"no-useless-constructor":`error`,"no-useless-rename":`error`,"no-useless-return":`error`,"no-var":`error`,"no-void":`error`,"object-shorthand":[`error`,`always`,{avoidQuotes:!0,ignoreConstructors:!1}],"one-var":[`error`,{initialized:`never`}],"prefer-arrow-callback":[`error`,{allowNamedFunctions:!1,allowUnboundThis:!0}],"prefer-const":[t?`warn`:`error`,{destructuring:`all`,ignoreReadBeforeAssign:!0}],"prefer-exponentiation-operator":`error`,"prefer-promise-reject-errors":`error`,"prefer-regex-literals":[`error`,{disallowRedundantWrapping:!0}],"prefer-rest-params":`error`,"prefer-spread":`error`,"prefer-template":`error`,"symbol-description":`error`,"unicode-bom":[`error`,`never`],"unused-imports/no-unused-imports":t?`warn`:`error`,"unused-imports/no-unused-vars":[`error`,{args:`after-used`,argsIgnorePattern:`^_`,ignoreRestSiblings:!0,varsIgnorePattern:`^_`}],"use-isnan":[`error`,{enforceForIndexOf:!0,enforceForSwitchCase:!0}],"valid-typeof":[`error`,{requireStringLiterals:!0}],"vars-on-top":`error`,yoda:[`error`,`never`],...c.configs.recommended.rules,...r}}]}function ue(){return[{name:`nicksp/jsdoc/rules`,plugins:{jsdoc:d},rules:{"jsdoc/check-access":`warn`,"jsdoc/check-param-names":`warn`,"jsdoc/check-property-names":`warn`,"jsdoc/check-types":`warn`,"jsdoc/empty-tags":`warn`,"jsdoc/implements-on-classes":`warn`,"jsdoc/no-defaults":`warn`,"jsdoc/no-multi-asterisks":`warn`,"jsdoc/require-param-name":`warn`,"jsdoc/require-property":`warn`,"jsdoc/require-property-description":`warn`,"jsdoc/require-property-name":`warn`,"jsdoc/require-returns-check":`warn`,"jsdoc/require-returns-description":`warn`,"jsdoc/require-yields-check":`warn`,"jsdoc/type-formatting":[`warn`,{stringQuotes:`single`}]}}]}function de(){return[{name:`nicksp/jsonc/setup`,plugins:{jsonc:f}},{files:[O,k,ae],languageOptions:{parser:v},name:`nicksp/jsonc/rules`,rules:{...f.configs[`recommended-with-jsonc`].rules,"jsonc/no-octal-escape":`error`,"jsonc/quote-props":`off`,"jsonc/quotes":`off`}}]}async function fe(e={}){let{a11y:t}=e,n={files:[T,D],languageOptions:{parserOptions:{ecmaFeatures:{jsx:!0}}},name:`nicksp/jsx/setup`,plugins:{},rules:{}};if(t===!1||t===void 0)return[n];await B([`eslint-plugin-jsx-a11y`]);let r=await V(import(`eslint-plugin-jsx-a11y`)),i=r.flatConfigs.recommended,a={...i.rules,...typeof t==`object`&&t.overrides?t.overrides:{}};return[{...n,...i,files:n.files,languageOptions:{...n.languageOptions,...i.languageOptions},name:n.name,plugins:{...n.plugins,"jsx-a11y":r},rules:{...n.rules,...a}}]}async function pe(e={}){let{files:t=[C],overrides:n={}}=e;await B([`@next/eslint-plugin-next`]);let r=await V(import(`@next/eslint-plugin-next`));return[{name:`nicksp/nextjs/setup`,plugins:{"@next/next":r}},{files:t,languageOptions:{parserOptions:{ecmaFeatures:{jsx:!0}},sourceType:`module`},name:`nicksp/nextjs/rules`,rules:{...r.configs.recommended.rules,...r.configs[`core-web-vitals`].rules,...n},settings:{react:{version:`detect`}}}]}function me(){return[{name:`nicksp/node/rules`,plugins:{node:p},rules:{"node/handle-callback-err":[`error`,`^(err|error)$`],"node/hashbang":`error`,"node/no-deprecated-api":`error`,"node/no-exports-assign":`error`,"node/no-extraneous-import":`error`,"node/no-extraneous-require":`error`,"node/no-new-require":`error`,"node/no-path-concat":`error`,"node/no-process-env":[`error`,{allowedVariables:[`NODE_ENV`]}],"node/no-unpublished-bin":`error`,"node/no-unpublished-import":`error`,"node/no-unpublished-require":`error`,"node/no-unsupported-features/es-builtins":`error`,"node/no-unsupported-features/es-syntax":[`error`,{ignores:[`modules`]}],"node/prefer-global/buffer":[`error`,`never`],"node/prefer-global/process":[`error`,`never`],"node/process-exit-as-throw":`error`}}]}async function he(e={}){let{enableAstro:t=z(`prettier-plugin-astro`),options:n={}}=e;await B([`@nicksp/prettier-config`,t?`prettier-plugin-astro`:void 0]);let[r,i]=await Promise.all([V(import(`eslint-plugin-prettier`)),V(import(`eslint-plugin-prettier/recommended`))]),a={...await import(`@nicksp/prettier-config`),...n},o=[{name:`nicksp/prettier/setup`,plugins:{antfu:s,prettier:r}}];return t&&o.push({files:[j],name:`nicksp/prettier/astro`,rules:{"prettier/prettier":[`warn`,{...a,parser:`astro`,plugins:[`prettier-plugin-astro`]}]}}),o.push({name:`nicksp/prettier/rules`,rules:{...i.rules,"antfu/consistent-chaining":`error`,"antfu/consistent-list-newline":`error`,"antfu/top-level-function":`error`,curly:[`error`,`all`],"prettier/prettier":[`warn`,a]}}),o}const ge=[`vite`],_e=[`@react-router/node`,`@react-router/react`,`@react-router/serve`,`@react-router/dev`],ve=[`next`];async function ye(e={}){let{files:n=[C],filesTypeAware:r=[E,D],ignoresTypeAware:i=[`${A}/**`,N],overrides:a={},typeAware:o}=e;await B([`@eslint-react/eslint-plugin`,`eslint-plugin-react-hooks`,`eslint-plugin-react-refresh`]);let[s,c,l]=await Promise.all([V(import(`@eslint-react/eslint-plugin`)),V(import(`eslint-plugin-react-hooks`)),V(import(`eslint-plugin-react-refresh`))]),u={"react-x/no-leaked-conditional-rendering":`warn`},d=ge.some(e=>t(e)),f=_e.some(e=>t(e)),p=ve.some(e=>t(e)),m=s.configs.all.plugins;return[{name:`nicksp/react/setup`,plugins:{"react-dom":m[`@eslint-react/dom`],"react-hooks":c,"react-hooks-extra":m[`@eslint-react/hooks-extra`],"react-naming-convention":m[`@eslint-react/naming-convention`],"react-refresh":l,"react-web-api":m[`@eslint-react/web-api`],"react-x":m[`@eslint-react`]}},{files:n,languageOptions:{parserOptions:{ecmaFeatures:{jsx:!0}},sourceType:`module`},name:`nicksp/react/rules`,rules:{...m[`@eslint-react`].configs.recommended.rules,...m[`@eslint-react/dom`].configs.recommended.rules,...c.configs.recommended.rules,...m[`@eslint-react/hooks-extra`].configs.recommended.rules,...m[`@eslint-react/naming-convention`].configs.recommended.rules,...m[`@eslint-react/web-api`].configs.recommended.rules,"react-refresh/only-export-components":[`error`,{allowConstantExport:d,allowExportNames:[...p?[`experimental_ppr`,`dynamic`,`dynamicParams`,`revalidate`,`fetchCache`,`runtime`,`preferredRegion`,`maxDuration`,`viewport`]:[],...f?[`action`,`headers`,`links`,`loader`,`meta`,`clientLoader`,`clientAction`,`handle`,`shouldRevalidate`]:[]]}],...a}},...o?[{files:r,ignores:i,name:`nicksp/react/type-aware-rules`,rules:{...u}}]:[]]}function be(e={}){let t=re[`flat/recommended`],n={...t.rules};if(e.level===`warn`)for(let[e,t]of Object.entries(n))t===`error`&&(n[e]=`warn`);return[{...t,name:`nicksp/regexp/rules`,rules:{...n,...e.overrides}}]}function xe(){return[{files:[`**/package.json`],name:`nicksp/sort/package-json`,rules:{"jsonc/sort-array-values":[`error`,{order:{type:`asc`},pathPattern:`^files$`}],"jsonc/sort-keys":[`error`,{order:`publisher.name.displayName.description.version.type.private.packageManager.author.contributors.license.funding.homepage.repository.bugs.keywords.categories.sideEffects.main.imports.exports.module.types.unpkg.jsdelivr.typesVersions.bin.icon.files.engines.activationEvents.contributes.directories.publishConfig.scripts.peerDependencies.peerDependenciesMeta.optionalDependencies.dependencies.devDependencies.pnpm.overrides.resolutions.browserslist.husky.simple-git-hooks.lint-staged.eslintConfig.prettier.tsdown`.split(`.`),pathPattern:`^$`},{order:{type:`asc`},pathPattern:`^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$`},{order:{type:`asc`},pathPattern:`^(?:resolutions|overrides|pnpm.overrides)$`},{order:{type:`asc`},pathPattern:String.raw`^workspaces\.catalog$`},{order:{type:`asc`},pathPattern:String.raw`^workspaces\.catalogs\.[^.]+$`},{order:[`types`,`require`,`import`,`default`],pathPattern:`^exports.*$`},{order:[`pre-commit`,`prepare-commit-msg`,`commit-msg`,`post-commit`,`pre-rebase`,`post-rewrite`,`post-checkout`,`post-merge`,`pre-push`,`pre-auto-gc`],pathPattern:`^(?:gitHooks|husky|simple-git-hooks)$`}]}}]}function Se(){return[{files:[`**/[jt]sconfig.json`,`**/[jt]sconfig.*.json`],name:`nicksp/sort/tsconfig`,rules:{"jsonc/sort-keys":[`error`,{order:[`extends`,`compilerOptions`,`references`,`files`,`include`,`exclude`],pathPattern:`^$`},{order:`incremental.composite.tsBuildInfoFile.disableSourceOfProjectReferenceRedirect.disableSolutionSearching.disableReferencedProjectLoad.target.jsx.jsxFactory.jsxFragmentFactory.jsxImportSource.lib.moduleDetection.noLib.reactNamespace.useDefineForClassFields.emitDecoratorMetadata.experimentalDecorators.libReplacement.baseUrl.rootDir.rootDirs.customConditions.module.moduleResolution.moduleSuffixes.noResolve.paths.resolveJsonModule.resolvePackageJsonExports.resolvePackageJsonImports.typeRoots.types.allowArbitraryExtensions.allowImportingTsExtensions.allowUmdGlobalAccess.allowJs.checkJs.maxNodeModuleJsDepth.strict.strictBindCallApply.strictFunctionTypes.strictNullChecks.strictPropertyInitialization.allowUnreachableCode.allowUnusedLabels.alwaysStrict.exactOptionalPropertyTypes.noFallthroughCasesInSwitch.noImplicitAny.noImplicitOverride.noImplicitReturns.noImplicitThis.noPropertyAccessFromIndexSignature.noUncheckedIndexedAccess.noUnusedLocals.noUnusedParameters.useUnknownInCatchVariables.declaration.declarationDir.declarationMap.downlevelIteration.emitBOM.emitDeclarationOnly.importHelpers.importsNotUsedAsValues.inlineSourceMap.inlineSources.mapRoot.newLine.noEmit.noEmitHelpers.noEmitOnError.outDir.outFile.preserveConstEnums.preserveValueImports.removeComments.sourceMap.sourceRoot.stripInternal.allowSyntheticDefaultImports.erasableSyntaxOnly.esModuleInterop.forceConsistentCasingInFileNames.isolatedDeclarations.isolatedModules.preserveSymlinks.verbatimModuleSyntax.skipDefaultLibCheck.skipLibCheck`.split(`.`),pathPattern:`^compilerOptions$`}]}}]}function Ce(){return[{name:`nicksp/sort/imports`,plugins:{perfectionist:h},rules:{"perfectionist/sort-exports":[`error`,{type:`natural`}],"perfectionist/sort-imports":[`error`,{customGroups:[{elementNamePattern:[`^react$`,`^react-.+`],groupName:`react`,selector:`type`},{elementNamePattern:[`^next$`,`^next[/-].+`],groupName:`next`,selector:`type`},{elementNamePattern:[`^react$`,`^react-.+`],groupName:`react`},{elementNamePattern:[`^next$`,`^next[/-].+`],groupName:`next`}],groups:[`react`,`next`,{newlinesBetween:1},`builtin`,`external`,{newlinesBetween:1},`internal`,[`parent`,`sibling`,`index`],{newlinesBetween:1},`type`,[`internal-type`,`parent-type`,`sibling-type`,`index-type`],{newlinesBetween:1},`side-effect`,`side-effect-style`,`style`,`unknown`],newlinesBetween:`never`,type:`natural`}],"perfectionist/sort-named-exports":[`error`,{type:`natural`}],"perfectionist/sort-named-imports":[`error`,{type:`natural`}]}}]}let Q;function $(e={}){let{files:t=P,isInEditor:n=!1,overrides:r={}}=e;return Q=!!Q||{...a,rules:{...a.rules,...m.rules}},[{name:`nicksp/test/setup`,plugins:{test:Q}},{files:t,name:`nicksp/test/rules`,rules:{"test/consistent-test-filename":[`error`,{pattern:String.raw`.*\.test\.[tj]sx?$`}],"test/consistent-test-it":[`error`,{fn:`it`,withinDescribe:`it`}],"test/consistent-vitest-vi":`error`,"test/no-focused-tests":n?`warn`:`error`,"test/no-identical-title":`error`,"test/no-import-node-test":`error`,"test/padding-around-after-all-blocks":n?`warn`:`error`,"test/padding-around-after-each-blocks":n?`warn`:`error`,"test/padding-around-before-all-blocks":n?`warn`:`error`,"test/padding-around-before-each-blocks":n?`warn`:`error`,"test/padding-around-describe-blocks":n?`warn`:`error`,"test/padding-around-test-blocks":n?`warn`:`error`,"test/prefer-hooks-in-order":`error`,"test/prefer-lowercase-title":[`error`,{ignore:[`describe`]}],...r}}]}function we(e){let t={};for(let n of e)n.rules&&Object.assign(t,n.rules);return t}const Te=ie(y.configs.strict,y.configs.stylistic),Ee=we(Te),De=ie(y.configs.strictTypeChecked,y.configs.stylisticTypeChecked),Oe=we(De);function ke(e={}){let{overrides:t={},overridesTypeAware:n={},type:r=`app`,typeAware:i}=e,a=e.files??[E,D],o=e.filesTypeAware??[E,D],s=e.ignoresTypeAware??[`${A}/**`,N],c={"@typescript-eslint/consistent-type-exports":[`error`,{fixMixedExportsWithInlineTypeSpecifier:!0}],"@typescript-eslint/promise-function-async":`error`,"@typescript-eslint/restrict-plus-operands":`error`,"@typescript-eslint/restrict-template-expressions":`error`,"@typescript-eslint/return-await":[`error`,`in-try-catch`],"@typescript-eslint/strict-boolean-expressions":[`error`,{allowNullableBoolean:!0,allowNullableObject:!0}],"@typescript-eslint/switch-exhaustiveness-check":`error`};function u(e,t,n){return{files:t,...n?{ignores:n}:{},languageOptions:{parser:y.parser,parserOptions:{sourceType:`module`,...e?{projectService:{allowDefaultProject:[`*.js`]},tsconfigRootDir:b.cwd()}:{}},sourceType:`module`},name:`nicksp/typescript/${e?`type-aware-parser`:`parser`}`}}return[{name:`nicksp/typescript/setup`,plugins:{"@typescript-eslint":y.plugin,"erasable-syntax-only":l}},...i?[u(!0,o,s)]:[u(!1,a)],{files:a,name:`nicksp/typescript/recommended`,rules:{...i?Oe:Ee}},{files:a,name:`nicksp/typescript/rules`,rules:{"@typescript-eslint/ban-ts-comment":[`error`,{"ts-expect-error":`allow-with-description`}],"@typescript-eslint/consistent-type-assertions":[`error`,{objectLiteralTypeAssertions:`allow-as-parameter`}],"@typescript-eslint/consistent-type-imports":[`error`,{disallowTypeAnnotations:!1,fixStyle:`inline-type-imports`}],"@typescript-eslint/method-signature-style":[`error`,`property`],"@typescript-eslint/no-dupe-class-members":`error`,"@typescript-eslint/no-dynamic-delete":`off`,"@typescript-eslint/no-empty-object-type":[`error`,{allowInterfaces:`with-single-extends`}],"@typescript-eslint/no-explicit-any":`off`,"@typescript-eslint/no-extraneous-class":`off`,"@typescript-eslint/no-import-type-side-effects":`error`,"@typescript-eslint/no-invalid-void-type":`off`,"@typescript-eslint/no-redeclare":`error`,"@typescript-eslint/no-unnecessary-boolean-literal-compare":`off`,"@typescript-eslint/no-unnecessary-parameter-property-assignment":`error`,"@typescript-eslint/no-unsafe-function-type":`off`,"@typescript-eslint/no-unused-expressions":[`error`,{allowShortCircuit:!0,allowTaggedTemplates:!0,allowTernary:!0}],"@typescript-eslint/no-unused-vars":`off`,"@typescript-eslint/no-use-before-define":[`error`,{classes:!1,functions:!1,variables:!0}],"@typescript-eslint/no-useless-constructor":`error`,"@typescript-eslint/no-useless-empty-export":`error`,"@typescript-eslint/prefer-as-const":`warn`,"@typescript-eslint/prefer-literal-enum-member":[`error`,{allowBitwiseExpressions:!0}],"no-dupe-class-members":`off`,"no-redeclare":`off`,"no-restricted-syntax":[`error`,...Z,`TSEnumDeclaration[const=true]`],"no-use-before-define":`off`,"no-useless-constructor":`off`,...l.configs.recommended.rules,...r===`lib`?{"@typescript-eslint/explicit-function-return-type":[`error`,{allowExpressions:!0,allowHigherOrderFunctions:!0,allowIIFEs:!0}]}:{},...t}},...i?[{files:o,ignores:s,name:`nicksp/typescript/type-aware-rules`,rules:{...c,...n}}]:[],{files:[`**/*.d.ts`],name:`nicksp/typescript/dts-rules`,rules:{"eslint-comments/no-unlimited-disable":`off`,"import/no-duplicates":`off`,"no-restricted-syntax":`off`,"unused-imports/no-unused-vars":`off`}},{files:[w,`**/*.cjs`],name:`nicksp/typescript/cjs-rules`,rules:{"@typescript-eslint/no-require-imports":`off`}}]}const Ae=[String.raw`README\.md$`,String.raw`CODE_OF_CONDUCT\.md$`,String.raw`CONTRIBUTING\.md$`,String.raw`FUNDING\.yml$`,String.raw`GOVERNANCE\.md$`,String.raw`SECURITY\.md$`,String.raw`SUPPORT\.md$`,String.raw`CHANGELOG.*\.md$`,`LICENSE.*$`];function je(e={}){let{overrides:t={}}=e;return[{...ee.configs.unopinionated,name:`nicksp/unicorn/unopinionated`},{name:`nicksp/unicorn/rules`,rules:{"unicorn/consistent-empty-array-spread":`error`,"unicorn/consistent-function-scoping":[`error`,{checkArrowFunctions:!1}],"unicorn/custom-error-definition":`error`,"unicorn/filename-case":[`error`,{cases:{kebabCase:!0,pascalCase:!0},ignore:[...Ae]}],"unicorn/import-style":[`warn`,{styles:{chalk:{default:!0},"node:child_process":{named:!0},"node:fs":{named:!0},"node:fs/promises":{named:!0},"node:os":{default:!0},"node:path":{default:!0},"node:readline":{default:!0},"node:util":{named:!0}}}],"unicorn/no-for-loop":`error`,"unicorn/no-immediate-mutation":`error`,"unicorn/no-process-exit":`off`,"unicorn/no-useless-undefined":[`error`,{checkArguments:!1,checkArrowFunctionBody:!1}],"unicorn/prefer-global-this":`off`,"unicorn/prefer-query-selector":`error`,"unicorn/prefer-set-has":`off`,"unicorn/prefer-ternary":`off`,"unicorn/prefer-top-level-await":`off`,"unicorn/require-module-specifiers":`off`,...t}}]}function Me(e={}){let{files:t=[oe],overrides:n={}}=e;return[{name:`nicksp/yaml/setup`,plugins:{yml:_}},{files:t,languageOptions:{parser:te},name:`nicksp/yaml/rules`,rules:{..._.configs.standard.rules,..._.configs.prettier.rules,...n}},{files:[`pnpm-workspace.yaml`],name:`nicksp/yaml/pnpm-workspace`,rules:{"yml/sort-keys":[`error`,{order:[`packages`,`overrides`,`patchedDependencies`,`hoistPattern`,`catalog`,`catalogs`,`allowedDeprecatedVersions`,`allowNonAppliedPatches`,`configDependencies`,`ignoredBuiltDependencies`,`ignoredOptionalDependencies`,`neverBuiltDependencies`,`onlyBuiltDependencies`,`onlyBuiltDependenciesFile`,`packageExtensions`,`peerDependencyRules`,`supportedArchitectures`],pathPattern:`^$`},{order:{type:`asc`},pathPattern:`.*`}]}}]}function Ne(n={},...r){let{astro:i=!1,jsx:a=!0,nextjs:o=!1,prettier:s=!0,react:c=!1,regexp:l=!0,test:u=!0,type:d=`app`,typescript:f=t(`typescript`),yaml:p=!0}=n,m=H();m&&console.log(`[@nicksp/eslint-config] Detected running in editor, some rules are disabled.`);let h=[],ee=typeof s==`object`?s.options:{},g=W(n,`typescript`),_=g.typeAware??!0;if(h.push(Y(n.ignores),le({isInEditor:m,overrides:G(n,`javascript`)}),je(),q(),me(),ue(),X(),Ce()),a!==!1&&h.push(fe(a===!0?{}:a)),f!==!1&&h.push(ke({...g,overrides:G(n,`typescript`),type:d,typeAware:_})),s!==!1&&h.push(he({enableAstro:!!i,options:ee})),l!==!1&&h.push(be(typeof l==`boolean`?{}:l)),u!==!1&&h.push($({isInEditor:m,overrides:G(n,`test`)})),c!==!1&&h.push(ye({...g,overrides:G(n,`react`),typeAware:_})),o!==!1&&h.push(pe({overrides:G(n,`nextjs`)})),i!==!1&&h.push(K({overrides:G(n,`astro`)})),h.push(de(),xe(),Se()),p!==!1&&h.push(Me({overrides:G(n,`yaml`)})),h.push(J()),`files`in n)throw Error(`[@nicksp/eslint-config] The first argument should not contain the "files" property as the options are supposed to be global. Place it in the second or later config instead.`);let v=new e(...h,...r);return m&&(v=v.disableRulesFix([`unused-imports/no-unused-imports`,`test/no-only-tests`,`prefer-const`],{builtinRules:async()=>import([`eslint`,`use-at-your-own-risk`].join(`/`)).then(e=>e.builtinRules)})),v}var Pe=Ne;export{j as GLOB_ASTRO,M as GLOB_ASTRO_JS,N as GLOB_ASTRO_TS,I as GLOB_DIST,R as GLOB_EXCLUDE,w as GLOB_JS,O as GLOB_JSON,k as GLOB_JSON5,ae as GLOB_JSONC,T as GLOB_JSX,L as GLOB_LOCKFILE,A as GLOB_MARKDOWN,F as GLOB_NODE_MODULES,C as GLOB_SRC,S as GLOB_SRC_EXT,P as GLOB_TESTS,E as GLOB_TS,D as GLOB_TSX,oe as GLOB_YAML,K as astro,q as comments,Pe as default,Ne as defineConfig,J as disables,B as ensurePackages,G as getOverrides,Y as ignores,X as imports,V as interopDefault,H as isInEditorEnv,U as isInGitHooksOrLintStaged,z as isPackageInScope,le as javascript,ue as jsdoc,de as jsonc,fe as jsx,pe as nextjs,me as node,he as prettier,ye as react,be as regexp,W as resolveSubOptions,Z as restrictedSyntaxJs,Ce as sortImports,xe as sortPackageJson,Se as sortTsconfig,$ as test,ke as typescript,Te as typescriptRecommended,De as typescriptTypeCheckedRecommended,je as unicorn,Me as yaml};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nicksp/eslint-config",
3
3
  "description": "Nick's ESLint config",
4
- "version": "1.4.0",
4
+ "version": "1.5.0",
5
5
  "type": "module",
6
6
  "author": {
7
7
  "name": "Nick Plekhanov",
@@ -33,7 +33,7 @@
33
33
  "dist"
34
34
  ],
35
35
  "engines": {
36
- "node": ">=22"
36
+ "node": ">=24"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@eslint-react/eslint-plugin": "^2.2.4",
@@ -132,7 +132,7 @@
132
132
  "tsx": "^4.20.6",
133
133
  "typescript": "^5.9.3",
134
134
  "vitest": "^4.0.5",
135
- "@nicksp/eslint-config": "1.4.0"
135
+ "@nicksp/eslint-config": "1.5.0"
136
136
  },
137
137
  "simple-git-hooks": {
138
138
  "pre-commit": "npx lint-staged"