@nicksp/eslint-config 1.3.0 → 1.4.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.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";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 g from"eslint-plugin-unicorn";import _ from"eslint-plugin-unused-imports";import v from"eslint-plugin-yml";import ee 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`,A=`**/*.jsonc`,j=`**/*.y?(a)ml`,M=`**/*.astro`,N=`**/*.astro/*.js`,P=`**/*.astro/*.ts`,F=[`**/__tests__/**/*.${S}`,`**/*.spec.${S}`,`**/*.test.${S}`,`**/*.bench.${S}`,`**/*.benchmark.${S}`],I=`**/node_modules`,L=`**/dist`,R=[`**/package-lock.json`,`**/yarn.lock`,`**/pnpm-lock.yaml`,`**/bun.lockb`],z=[I,L,...R,`**/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`],ae=ne(new URL(`.`,import.meta.url)),oe=t(`@nicksp/eslint-config`);function B(e){return t(e,{paths:[ae]})}async function V(e){if(b.env.CI||b.stdout.isTTY===!1||oe===!1)return;let t=e.filter(e=>e&&!B(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?`})&&await import(`@antfu/install-pkg`).then(e=>e.installPackage(t,{dev:!0}))}async function H(e){let t=await e;return t.default||t}function U(){return b.env.CI||W()?!1:!!(b.env.VSCODE_PID||b.env.VSCODE_CWD||b.env.JETBRAINS_IDE||b.env.VIM||b.env.NVIM)}function W(){return!!(b.env.GIT_PARAMS||b.env.VSCODE_GIT_COMMAND||b.env.npm_lifecycle_script?.startsWith(`lint-staged`))}function G(e,t){return typeof e[t]==`boolean`?{}:e[t]||{}}function K(e,t){let n=G(e,t);return{...`overrides`in n?n.overrides:{}}}async function q(e={}){let{files:t=[M],overrides:r={}}=e,[i,a]=await Promise.all([H(import(`astro-eslint-parser`)),H(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:[N],languageOptions:{globals:{...n.browser},sourceType:`module`},name:`nicksp/astro/script/javascript`,rules:{"prettier/prettier":`off`}},{files:[P],languageOptions:{globals:{...n.browser},parser:y.parser,parserOptions:{project:null},sourceType:`module`},name:`nicksp/astro/script/typescript`,rules:{"prettier/prettier":`off`}},{files:[M,P],name:`nicksp/astro/disables`,rules:{"react-dom/no-unknown-property":`off`}}]}async function J(){return[{name:`nicksp/comments/recommended`,plugins:{"@eslint-community/eslint-comments":r},rules:{...r.configs.recommended.rules}},{name:`nicksp/comments/rules`,rules:{"@eslint-community/eslint-comments/disable-enable-pair":[`error`,{allowWholeFile:!0}]}}]}async function Y(){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:F,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`}}]}async function se(e=[]){return[{ignores:[...z,...e],name:`nicksp/ignores/global`},{...o({strict:!1}),name:`nicksp/ignores/gitignore`}]}async 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];async function Q(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":_},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}}]}async function $(){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`}]}}]}async function ce(){return[{name:`nicksp/jsonc/setup`,plugins:{jsonc:f}},{files:[O,k,A],languageOptions:{parser:ee},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 le(e={}){let{a11y:t}=e,n={files:[T,D],languageOptions:{parserOptions:{ecmaFeatures:{jsx:!0}}},name:`nicksp/jsx/setup`,plugins:{},rules:{}};if(!t)return[n];await V([`eslint-plugin-jsx-a11y`]);let r=await H(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 ue(e={}){let{files:t=[C],overrides:n={}}=e;await V([`@next/eslint-plugin-next`]);let r=await H(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`}}}]}async function de(){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/no-unsupported-features/node-builtins":[`error`,{allowExperimental:!0}],"node/prefer-global/buffer":[`error`,`never`],"node/prefer-global/process":[`error`,`never`],"node/process-exit-as-throw":`error`}}]}async function fe(e={}){let{enableAstro:t=B(`prettier-plugin-astro`),options:n={}}=e;await V([`@nicksp/prettier-config`,t?`prettier-plugin-astro`:void 0]);let[r,i]=await Promise.all([H(import(`eslint-plugin-prettier`)),H(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:[M],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 pe=[`vite`],me=[`@react-router/node`,`@react-router/react`,`@react-router/serve`,`@react-router/dev`],he=[`next`];async function ge(e={}){let{files:n=[C],overrides:r={}}=e;await V([`@eslint-react/eslint-plugin`,`eslint-plugin-react-hooks`,`eslint-plugin-react-refresh`]);let[i,a,o]=await Promise.all([H(import(`@eslint-react/eslint-plugin`)),H(import(`eslint-plugin-react-hooks`)),H(import(`eslint-plugin-react-refresh`))]),s=pe.some(e=>t(e)),c=me.some(e=>t(e)),l=he.some(e=>t(e)),u=i.configs.all.plugins;return[{name:`nicksp/react/setup`,plugins:{"react-dom":u[`@eslint-react/dom`],"react-hooks":a,"react-hooks-extra":u[`@eslint-react/hooks-extra`],"react-naming-convention":u[`@eslint-react/naming-convention`],"react-refresh":o,"react-web-api":u[`@eslint-react/web-api`],"react-x":u[`@eslint-react`]}},{files:n,languageOptions:{parserOptions:{ecmaFeatures:{jsx:!0}},sourceType:`module`},name:`nicksp/react/rules`,rules:{...u[`@eslint-react`].configs.recommended.rules,...u[`@eslint-react/dom`].configs.recommended.rules,...a.configs.recommended.rules,...u[`@eslint-react/hooks-extra`].configs.recommended.rules,...u[`@eslint-react/naming-convention`].configs.recommended.rules,...u[`@eslint-react/web-api`].configs.recommended.rules,"react-refresh/only-export-components":[`error`,{allowConstantExport:s,allowExportNames:[...l?[`experimental_ppr`,`dynamic`,`dynamicParams`,`revalidate`,`fetchCache`,`runtime`,`preferredRegion`,`maxDuration`,`viewport`]:[],...c?[`action`,`headers`,`links`,`loader`,`meta`,`clientLoader`,`clientAction`,`handle`,`shouldRevalidate`]:[]]}],...r}}]}async function _e(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}}]}async function ve(){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 ye(){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 be(){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 xe;async function Se(e={}){let{files:t=F,isInEditor:n=!1,overrides:r={}}=e;return xe||={...a,rules:{...a.rules,...m.rules}},[{name:`nicksp/test/setup`,plugins:{test:xe}},{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 Ce(e){let t={};for(let n of e)n.rules&&Object.assign(t,n.rules);return t}const we=ie(y.configs.strict,y.configs.stylistic);async function Te(e={}){let{overrides:t={},type:n=`app`}=e,r=e.files??[E,D],i=Ce(we);return[{languageOptions:{parser:y.parser},name:`nicksp/typescript/setup`,plugins:{"@typescript-eslint":y.plugin,"erasable-syntax-only":l}},{files:r,name:`nicksp/typescript/recommended`,rules:{...i}},{files:r,name:`nicksp/typescript/rules`,rules:{"@typescript-eslint/ban-ts-comment":[`error`,{"ts-expect-error":`allow-with-description`}],"@typescript-eslint/consistent-type-assertions":[`error`,{assertionStyle:`as`,objectLiteralTypeAssertions:`allow-as-parameter`}],"@typescript-eslint/consistent-type-definitions":[`error`,`type`],"@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-non-null-assertion":`off`,"@typescript-eslint/no-redeclare":`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,...n===`lib`?{"@typescript-eslint/explicit-function-return-type":[`error`,{allowExpressions:!0,allowHigherOrderFunctions:!0,allowIIFEs:!0}]}:{},...t}},{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 Ee=[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.*$`];async function De(e={}){let{overrides:t={}}=e;return[{...g.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:[...Ee]}],"unicorn/import-style":`off`,"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}}]}async function Oe(e={}){let{files:t=[j],overrides:n={}}=e;return[{name:`nicksp/yaml/setup`,plugins:{yml:v}},{files:t,languageOptions:{parser:te},name:`nicksp/yaml/rules`,rules:{...v.configs.standard.rules,...v.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 ke(n={},...r){let{astro:i=!1,jsx:a=!0,nextjs:o=!1,prettier:s=!0,react:c=!1,regexp:l=!0,type:u=`app`,typescript:d=t(`typescript`),yaml:f=!0}=n,p=U();p&&console.log(`[@nicksp/eslint-config] Detected running in editor, some rules are disabled.`);let m=[],h=typeof s==`object`?s.options:{},g=G(n,`typescript`);if(m.push(se(n.ignores),Q({isInEditor:p,overrides:K(n,`javascript`)}),De(),J(),de(),$(),X(),be()),a&&m.push(le(a===!0?{}:a)),d&&m.push(Te({...g,overrides:K(n,`typescript`),type:u})),s&&m.push(fe({enableAstro:!!i,options:h})),l&&m.push(_e(typeof l==`boolean`?{}:l)),(n.test??!0)&&m.push(Se({isInEditor:p,overrides:K(n,`test`)})),c&&m.push(ge({...g,overrides:K(n,`react`)})),o&&m.push(ue({overrides:K(n,`nextjs`)})),i&&m.push(q({overrides:K(n,`astro`)})),m.push(ce(),ve(),ye()),f&&m.push(Oe({overrides:K(n,`yaml`)})),m.push(Y()),`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 _=new e;return _=_.append(...m,...r),p&&(_=_.disableRulesFix([`unused-imports/no-unused-imports`,`test/no-only-tests`,`prefer-const`],{builtinRules:()=>import([`eslint`,`use-at-your-own-risk`].join(`/`)).then(e=>e.builtinRules)})),_}var Ae=ke;export{M as GLOB_ASTRO,N as GLOB_ASTRO_JS,P as GLOB_ASTRO_TS,L as GLOB_DIST,z as GLOB_EXCLUDE,w as GLOB_JS,O as GLOB_JSON,k as GLOB_JSON5,A as GLOB_JSONC,T as GLOB_JSX,R as GLOB_LOCKFILE,I as GLOB_NODE_MODULES,C as GLOB_SRC,S as GLOB_SRC_EXT,F as GLOB_TESTS,E as GLOB_TS,D as GLOB_TSX,j as GLOB_YAML,q as astro,J as comments,Ae as default,ke as defineConfig,Y as disables,V as ensurePackages,K as getOverrides,se as ignores,X as imports,H as interopDefault,U as isInEditorEnv,W as isInGitHooksOrLintStaged,B as isPackageInScope,Q as javascript,$ as jsdoc,ce as jsonc,le as jsx,ue as nextjs,de as node,fe as prettier,ge as react,_e as regexp,G as resolveSubOptions,Z as restrictedSyntaxJs,be as sortImports,ve as sortPackageJson,ye as sortTsconfig,Se as test,Te as typescript,we as typescriptRecommended,De as unicorn,Oe 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-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};
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.3.0",
4
+ "version": "1.4.0",
5
5
  "type": "module",
6
6
  "author": {
7
7
  "name": "Nick Plekhanov",
@@ -36,14 +36,14 @@
36
36
  "node": ">=22"
37
37
  },
38
38
  "peerDependencies": {
39
- "@eslint-react/eslint-plugin": "^2.2.3",
40
- "@next/eslint-plugin-next": "^15.5.6",
39
+ "@eslint-react/eslint-plugin": "^2.2.4",
40
+ "@next/eslint-plugin-next": "^16.0.1",
41
41
  "@nicksp/prettier-config": "^1.0.1",
42
42
  "astro-eslint-parser": "^1.2.2",
43
43
  "eslint": "^9.38.0",
44
- "eslint-plugin-astro": "^1.3.1",
44
+ "eslint-plugin-astro": "^1.4.0",
45
45
  "eslint-plugin-jsx-a11y": "^6.10.2",
46
- "eslint-plugin-react-hooks": "^7.0.0",
46
+ "eslint-plugin-react-hooks": "^7.0.1",
47
47
  "eslint-plugin-react-refresh": "^0.4.24",
48
48
  "prettier-plugin-astro": "^0.14.1"
49
49
  },
@@ -82,7 +82,7 @@
82
82
  "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
83
83
  "@eslint/js": "^9.38.0",
84
84
  "@typescript-eslint/utils": "^8.46.2",
85
- "@vitest/eslint-plugin": "^1.3.23",
85
+ "@vitest/eslint-plugin": "^1.3.26",
86
86
  "eslint-config-flat-gitignore": "^2.1.0",
87
87
  "eslint-config-prettier": "^10.1.8",
88
88
  "eslint-flat-config-utils": "^2.1.4",
@@ -90,14 +90,14 @@
90
90
  "eslint-plugin-de-morgan": "^2.0.0",
91
91
  "eslint-plugin-erasable-syntax-only": "^0.3.1",
92
92
  "eslint-plugin-import-lite": "^0.3.0",
93
- "eslint-plugin-jsdoc": "^61.1.5",
93
+ "eslint-plugin-jsdoc": "^61.1.11",
94
94
  "eslint-plugin-jsonc": "^2.21.0",
95
95
  "eslint-plugin-n": "^17.23.1",
96
96
  "eslint-plugin-no-only-tests": "^3.3.0",
97
97
  "eslint-plugin-perfectionist": "^4.15.1",
98
98
  "eslint-plugin-prettier": "^5.5.4",
99
99
  "eslint-plugin-regexp": "^2.10.0",
100
- "eslint-plugin-unicorn": "^61.0.2",
100
+ "eslint-plugin-unicorn": "^62.0.0",
101
101
  "eslint-plugin-unused-imports": "^4.3.0",
102
102
  "eslint-plugin-yml": "^1.19.0",
103
103
  "globals": "^16.4.0",
@@ -108,31 +108,31 @@
108
108
  "yaml-eslint-parser": "^1.3.0"
109
109
  },
110
110
  "devDependencies": {
111
- "@antfu/ni": "^27.0.0",
112
- "@eslint-react/eslint-plugin": "^2.2.3",
111
+ "@antfu/ni": "^27.0.1",
112
+ "@eslint-react/eslint-plugin": "^2.2.4",
113
113
  "@eslint/config-inspector": "^1.3.0",
114
- "@next/eslint-plugin-next": "^15.5.6",
114
+ "@next/eslint-plugin-next": "^16.0.1",
115
115
  "@nicksp/prettier-config": "^1.0.1",
116
116
  "@types/eslint-plugin-jsx-a11y": "^6.10.1",
117
- "@types/node": "^24.9.1",
117
+ "@types/node": "^24.9.2",
118
118
  "astro-eslint-parser": "^1.2.2",
119
119
  "eslint": "^9.38.0",
120
- "eslint-plugin-astro": "^1.3.1",
120
+ "eslint-plugin-astro": "^1.4.0",
121
121
  "eslint-plugin-jsx-a11y": "^6.10.2",
122
- "eslint-plugin-react-hooks": "^7.0.0",
122
+ "eslint-plugin-react-hooks": "^7.0.1",
123
123
  "eslint-plugin-react-refresh": "^0.4.24",
124
124
  "eslint-typegen": "^2.3.0",
125
125
  "execa": "^9.6.0",
126
126
  "jiti": "^2.6.1",
127
- "lint-staged": "^16.2.5",
127
+ "lint-staged": "^16.2.6",
128
128
  "prettier-plugin-astro": "^0.14.1",
129
129
  "simple-git-hooks": "^2.13.1",
130
130
  "tinyglobby": "^0.2.15",
131
- "tsdown": "^0.15.9",
131
+ "tsdown": "^0.15.12",
132
132
  "tsx": "^4.20.6",
133
133
  "typescript": "^5.9.3",
134
- "vitest": "^3.2.4",
135
- "@nicksp/eslint-config": "1.3.0"
134
+ "vitest": "^4.0.5",
135
+ "@nicksp/eslint-config": "1.4.0"
136
136
  },
137
137
  "simple-git-hooks": {
138
138
  "pre-commit": "npx lint-staged"