@2digits/eslint-config 4.3.0 → 4.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +149 -137
- package/dist/index.d.ts +149 -137
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +17 -10
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import ye from'eslint-plugin-antfu';import q from'eslint-plugin-de-morgan';import be from'@eslint-community/eslint-plugin-eslint-comments';import Oe from'@eslint-community/eslint-plugin-eslint-comments/configs';import {renamePluginsInRules,composer,renamePluginsInConfigs,FlatConfigComposer}from'eslint-flat-config-utils';import M from'@eslint/css';import {tailwindSyntax}from'@eslint/css/syntax';import {fixupPluginRules}from'@eslint/compat';import {loadConfig}from'graphql-config';import je from'@eslint/js';import Se from'@stylistic/eslint-plugin';import j from'globals';import Ie,{configs}from'eslint-plugin-jsonc';import Fe from'jsonc-eslint-parser';import X from'@eslint/markdown';import {mergeProcessors,processorPassThrough}from'eslint-merge-processors';import F from'eslint-plugin-unicorn';import Z from'eslint-plugin-n';import ee from'eslint-plugin-sonarjs';import Ge from'yaml-eslint-parser';import se from'eslint-plugin-regexp';import {findUp}from'find-up';import Ae from'eslint-plugin-yml';import {isPackageExists}from'local-pkg';var i="**/*.?([cm])[jt]s?(x)",v="**/*.?([cm])ts",T="**/*.?([cm])tsx",P="**/*.stories.tsx",_="**/*.json",D="**/*.json5",L="**/*.jsonc",R="**/*.css",B="**/*.y?(a)ml",C="**/*.md",G="**/*.md/*.md",O=`${C}/${i}`,z=["**/node_modules","**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/bun.lockb","**/bun.lock","**/output","**/coverage","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/.vitepress/cache","**/.nuxt","**/.next","**/.vercel","**/.changeset","**/.idea","**/.cache","**/.output","**/.vite-inspect","**/.yarn","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts"];function N(){return [{files:[i],name:"2digits:antfu",plugins:{antfu:ye},rules:{"antfu/if-newline":"error","antfu/top-level-function":"error"}}]}function W(){return [{files:[i],name:"2digits:boolean",plugins:{boolean:q},rules:{...q.configs.recommended.rules}}]}var c={"@next/next":"next","@eslint-react/naming-convention":"react-naming-convention","@eslint-react/hooks-extra":"react-hooks-extra","@eslint-react/dom":"react-dom","@eslint-react/web-api":"react-web-api","@eslint-react":"react-extra","react-hooks":"react-hooks","react-compiler":"react-compiler","@stylistic/eslint-plugin":"stylistic","@typescript-eslint":"ts",node:"node","@eslint-community/eslint-comments":"comments",storybook:"storybook",turbo:"turbo",jsdoc:"jsdoc",unicorn:"unicorn",tailwindcss:"tailwindcss","@tanstack/query":"tanstack","@2digits":"@2digits","@graphql-eslint":"gql",sonarjs:"sonar",drizzle:"drizzle","de-morgan":"boolean"};var ke=renamePluginsInRules(Oe.recommended.rules,c);function E(){return [{files:[i],name:"2digits:comments",plugins:{comments:be},rules:{...ke,"comments/no-unused-disable":"error","comments/disable-enable-pair":["error",{allowWholeFile:true}]}}]}function A(){return [{name:"2digits:css",files:[R],language:"css/css",plugins:{css:M},languageOptions:{tolerant:true,customSyntax:tailwindSyntax},rules:{...M.configs.recommended.rules}}]}async function t(e){let o=await e;return o.default||o}async function U(e={}){let{overrides:o={},drizzleObjectName:a=["drizzle","db"]}=e,r=await t(import('eslint-plugin-drizzle'));return [{files:[i],name:"2digits:drizzle",plugins:{drizzle:fixupPluginRules(r)},rules:{"drizzle/enforce-update-with-where":["error",{drizzleObjectName:a}],"drizzle/enforce-delete-with-where":["error",{drizzleObjectName:a}],...o}}]}async function $(e={}){let{overrides:o={},files:a=["**/*.graphql","**/*.gql"]}=e,[r,l]=await Promise.all([t(import('@graphql-eslint/eslint-plugin')),loadConfig({throwOnEmpty:false,throwOnMissing:false}).then(y=>y?.getDefault().schema)]),p=r.configs["flat/operations-recommended"].rules,m={};if(l)m=p;else for(let y of Object.keys(p)){let b=y.replace("@graphql-eslint/","");b in r.rules&&(r.rules[b].meta.docs?.requiresSchema||r.rules[b].meta.docs?.requiresSiblings)||(m[y]=p[y]);}let g=renamePluginsInRules(m,c);return [{name:"2digits:graphql",plugins:{gql:r},languageOptions:{parser:r.parser},files:a,rules:{...g,"gql/naming-convention":["error",{allowLeadingUnderscore:true}],...o}}]}async function J(e={}){let{gitIgnore:o,ignores:a=[]}=e;return composer({ignores:[z,a].flat(),name:"2digits:ignores"},t(import('eslint-config-flat-gitignore')).then(r=>r({strict:false,...o,name:"2digits:gitignore"})))}function K(e={}){let{overrides:o={}}=e;return [{files:[i],name:"2digits:javascript",plugins:{stylistic:Se},languageOptions:{ecmaVersion:2022,globals:{...j.browser,...j.es2021,...j.node,document:"readonly",navigator:"readonly",window:"readonly"},parserOptions:{ecmaFeatures:{jsx:true},ecmaVersion:2022,sourceType:"module"},sourceType:"module"},linterOptions:{reportUnusedDisableDirectives:true},rules:{...je.configs.recommended.rules,"accessor-pairs":["error",{enforceForClassMembers:true,setWithoutGet:true}],"array-callback-return":"error","block-scoped-var":"error","constructor-super":"error","default-case-last":"error","dot-notation":["error",{allowKeywords:true}],eqeqeq:["error","smart"],"new-cap":["error",{capIsNew:false,newIsCap:true,properties:true}],"no-alert":"error","no-array-constructor":"error","no-async-promise-executor":"error","no-caller":"error","no-case-declarations":"error","no-class-assign":"error","no-compare-neg-zero":"error","no-cond-assign":["error","always"],"no-const-assign":"error","no-control-regex":"error","no-debugger":"error","no-delete-var":"error","no-dupe-args":"error","no-dupe-class-members":"error","no-dupe-keys":"error","no-duplicate-case":"error","no-empty":["error",{allowEmptyCatch:true}],"no-empty-character-class":"error","no-empty-pattern":"error","no-eval":"error","no-ex-assign":"error","no-extend-native":"error","no-extra-bind":"error","no-extra-boolean-cast":"error","no-fallthrough":"error","no-func-assign":"error","no-global-assign":"error","no-implied-eval":"error","no-import-assign":"error","no-invalid-regexp":"error","no-irregular-whitespace":"error","no-iterator":"error","no-labels":["error",{allowLoop:false,allowSwitch:false}],"no-lone-blocks":"error","no-loss-of-precision":"error","no-misleading-character-class":"error","no-multi-str":"error","no-new":"error","no-new-func":"error","no-new-native-nonconstructor":"error","no-new-wrappers":"error","no-obj-calls":"error","no-octal":"error","no-octal-escape":"error","no-proto":"error","no-prototype-builtins":"error","no-redeclare":["error",{builtinGlobals:false}],"no-regex-spaces":"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","DebuggerStatement","LabeledStatement","WithStatement","TSEnumDeclaration","TSExportAssignment"],"no-self-assign":["error",{props:true}],"no-self-compare":"error","no-sequences":"error","no-shadow-restricted-names":"error","no-sparse-arrays":"error","no-template-curly-in-string":"error","no-this-before-super":"error","no-throw-literal":"error","no-undef":"error","no-undef-init":"error","no-unexpected-multiline":"error","no-unmodified-loop-condition":"error","no-unneeded-ternary":["error",{defaultAssignment:false}],"no-unreachable":"error","no-unreachable-loop":"error","no-unsafe-finally":"error","no-unsafe-negation":"error","no-unused-expressions":["error",{allowShortCircuit:true,allowTaggedTemplates:true,allowTernary:true}],"no-unused-vars":["error",{args:"none",caughtErrors:"none",ignoreRestSiblings:true,vars:"all"}],"no-useless-backreference":"error","no-useless-call":"error","no-useless-catch":"error","no-useless-computed-key":"error","no-useless-constructor":"error","no-useless-rename":"error","no-var":"error","no-with":"error","object-shorthand":["error","always",{avoidQuotes:true,ignoreConstructors:false}],"one-var":["error",{initialized:"never"}],"prefer-arrow-callback":["error",{allowNamedFunctions:true,allowUnboundThis:true}],"prefer-const":["error",{destructuring:"all",ignoreReadBeforeAssign:true}],"prefer-exponentiation-operator":"error","prefer-promise-reject-errors":"error","prefer-regex-literals":["error",{disallowRedundantWrapping:true}],"prefer-rest-params":"error","prefer-spread":"error","prefer-template":"error","symbol-description":"error","unicode-bom":["error","never"],"use-isnan":["error",{enforceForIndexOf:true,enforceForSwitchCase:true}],"valid-typeof":["error",{requireStringLiterals:true}],"vars-on-top":"error",yoda:["error","never"],"stylistic/padding-line-between-statements":["error",{blankLine:"always",prev:["const","let"],next:"*"},{blankLine:"any",prev:["const","let"],next:["const","let"]},{blankLine:"always",prev:"*",next:"return"}],...o}}]}async function V(){return [{files:[i],name:"2digits:jsdoc",plugins:{jsdoc:await t(import('eslint-plugin-jsdoc'))},rules:{"jsdoc/check-access":"error","jsdoc/check-param-names":"error","jsdoc/check-property-names":"error","jsdoc/check-types":"error","jsdoc/empty-tags":"error","jsdoc/implements-on-classes":"error","jsdoc/no-defaults":"error","jsdoc/no-multi-asterisks":"error","jsdoc/require-param-name":"error","jsdoc/require-property":"error","jsdoc/require-property-description":"error","jsdoc/require-property-name":"error","jsdoc/require-returns-check":"error","jsdoc/require-returns-description":"error","jsdoc/require-yields-check":"error"}}]}function H(){return [...configs["flat/base"].map(e=>({...e,name:"2digits:jsonc/base"})),{name:"2digits:jsonc/json",files:[_],...x,rules:{...S(configs["flat/recommended-with-json"])}},{name:"2digits:jsonc/jsonc",files:[L],...x,rules:{...S(configs["flat/recommended-with-jsonc"])}},{name:"2digits:jsonc/json5",files:[D],...x,rules:{...S(configs["flat/recommended-with-json5"])}},{name:"2digits:jsonc/package.json",...x,files:["**/package.json"],rules:{"jsonc/sort-array-values":["error",{order:{type:"asc"},pathPattern:"^files$"}],"jsonc/sort-keys":["error",{order:["$schema","publisher","name","displayName","version","private","description","funding","homepage","repository","bugs","categories","type","main","module","types","typesVersions","bin","files","exports","icon","unpkg","jsdelivr","sideEffects","activationEvents","contributes","scripts","keywords","author","license","workspaces","dependencies","devDependencies","peerDependencies","peerDependenciesMeta","optionalDependencies","packageManager","engines","pnpm","overrides","resolutions","husky","simple-git-hooks","lint-staged","eslintConfig","prettier"],pathPattern:"^$"},{order:{type:"asc"},pathPattern:"^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"},{order:["types","import","module","require","default"],pathPattern:"^exports.*$"}]}},{name:"2digits:jsonc/tsconfig.json",...x,files:["**/tsconfig.json","**/tsconfig.*.json","**/tsconfig-*.json","**/jsconfig.json","**/jsconfig.*.json","**/jsconfig-*.json"],rules:{"jsonc/sort-keys":["error",{order:["$schema","extends","compilerOptions","references","files","include","exclude"],pathPattern:"^$"},{order:["incremental","composite","tsBuildInfoFile","disableSourceOfProjectReferenceRedirect","disableSolutionSearching","disableReferencedProjectLoad","target","lib","jsx","experimentalDecorators","emitDecoratorMetadata","jsxFactory","jsxFragmentFactory","jsxImportSource","reactNamespace","noLib","useDefineForClassFields","moduleDetection","module","rootDir","moduleResolution","baseUrl","paths","rootDirs","typeRoots","types","allowUmdGlobalAccess","moduleSuffixes","allowImportingTsExtensions","resolvePackageJsonExports","resolvePackageJsonImports","customConditions","resolveJsonModule","allowArbitraryExtensions","noResolve","allowJs","checkJs","maxNodeModuleJsDepth","declaration","declarationMap","emitDeclarationOnly","sourceMap","inlineSourceMap","outFile","outDir","removeComments","noEmit","importHelpers","importsNotUsedAsValues","downlevelIteration","sourceRoot","mapRoot","inlineSources","emitBOM","newLine","stripInternal","noEmitHelpers","noEmitOnError","preserveConstEnums","declarationDir","preserveValueImports","isolatedModules","verbatimModuleSyntax","allowSyntheticDefaultImports","esModuleInterop","preserveSymlinks","forceConsistentCasingInFileNames","strict","strictBindCallApply","strictFunctionTypes","strictNullChecks","strictPropertyInitialization","allowUnreachableCode","allowUnusedLabels","alwaysStrict","exactOptionalPropertyTypes","noFallthroughCasesInSwitch","noImplicitAny","noImplicitOverride","noImplicitReturns","noImplicitThis","noPropertyAccessFromIndexSignature","noUncheckedIndexedAccess","noUnusedLocals","noUnusedParameters","useUnknownInCatchVariables","skipDefaultLibCheck","skipLibCheck"],pathPattern:"^compilerOptions$"}]}},...configs["flat/prettier"].map(e=>({...e,name:"2digits:jsonc/prettier"}))]}var x={languageOptions:{parser:Fe},plugins:{jsonc:Ie}};function S(e){return Object.fromEntries(e.flatMap(({rules:o})=>Object.entries(o??{})))}var I=[C];function Y(){return [{name:"2digits:markdown/setup",plugins:{markdown:X}},{name:"2digits:markdown/processor",files:I,language:"markdown/gfm",ignores:[G],processor:mergeProcessors([X.processors.markdown,processorPassThrough])},{name:"2digits:markdown/parser",files:I,language:"markdown/gfm",languageOptions:{parser:De}},{name:"2digits:markdown/rules",files:I,language:"markdown/gfm",rules:{"markdown/fenced-code-language":"error","markdown/heading-increment":"error","markdown/no-empty-links":"error","markdown/no-invalid-label-refs":"error","markdown/no-missing-label-refs":"error"}},{name:"2digits:markdown/disables",files:[O],languageOptions:{parserOptions:{ecmaFeatures:{impliedStrict:true}}},rules:{"no-alert":"off","no-console":"off","no-labels":"off","no-lone-blocks":"off","no-restricted-syntax":"off","no-undef":"off","no-unused-expressions":"off","no-unused-labels":"off","no-unused-vars":"off","node/prefer-global/process":"off","ts/consistent-type-imports":"off","ts/explicit-function-return-type":"off","ts/no-namespace":"off","ts/no-redeclare":"off","ts/no-require-imports":"off","ts/no-unused-expressions":"off","ts/no-unused-vars":"off","ts/no-use-before-define":"off","unicode-bom":"off"}}]}var De={meta:{name:"parser-plain"},parseForESLint:e=>({ast:{body:[],comments:[],loc:{end:e.length,start:0},range:[0,e.length],tokens:[],type:"Program"},scopeManager:null,services:{isPlain:true},visitorKeys:{Program:[]}})};async function Q(e={}){let{files:o=[v,T],overrides:a={},parserOptions:r}=e,[l,p]=await Promise.all([t(import('@next/eslint-plugin-next')),t(import('@typescript-eslint/parser'))]),m=renamePluginsInRules({...l.configs.recommended.rules,...l.configs["core-web-vitals"].rules},c);return [{name:"2digits:next/setup",plugins:{next:fixupPluginRules(l)}},{name:"2digits:next/rules",files:o,languageOptions:{parser:p,parserOptions:{ecmaFeatures:{jsx:true},projectService:true,...r},sourceType:"module"},rules:{...m,"next/no-html-link-for-pages":"off",...a}}]}function re(){return [{files:[i],name:"2digits:node",settings:{node:{version:">= 22.0.0"}},plugins:{node:Z},rules:{"node/handle-callback-err":["error","^(err|error)$"],"node/no-deprecated-api":"error","node/no-exports-assign":"error","node/no-new-require":"error","node/no-path-concat":"error","node/no-unsupported-features/node-builtins":["error",{allowExperimental:true}],"node/prefer-global/buffer":"error","node/prefer-global/process":"error","node/prefer-global/text-encoder":"error","node/prefer-global/url":"error","node/prefer-global/console":"error","node/prefer-global/url-search-params":"error","node/prefer-global/text-decoder":"error","node/process-exit-as-throw":"error"}}]}async function oe(){let e=await t(import('eslint-plugin-pnpm'));return [{name:"2digits:pnpm/package-json",files:["**/package.json"],languageOptions:{parser:Fe},plugins:{pnpm:e},rules:{"pnpm/json-enforce-catalog":"error","pnpm/json-prefer-workspace-settings":"error","pnpm/json-valid-catalog":"error"}},{name:"2digits:pnpm/pnpm-workspace-yaml",files:["pnpm-workspace.yaml"],languageOptions:{parser:Ge},plugins:{pnpm:e},rules:{"pnpm/yaml-no-duplicate-catalog-item":"error","pnpm/yaml-no-unused-catalog-item":"error"}}]}async function te(){let[e,o]=await Promise.all([t(import('eslint-config-prettier')),t(import('@stylistic/eslint-plugin'))]);return [{name:"2digits:prettier",plugins:{stylistic:o},rules:{...e.rules,"tailwindcss/classnames-order":"off","stylistic/jsx-newline":["error",{prevent:false}]}}]}async function ne(e={}){let{files:o=[v,T],overrides:a={},parserOptions:r,tsconfigRootDir:l,reactCompiler:p=true}=e,[m,g,y,b]=await Promise.all([t(import('@eslint-react/eslint-plugin')),t(import('eslint-plugin-react-hooks')),t(import('@typescript-eslint/parser')),p?t(import('eslint-plugin-react-compiler')):void 0]),h=m.configs.all.plugins,ge=renamePluginsInRules({...g.configs["recommended-latest"].rules,...m.configs["recommended-type-checked"].rules},c);return [{name:"2digits:react/setup",plugins:{stylistic:Se,"react-dom":h["@eslint-react/dom"],"react-web-api":h["@eslint-react/web-api"],"react-extra":h["@eslint-react"],"react-hooks":g,"react-hooks-extra":h["@eslint-react/hooks-extra"],"react-naming-convention":h["@eslint-react/naming-convention"],...p?{"react-compiler":b}:{}},settings:{react:{version:"detect"}}},{name:"2digits:react/rules",files:o,languageOptions:{parser:y,parserOptions:{ecmaFeatures:{jsx:true},tsconfigRootDir:l,projectService:true,...r},sourceType:"module"},rules:{...ge,...p?{"react-compiler/react-compiler":"error"}:{},"react-hooks-extra/no-unnecessary-use-callback":"error","react-hooks-extra/prefer-use-state-lazy-initialization":"error","react-hooks-extra/no-redundant-custom-hook":"error","react-hooks-extra/no-unnecessary-use-memo":"error","react-extra/prefer-read-only-props":"off","react-extra/prefer-shorthand-boolean":"error","react-extra/prefer-shorthand-fragment":"error","react-extra/prefer-react-namespace-import":"error","react-naming-convention/use-state":"error","stylistic/jsx-curly-newline":"off","stylistic/jsx-newline":["error",{prevent:false}],"stylistic/jsx-self-closing-comp":"error",...a}}]}function ie(){return [{files:[i],name:"2digits:regexp",plugins:{regexp:se},rules:{...se.configs["flat/recommended"].rules}}]}function ae(){return [{files:[i],name:"2digits:sonar",plugins:{sonar:ee},rules:{"sonar/code-eval":"error","sonar/cognitive-complexity":"error","sonar/comma-or-logical-or-case":"error","sonar/concise-regex":"error","sonar/confidential-information-logging":"error","sonar/constructor-for-side-effects":"error","sonar/content-length":"error","sonar/content-security-policy":"error","sonar/cookie-no-httponly":"error","sonar/cors":"error","sonar/csrf":"error","sonar/max-switch-cases":"error","sonar/no-all-duplicated-branches":"error","sonar/no-collapsible-if":"error","sonar/no-collection-size-mischeck":"error","sonar/no-duplicate-string":["error",{threshold:5}],"sonar/no-duplicated-branches":"error","sonar/no-element-overwrite":"error","sonar/no-empty-collection":"error","sonar/no-extra-arguments":"error","sonar/no-for-in-iterable":"error","sonar/no-gratuitous-expressions":"error","sonar/no-identical-conditions":"error","sonar/no-identical-expressions":"error","sonar/no-identical-functions":"error","sonar/no-ignored-return":"error","sonar/no-inverted-boolean-check":"error","sonar/no-nested-switch":"error","sonar/no-nested-template-literals":"error","sonar/no-one-iteration-loop":"error","sonar/no-redundant-boolean":"error","sonar/no-same-line-conditional":"error","sonar/no-small-switch":"error","sonar/no-unused-collection":"error","sonar/no-use-of-empty-return-value":"error","sonar/no-useless-catch":"error","sonar/non-existent-operator":"error","sonar/prefer-immediate-return":"error","sonar/prefer-object-literal":"error","sonar/prefer-single-boolean-return":"error","sonar/prefer-while":"error","sonar/elseif-without-else":"off","sonar/no-redundant-jump":"off"}}]}async function pe(e={}){let{files:o=[P],overrides:a={},parserOptions:r,storybookDirectory:l=".storybook"}=e,[p,m]=await Promise.all([t(import('eslint-plugin-storybook')),t(import('@typescript-eslint/parser'))]),g={parser:m,parserOptions:{ecmaFeatures:{jsx:true},projectService:true,...r},sourceType:"module"};return [{name:"2digits:storybook/setup",plugins:{storybook:fixupPluginRules(p)}},{name:"2digits:storybook/rules",files:o,languageOptions:g,rules:{"storybook/await-interactions":"error","storybook/context-in-play-function":"error","storybook/csf-component":"error","storybook/default-exports":"error","storybook/hierarchy-separator":"error","storybook/meta-inline-properties":"error","storybook/no-redundant-story-name":"error","storybook/no-stories-of":"error","storybook/no-title-property-in-meta":"error","storybook/no-uninstalled-addons":"error","storybook/prefer-pascal-case":"error","storybook/story-exports":"error","storybook/use-storybook-expect":"error","storybook/use-storybook-testing-library":"error",...a}},{name:"2digits:storybook/disables",files:o,rules:{"react-hooks/rules-of-hooks":"off","react/display-name":"off","sonar/no-duplicate-string":"off"}},{name:"2digits:storybook/config",files:[`${l}/main.@(js|cjs|mjs|ts)`],languageOptions:g,rules:{"storybook/no-uninstalled-addons":"error"}}]}async function le(e={}){let{overrides:o={}}=e,[a,{tailwindFunctions:r},l]=await Promise.all([t(import('eslint-plugin-tailwindcss')),t(import('@2digits/constants')),findUp(["tailwind.config.ts","tailwind.config.js"])]);return [{files:[i],name:"2digits:tailwind",plugins:{tailwindcss:a},settings:{tailwindcss:{callees:r,config:l}},rules:{...a.configs.recommended.rules,...o}}]}async function ce(e={}){let{overrides:o={}}=e,a=await t(import('@tanstack/eslint-plugin-query')),r=renamePluginsInRules(a.configs["flat/recommended"].at(0)?.rules??{},c);return [{files:[i],name:"2digits:tanstack",plugins:{tanstack:a},rules:{...r,...o}}]}async function me(e={}){let{overrides:o={}}=e,a=await t(import('eslint-plugin-turbo'));return [{files:[i],name:"2digits:turbo",plugins:{turbo:a},rules:{"turbo/no-undeclared-env-vars":"error",...o}}]}async function de(e={}){let{overrides:o={},parserOptions:a={}}=e,[{plugin:r,configs:l,parser:p},m]=await Promise.all([t(import('typescript-eslint')),t(import('@2digits/eslint-plugin'))]),g=renamePluginsInConfigs(l.strictTypeChecked,c),y=Object.fromEntries(g.flatMap(({rules:b})=>Object.entries(b??{})));return [{name:"2digits:typescript/setup",plugins:{ts:r,"@2digits":m}},{name:"2digits:typescript/rules",files:[i],ignores:[O],languageOptions:{parser:p,parserOptions:{tsconfigRootDir:process.cwd(),projectService:true,warnOnUnsupportedTypeScriptVersion:false,...a},sourceType:"module"},rules:{...y,"ts/restrict-template-expressions":["error",{allowNumber:true}],"ts/ban-ts-comment":["error",{"ts-ignore":"allow-with-description"}],"ts/consistent-type-exports":["error"],"ts/consistent-type-imports":["error",{prefer:"type-imports",disallowTypeAnnotations:false,fixStyle:"inline-type-imports"}],"ts/no-empty-object-type":["error",{allowInterfaces:"with-single-extends",allowObjectTypes:"never"}],"ts/no-explicit-any":["error"],"ts/no-import-type-side-effects":["error"],"ts/no-misused-promises":"off","ts/no-confusing-void-expression":"off","ts/no-unused-vars":["error",{ignoreRestSiblings:true,argsIgnorePattern:"^_",varsIgnorePattern:"^_"}],"ts/unbound-method":"off",...m.configs.recommended.rules,...o}},{name:"2digits:typescript/disables/dts",files:["**/*.d.ts"],ignores:[O],rules:{"unicorn/no-abusive-eslint-disable":"off","no-duplicate-imports":"off","no-restricted-syntax":"off","ts/no-unused-vars":"off"}},{name:"2digits:typescript/disables/test",files:["**/*.{test,spec}.ts?(x)"],ignores:[O],rules:{"no-unused-expressions":"off"}},{name:"2digits:typescript/disables/cjs",files:["**/*.js","**/*.cjs","**/*.cts"],ignores:[O],rules:{"ts/no-require-imports":"off","ts/no-var-requires":"off"}}]}function fe(){return [{files:[i],name:"2digits:unicorn",plugins:{unicorn:F},rules:{...F.configs.recommended.rules,"unicorn/filename-case":["off"],"unicorn/prefer-module":["off"],"unicorn/prevent-abbreviations":["off"],"unicorn/prefer-ternary":["error","only-single-line"],"unicorn/no-useless-undefined":["error",{checkArguments:false,checkArrowFunctionBody:false}],"unicorn/prefer-top-level-await":["off"]}}]}function ue(){return [{name:"2digits:yaml/setup",plugins:{yml:Ae}},{name:"2digits:yaml/base",...w,rules:{"no-irregular-whitespace":"off","no-unused-vars":"off","spaced-comment":"off"}},{name:"2digits:yaml/recommended",...w,rules:{"yml/no-empty-document":"error","yml/no-empty-key":"error","yml/no-empty-mapping-value":"error","yml/no-empty-sequence-entry":"error","yml/no-irregular-whitespace":"error","yml/no-tab-indent":"error","yml/vue-custom-block/no-parsing-error":"error"}},{name:"2digits:yaml/standard",...w,rules:{"yml/block-mapping":"error","yml/block-sequence":"error","yml/plain-scalar":"error","yml/spaced-comment":"error"}},{name:"2digits:yaml/pnpm-workspace",...w,files:["pnpm-workspace.yaml"],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:".*"}]}},{name:"2digits:yaml/prettier",...w,rules:{"yml/block-mapping-colon-indicator-newline":"off","yml/block-mapping-question-indicator-newline":"off","yml/block-sequence-hyphen-indicator-newline":"off","yml/flow-mapping-curly-newline":"off","yml/flow-mapping-curly-spacing":"off","yml/flow-sequence-bracket-newline":"off","yml/flow-sequence-bracket-spacing":"off","yml/indent":"off","yml/key-spacing":"off","yml/no-multiple-empty-lines":"off","yml/no-trailing-zeros":"off","yml/quotes":"off"}}]}var w={files:[B],languageOptions:{parser:Ge}};function f(e,o){return typeof e=="boolean"?e:e?.enable??o??false}function u(e){if(typeof e=="boolean"||e===void 0)return {};let{enable:o,...a}=e;return a}async function Ke(e={},...o){let a;e.pnpm===void 0&&(a=findUp("pnpm-workspace.yaml"));let r=new FlatConfigComposer(J(e.ignores),K(e.js),W(),re(),E(),V(),fe(),ae(),ie(),N(),H(),A(),ue(),Y());f(e.turbo,isPackageExists("turbo"))&&(r=r.append(me(u(e.turbo))));let{overrides:l,...p}=u(e.ts);return f(e.ts,isPackageExists("typescript"))&&(r=r.append(de(u(e.ts)))),f(e.react,isPackageExists("react"))&&(r=r.append(ne({...u(e.react),...p}))),f(e.next,isPackageExists("next"))&&(r=r.append(Q({...u(e.next),...p}))),f(e.storybook,isPackageExists("storybook"))&&(r=r.append(pe({...u(e.storybook),...p}))),f(e.tailwind,isPackageExists("tailwindcss"))&&(r=r.append(le(u(e.tailwind)))),f(e.tanstack,isPackageExists("react-query")||isPackageExists("@tanstack/react-query")||isPackageExists("@tanstack/react-query-devtools"))&&(r=r.append(ce(u(e.tanstack)))),f(e.drizzle,isPackageExists("drizzle-kit")||isPackageExists("drizzle-orm"))&&(r=r.append(U(u(e.drizzle)))),f(e.graphql,isPackageExists("graphql"))&&(r=r.append($(u(e.graphql)))),f(e.pnpm,!!await a)&&(r=r.append(oe())),r=r.append(...o),isPackageExists("prettier")&&(r=r.append(te())),r.renamePlugins(c).toConfigs()}export{N as antfu,W as boolean,E as comments,A as css,Ke as default,U as drizzle,$ as graphql,J as ignores,K as javascript,V as jsdoc,H as jsonc,Y as markdown,Q as next,re as node,oe as pnpm,te as prettier,ne as react,ie as regexp,ae as sonar,pe as storybook,le as tailwind,ce as tanstack,me as turbo,Ke as twoDigits,de as typescript,fe as unicorn,ue as yaml};//# sourceMappingURL=index.js.map
|
|
1
|
+
import ye from'eslint-plugin-antfu';import q from'eslint-plugin-de-morgan';import be from'@eslint-community/eslint-plugin-eslint-comments';import Oe from'@eslint-community/eslint-plugin-eslint-comments/configs';import {renamePluginsInRules,composer,renamePluginsInConfigs,FlatConfigComposer}from'eslint-flat-config-utils';import M from'@eslint/css';import {tailwindSyntax}from'@eslint/css/syntax';import {fixupPluginRules}from'@eslint/compat';import {loadConfig}from'graphql-config';import je from'@eslint/js';import Se from'@stylistic/eslint-plugin';import j from'globals';import Ie,{configs}from'eslint-plugin-jsonc';import Fe from'jsonc-eslint-parser';import X from'@eslint/markdown';import {mergeProcessors,processorPassThrough}from'eslint-merge-processors';import F from'eslint-plugin-unicorn';import Z from'eslint-plugin-n';import ee from'eslint-plugin-sonarjs';import Ge from'yaml-eslint-parser';import se from'eslint-plugin-regexp';import {findUp}from'find-up';import Ae from'eslint-plugin-yml';import {isPackageExists}from'local-pkg';var i="**/*.?([cm])[jt]s?(x)",v="**/*.?([cm])ts",T="**/*.?([cm])tsx",P="**/*.stories.tsx",_="**/*.json",D="**/*.json5",L="**/*.jsonc",R="**/*.css",B="**/*.y?(a)ml",C="**/*.md",G="**/*.md/*.md",O=`${C}/${i}`,z=["**/node_modules","**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/bun.lockb","**/bun.lock","**/output","**/coverage","**/temp","**/.temp","**/tmp","**/.tmp","**/.history","**/.vitepress/cache","**/.nuxt","**/.next","**/.vercel","**/.changeset","**/.idea","**/.cache","**/.output","**/.vite-inspect","**/.yarn","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts"];function N(){return [{files:[i],name:"2digits:antfu",plugins:{antfu:ye},rules:{"antfu/if-newline":"error","antfu/top-level-function":"error"}}]}function W(){return [{files:[i],name:"2digits:boolean",plugins:{boolean:q},rules:{...q.configs.recommended.rules}}]}var c={"@next/next":"next","@eslint-react/naming-convention":"react-naming-convention","@eslint-react/hooks-extra":"react-hooks-extra","@eslint-react/dom":"react-dom","@eslint-react/web-api":"react-web-api","@eslint-react":"react-extra","react-hooks":"react-hooks","react-compiler":"react-compiler","@stylistic/eslint-plugin":"stylistic","@typescript-eslint":"ts",node:"node","@eslint-community/eslint-comments":"comments",storybook:"storybook",turbo:"turbo",jsdoc:"jsdoc",unicorn:"unicorn",tailwindcss:"tailwindcss","@tanstack/query":"tanstack","@2digits":"@2digits","@graphql-eslint":"gql",sonarjs:"sonar",drizzle:"drizzle","de-morgan":"boolean"};var ke=renamePluginsInRules(Oe.recommended.rules,c);function E(){return [{files:[i],name:"2digits:comments",plugins:{comments:be},rules:{...ke,"comments/no-unused-disable":"error","comments/disable-enable-pair":["error",{allowWholeFile:true}]}}]}function A(){return [{name:"2digits:css",files:[R],language:"css/css",plugins:{css:M},languageOptions:{tolerant:true,customSyntax:tailwindSyntax},rules:{...M.configs.recommended.rules}}]}async function t(e){let o=await e;return o.default||o}async function U(e={}){let{overrides:o={},drizzleObjectName:a=["drizzle","db"]}=e,r=await t(import('eslint-plugin-drizzle'));return [{files:[i],name:"2digits:drizzle",plugins:{drizzle:fixupPluginRules(r)},rules:{"drizzle/enforce-update-with-where":["error",{drizzleObjectName:a}],"drizzle/enforce-delete-with-where":["error",{drizzleObjectName:a}],...o}}]}async function $(e={}){let{overrides:o={},files:a=["**/*.graphql","**/*.gql"]}=e,[r,l]=await Promise.all([t(import('@graphql-eslint/eslint-plugin')),loadConfig({throwOnEmpty:false,throwOnMissing:false}).then(y=>y?.getDefault().schema)]),p=r.configs["flat/operations-recommended"].rules,m={};if(l)m=p;else for(let y of Object.keys(p)){let b=y.replace("@graphql-eslint/","");b in r.rules&&(r.rules[b].meta.docs?.requiresSchema||r.rules[b].meta.docs?.requiresSiblings)||(m[y]=p[y]);}let g=renamePluginsInRules(m,c);return [{name:"2digits:graphql",plugins:{gql:r},languageOptions:{parser:r.parser},files:a,rules:{...g,"gql/naming-convention":["error",{allowLeadingUnderscore:true}],...o}}]}async function J(e={}){let{gitIgnore:o,ignores:a=[]}=e;return composer({ignores:[z,a].flat(),name:"2digits:ignores"},t(import('eslint-config-flat-gitignore')).then(r=>r({strict:false,...o,name:"2digits:gitignore"})))}function K(e={}){let{overrides:o={}}=e;return [{files:[i],name:"2digits:javascript",plugins:{stylistic:Se},languageOptions:{ecmaVersion:2022,globals:{...j.browser,...j.es2021,...j.node,document:"readonly",navigator:"readonly",window:"readonly"},parserOptions:{ecmaFeatures:{jsx:true},ecmaVersion:2022,sourceType:"module"},sourceType:"module"},linterOptions:{reportUnusedDisableDirectives:true},rules:{...je.configs.recommended.rules,"accessor-pairs":["error",{enforceForClassMembers:true,setWithoutGet:true}],"array-callback-return":"error","block-scoped-var":"error","constructor-super":"error","default-case-last":"error","dot-notation":["error",{allowKeywords:true}],eqeqeq:["error","smart"],"new-cap":["error",{capIsNew:false,newIsCap:true,properties:true}],"no-alert":"error","no-array-constructor":"error","no-async-promise-executor":"error","no-caller":"error","no-case-declarations":"error","no-class-assign":"error","no-compare-neg-zero":"error","no-cond-assign":["error","always"],"no-const-assign":"error","no-control-regex":"error","no-debugger":"error","no-delete-var":"error","no-dupe-args":"error","no-dupe-class-members":"error","no-dupe-keys":"error","no-duplicate-case":"error","no-empty":["error",{allowEmptyCatch:true}],"no-empty-character-class":"error","no-empty-pattern":"error","no-eval":"error","no-ex-assign":"error","no-extend-native":"error","no-extra-bind":"error","no-extra-boolean-cast":"error","no-fallthrough":"error","no-func-assign":"error","no-global-assign":"error","no-implied-eval":"error","no-import-assign":"error","no-invalid-regexp":"error","no-irregular-whitespace":"error","no-iterator":"error","no-labels":["error",{allowLoop:false,allowSwitch:false}],"no-lone-blocks":"error","no-loss-of-precision":"error","no-misleading-character-class":"error","no-multi-str":"error","no-new":"error","no-new-func":"error","no-new-native-nonconstructor":"error","no-new-wrappers":"error","no-obj-calls":"error","no-octal":"error","no-octal-escape":"error","no-proto":"error","no-prototype-builtins":"error","no-redeclare":["error",{builtinGlobals:false}],"no-regex-spaces":"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","DebuggerStatement","LabeledStatement","WithStatement","TSEnumDeclaration","TSExportAssignment"],"no-self-assign":["error",{props:true}],"no-self-compare":"error","no-sequences":"error","no-shadow-restricted-names":"error","no-sparse-arrays":"error","no-template-curly-in-string":"error","no-this-before-super":"error","no-throw-literal":"error","no-undef":"error","no-undef-init":"error","no-unexpected-multiline":"error","no-unmodified-loop-condition":"error","no-unneeded-ternary":["error",{defaultAssignment:false}],"no-unreachable":"error","no-unreachable-loop":"error","no-unsafe-finally":"error","no-unsafe-negation":"error","no-unused-expressions":["error",{allowShortCircuit:true,allowTaggedTemplates:true,allowTernary:true}],"no-unused-vars":["error",{args:"none",caughtErrors:"none",ignoreRestSiblings:true,vars:"all"}],"no-useless-backreference":"error","no-useless-call":"error","no-useless-catch":"error","no-useless-computed-key":"error","no-useless-constructor":"error","no-useless-rename":"error","no-var":"error","no-with":"error","object-shorthand":["error","always",{avoidQuotes:true,ignoreConstructors:false}],"one-var":["error",{initialized:"never"}],"prefer-arrow-callback":["error",{allowNamedFunctions:true,allowUnboundThis:true}],"prefer-const":["error",{destructuring:"all",ignoreReadBeforeAssign:true}],"prefer-exponentiation-operator":"error","prefer-promise-reject-errors":"error","prefer-regex-literals":["error",{disallowRedundantWrapping:true}],"prefer-rest-params":"error","prefer-spread":"error","prefer-template":"error","symbol-description":"error","unicode-bom":["error","never"],"use-isnan":["error",{enforceForIndexOf:true,enforceForSwitchCase:true}],"valid-typeof":["error",{requireStringLiterals:true}],"vars-on-top":"error",yoda:["error","never"],"stylistic/padding-line-between-statements":["error",{blankLine:"always",prev:["const","let"],next:"*"},{blankLine:"any",prev:["const","let"],next:["const","let"]},{blankLine:"always",prev:"*",next:"return"}],...o}}]}async function V(){return [{files:[i],name:"2digits:jsdoc",plugins:{jsdoc:await t(import('eslint-plugin-jsdoc'))},rules:{"jsdoc/check-access":"error","jsdoc/check-param-names":"error","jsdoc/check-property-names":"error","jsdoc/check-types":"error","jsdoc/empty-tags":"error","jsdoc/implements-on-classes":"error","jsdoc/no-defaults":"error","jsdoc/no-multi-asterisks":"error","jsdoc/require-param-name":"error","jsdoc/require-property":"error","jsdoc/require-property-description":"error","jsdoc/require-property-name":"error","jsdoc/require-returns-check":"error","jsdoc/require-returns-description":"error","jsdoc/require-yields-check":"error"}}]}function H(){return [...configs["flat/base"].map(e=>({...e,name:"2digits:jsonc/base"})),{name:"2digits:jsonc/json",files:[_],...x,rules:{...S(configs["flat/recommended-with-json"])}},{name:"2digits:jsonc/jsonc",files:[L],...x,rules:{...S(configs["flat/recommended-with-jsonc"])}},{name:"2digits:jsonc/json5",files:[D],...x,rules:{...S(configs["flat/recommended-with-json5"])}},{name:"2digits:jsonc/package.json",...x,files:["**/package.json"],rules:{"jsonc/sort-array-values":["error",{order:{type:"asc"},pathPattern:"^files$"}],"jsonc/sort-keys":["error",{order:["$schema","publisher","name","displayName","version","private","description","funding","homepage","repository","bugs","categories","type","main","module","types","typesVersions","bin","files","exports","icon","unpkg","jsdelivr","sideEffects","activationEvents","contributes","scripts","keywords","author","license","workspaces","dependencies","devDependencies","peerDependencies","peerDependenciesMeta","optionalDependencies","packageManager","engines","pnpm","overrides","resolutions","husky","simple-git-hooks","lint-staged","eslintConfig","prettier"],pathPattern:"^$"},{order:{type:"asc"},pathPattern:"^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"},{order:["types","import","module","require","default"],pathPattern:"^exports.*$"}]}},{name:"2digits:jsonc/tsconfig.json",...x,files:["**/tsconfig.json","**/tsconfig.*.json","**/tsconfig-*.json","**/jsconfig.json","**/jsconfig.*.json","**/jsconfig-*.json"],rules:{"jsonc/sort-keys":["error",{order:["$schema","extends","compilerOptions","references","files","include","exclude"],pathPattern:"^$"},{order:["incremental","composite","tsBuildInfoFile","disableSourceOfProjectReferenceRedirect","disableSolutionSearching","disableReferencedProjectLoad","target","lib","jsx","experimentalDecorators","emitDecoratorMetadata","jsxFactory","jsxFragmentFactory","jsxImportSource","reactNamespace","noLib","useDefineForClassFields","moduleDetection","module","rootDir","moduleResolution","baseUrl","paths","rootDirs","typeRoots","types","allowUmdGlobalAccess","moduleSuffixes","allowImportingTsExtensions","resolvePackageJsonExports","resolvePackageJsonImports","customConditions","resolveJsonModule","allowArbitraryExtensions","noResolve","allowJs","checkJs","maxNodeModuleJsDepth","declaration","declarationMap","emitDeclarationOnly","sourceMap","inlineSourceMap","outFile","outDir","removeComments","noEmit","importHelpers","importsNotUsedAsValues","downlevelIteration","sourceRoot","mapRoot","inlineSources","emitBOM","newLine","stripInternal","noEmitHelpers","noEmitOnError","preserveConstEnums","declarationDir","preserveValueImports","isolatedModules","verbatimModuleSyntax","allowSyntheticDefaultImports","esModuleInterop","preserveSymlinks","forceConsistentCasingInFileNames","strict","strictBindCallApply","strictFunctionTypes","strictNullChecks","strictPropertyInitialization","allowUnreachableCode","allowUnusedLabels","alwaysStrict","exactOptionalPropertyTypes","noFallthroughCasesInSwitch","noImplicitAny","noImplicitOverride","noImplicitReturns","noImplicitThis","noPropertyAccessFromIndexSignature","noUncheckedIndexedAccess","noUnusedLocals","noUnusedParameters","useUnknownInCatchVariables","skipDefaultLibCheck","skipLibCheck"],pathPattern:"^compilerOptions$"}]}},...configs["flat/prettier"].map(e=>({...e,name:"2digits:jsonc/prettier"}))]}var x={languageOptions:{parser:Fe},plugins:{jsonc:Ie}};function S(e){return Object.fromEntries(e.flatMap(({rules:o})=>Object.entries(o??{})))}var I=[C];function Y(){return [{name:"2digits:markdown/setup",plugins:{markdown:X}},{name:"2digits:markdown/processor",files:I,language:"markdown/gfm",ignores:[G],processor:mergeProcessors([X.processors.markdown,processorPassThrough])},{name:"2digits:markdown/parser",files:I,language:"markdown/gfm",languageOptions:{parser:De}},{name:"2digits:markdown/rules",files:I,language:"markdown/gfm",rules:{"markdown/fenced-code-language":"error","markdown/heading-increment":"error","markdown/no-empty-links":"error","markdown/no-invalid-label-refs":"error","markdown/no-missing-label-refs":"error"}},{name:"2digits:markdown/disables",files:[O],languageOptions:{parserOptions:{ecmaFeatures:{impliedStrict:true}}},rules:{"no-alert":"off","no-console":"off","no-labels":"off","no-lone-blocks":"off","no-restricted-syntax":"off","no-undef":"off","no-unused-expressions":"off","no-unused-labels":"off","no-unused-vars":"off","node/prefer-global/process":"off","ts/consistent-type-imports":"off","ts/explicit-function-return-type":"off","ts/no-namespace":"off","ts/no-redeclare":"off","ts/no-require-imports":"off","ts/no-unused-expressions":"off","ts/no-unused-vars":"off","ts/no-use-before-define":"off","unicode-bom":"off"}}]}var De={meta:{name:"parser-plain"},parseForESLint:e=>({ast:{body:[],comments:[],loc:{end:e.length,start:0},range:[0,e.length],tokens:[],type:"Program"},scopeManager:null,services:{isPlain:true},visitorKeys:{Program:[]}})};async function Q(e={}){let{files:o=[v,T],overrides:a={},parserOptions:r}=e,[l,p]=await Promise.all([t(import('@next/eslint-plugin-next')),t(import('@typescript-eslint/parser'))]),m=renamePluginsInRules({...l.configs.recommended.rules,...l.configs["core-web-vitals"].rules},c);return [{name:"2digits:next/setup",plugins:{next:fixupPluginRules(l)}},{name:"2digits:next/rules",files:o,languageOptions:{parser:p,parserOptions:{ecmaFeatures:{jsx:true},projectService:true,...r},sourceType:"module"},rules:{...m,"next/no-html-link-for-pages":"off",...a}}]}function re(){return [{files:[i],name:"2digits:node",settings:{node:{version:">= 22.0.0"}},plugins:{node:Z},rules:{"node/handle-callback-err":["error","^(err|error)$"],"node/no-deprecated-api":"error","node/no-exports-assign":"error","node/no-new-require":"error","node/no-path-concat":"error","node/no-unsupported-features/node-builtins":["error",{allowExperimental:true}],"node/prefer-global/buffer":"error","node/prefer-global/process":"error","node/prefer-global/text-encoder":"error","node/prefer-global/url":"error","node/prefer-global/console":"error","node/prefer-global/url-search-params":"error","node/prefer-global/text-decoder":"error","node/process-exit-as-throw":"error"}}]}async function oe(){let e=await t(import('eslint-plugin-pnpm'));return [{name:"2digits:pnpm/package-json",files:["**/package.json"],languageOptions:{parser:Fe},plugins:{pnpm:e},rules:{"pnpm/json-enforce-catalog":"error","pnpm/json-prefer-workspace-settings":"error","pnpm/json-valid-catalog":"error"}},{name:"2digits:pnpm/pnpm-workspace-yaml",files:["pnpm-workspace.yaml"],languageOptions:{parser:Ge},plugins:{pnpm:e},rules:{"pnpm/yaml-no-duplicate-catalog-item":"error","pnpm/yaml-no-unused-catalog-item":"error"}}]}async function te(){let[e,o]=await Promise.all([t(import('eslint-config-prettier')),t(import('@stylistic/eslint-plugin'))]);return [{name:"2digits:prettier",plugins:{stylistic:o},rules:{...e.rules,"tailwindcss/classnames-order":"off","stylistic/jsx-newline":["error",{prevent:false}]}}]}async function ne(e={}){let{files:o=[v,T],overrides:a={},parserOptions:r,tsconfigRootDir:l,reactCompiler:p=true}=e,[m,g,y,b]=await Promise.all([t(import('@eslint-react/eslint-plugin')),t(import('eslint-plugin-react-hooks')),t(import('@typescript-eslint/parser')),p?t(import('eslint-plugin-react-compiler')):void 0]),h=m.configs.all.plugins,ge=renamePluginsInRules({...g.configs["recommended-latest"].rules,...m.configs["recommended-type-checked"].rules},c);return [{name:"2digits:react/setup",plugins:{stylistic:Se,"react-dom":h["@eslint-react/dom"],"react-web-api":h["@eslint-react/web-api"],"react-extra":h["@eslint-react"],"react-hooks":g,"react-hooks-extra":h["@eslint-react/hooks-extra"],"react-naming-convention":h["@eslint-react/naming-convention"],...p?{"react-compiler":b}:{}},settings:{react:{version:"detect"}}},{name:"2digits:react/rules",files:o,languageOptions:{parser:y,parserOptions:{ecmaFeatures:{jsx:true},tsconfigRootDir:l,projectService:true,...r},sourceType:"module"},rules:{...ge,...p?{"react-compiler/react-compiler":"error"}:{},"react-hooks-extra/no-unnecessary-use-callback":"error","react-hooks-extra/prefer-use-state-lazy-initialization":"error","react-hooks-extra/no-redundant-custom-hook":"error","react-hooks-extra/no-unnecessary-use-memo":"error","react-extra/no-useless-fragment":"off","react-extra/prefer-read-only-props":"off","react-extra/prefer-shorthand-boolean":"error","react-extra/prefer-shorthand-fragment":"error","react-extra/prefer-react-namespace-import":"error","react-naming-convention/use-state":"error","stylistic/jsx-curly-newline":"off","stylistic/jsx-newline":["error",{prevent:false}],"stylistic/jsx-self-closing-comp":"error",...a}}]}function ie(){return [{files:[i],name:"2digits:regexp",plugins:{regexp:se},rules:{...se.configs["flat/recommended"].rules}}]}function ae(){return [{files:[i],name:"2digits:sonar",plugins:{sonar:ee},rules:{"sonar/code-eval":"error","sonar/cognitive-complexity":"error","sonar/comma-or-logical-or-case":"error","sonar/concise-regex":"error","sonar/confidential-information-logging":"error","sonar/constructor-for-side-effects":"error","sonar/content-length":"error","sonar/content-security-policy":"error","sonar/cookie-no-httponly":"error","sonar/cors":"error","sonar/csrf":"error","sonar/max-switch-cases":"error","sonar/no-all-duplicated-branches":"error","sonar/no-collapsible-if":"error","sonar/no-collection-size-mischeck":"error","sonar/no-duplicate-string":["error",{threshold:5}],"sonar/no-duplicated-branches":"error","sonar/no-element-overwrite":"error","sonar/no-empty-collection":"error","sonar/no-extra-arguments":"error","sonar/no-for-in-iterable":"error","sonar/no-gratuitous-expressions":"error","sonar/no-identical-conditions":"error","sonar/no-identical-expressions":"error","sonar/no-identical-functions":"error","sonar/no-ignored-return":"error","sonar/no-inverted-boolean-check":"error","sonar/no-nested-switch":"error","sonar/no-nested-template-literals":"error","sonar/no-one-iteration-loop":"error","sonar/no-redundant-boolean":"error","sonar/no-same-line-conditional":"error","sonar/no-small-switch":"error","sonar/no-unused-collection":"error","sonar/no-use-of-empty-return-value":"error","sonar/no-useless-catch":"error","sonar/non-existent-operator":"error","sonar/prefer-immediate-return":"error","sonar/prefer-object-literal":"error","sonar/prefer-single-boolean-return":"error","sonar/prefer-while":"error","sonar/elseif-without-else":"off","sonar/no-redundant-jump":"off"}}]}async function pe(e={}){let{files:o=[P],overrides:a={},parserOptions:r,storybookDirectory:l=".storybook"}=e,[p,m]=await Promise.all([t(import('eslint-plugin-storybook')),t(import('@typescript-eslint/parser'))]),g={parser:m,parserOptions:{ecmaFeatures:{jsx:true},projectService:true,...r},sourceType:"module"};return [{name:"2digits:storybook/setup",plugins:{storybook:fixupPluginRules(p)}},{name:"2digits:storybook/rules",files:o,languageOptions:g,rules:{"storybook/await-interactions":"error","storybook/context-in-play-function":"error","storybook/csf-component":"error","storybook/default-exports":"error","storybook/hierarchy-separator":"error","storybook/meta-inline-properties":"error","storybook/no-redundant-story-name":"error","storybook/no-stories-of":"error","storybook/no-title-property-in-meta":"error","storybook/no-uninstalled-addons":"error","storybook/prefer-pascal-case":"error","storybook/story-exports":"error","storybook/use-storybook-expect":"error","storybook/use-storybook-testing-library":"error",...a}},{name:"2digits:storybook/disables",files:o,rules:{"react-hooks/rules-of-hooks":"off","react/display-name":"off","sonar/no-duplicate-string":"off"}},{name:"2digits:storybook/config",files:[`${l}/main.@(js|cjs|mjs|ts)`],languageOptions:g,rules:{"storybook/no-uninstalled-addons":"error"}}]}async function le(e={}){let{overrides:o={}}=e,[a,{tailwindFunctions:r},l]=await Promise.all([t(import('eslint-plugin-tailwindcss')),t(import('@2digits/constants')),findUp(["tailwind.config.ts","tailwind.config.js"])]);return [{files:[i],name:"2digits:tailwind",plugins:{tailwindcss:a},settings:{tailwindcss:{callees:r,config:l}},rules:{...a.configs.recommended.rules,...o}}]}async function ce(e={}){let{overrides:o={}}=e,a=await t(import('@tanstack/eslint-plugin-query')),r=renamePluginsInRules(a.configs["flat/recommended"].at(0)?.rules??{},c);return [{files:[i],name:"2digits:tanstack",plugins:{tanstack:a},rules:{...r,...o}}]}async function me(e={}){let{overrides:o={}}=e,a=await t(import('eslint-plugin-turbo'));return [{files:[i],name:"2digits:turbo",plugins:{turbo:a},rules:{"turbo/no-undeclared-env-vars":"error",...o}}]}async function de(e={}){let{overrides:o={},parserOptions:a={}}=e,[{plugin:r,configs:l,parser:p},m]=await Promise.all([t(import('typescript-eslint')),t(import('@2digits/eslint-plugin'))]),g=renamePluginsInConfigs(l.strictTypeChecked,c),y=Object.fromEntries(g.flatMap(({rules:b})=>Object.entries(b??{})));return [{name:"2digits:typescript/setup",plugins:{ts:r,"@2digits":m}},{name:"2digits:typescript/rules",files:[i],ignores:[O],languageOptions:{parser:p,parserOptions:{tsconfigRootDir:process.cwd(),projectService:true,warnOnUnsupportedTypeScriptVersion:false,...a},sourceType:"module"},rules:{...y,"ts/restrict-template-expressions":["error",{allowNumber:true}],"ts/ban-ts-comment":["error",{"ts-ignore":"allow-with-description"}],"ts/consistent-type-exports":["error"],"ts/consistent-type-imports":["error",{prefer:"type-imports",disallowTypeAnnotations:false,fixStyle:"inline-type-imports"}],"ts/no-empty-object-type":["error",{allowInterfaces:"with-single-extends",allowObjectTypes:"never"}],"ts/no-explicit-any":["error"],"ts/no-import-type-side-effects":["error"],"ts/no-misused-promises":"off","ts/no-confusing-void-expression":"off","ts/no-unused-vars":["error",{ignoreRestSiblings:true,argsIgnorePattern:"^_",varsIgnorePattern:"^_"}],"ts/unbound-method":"off",...m.configs.recommended.rules,...o}},{name:"2digits:typescript/disables/dts",files:["**/*.d.ts"],ignores:[O],rules:{"unicorn/no-abusive-eslint-disable":"off","no-duplicate-imports":"off","no-restricted-syntax":"off","ts/no-unused-vars":"off"}},{name:"2digits:typescript/disables/test",files:["**/*.{test,spec}.ts?(x)"],ignores:[O],rules:{"no-unused-expressions":"off"}},{name:"2digits:typescript/disables/cjs",files:["**/*.js","**/*.cjs","**/*.cts"],ignores:[O],rules:{"ts/no-require-imports":"off","ts/no-var-requires":"off"}}]}function fe(){return [{files:[i],name:"2digits:unicorn",plugins:{unicorn:F},rules:{...F.configs.recommended.rules,"unicorn/filename-case":["off"],"unicorn/prefer-module":["off"],"unicorn/prevent-abbreviations":["off"],"unicorn/prefer-ternary":["error","only-single-line"],"unicorn/no-useless-undefined":["error",{checkArguments:false,checkArrowFunctionBody:false}],"unicorn/prefer-top-level-await":["off"]}}]}function ue(){return [{name:"2digits:yaml/setup",plugins:{yml:Ae}},{name:"2digits:yaml/base",...w,rules:{"no-irregular-whitespace":"off","no-unused-vars":"off","spaced-comment":"off"}},{name:"2digits:yaml/recommended",...w,rules:{"yml/no-empty-document":"error","yml/no-empty-key":"error","yml/no-empty-mapping-value":"error","yml/no-empty-sequence-entry":"error","yml/no-irregular-whitespace":"error","yml/no-tab-indent":"error","yml/vue-custom-block/no-parsing-error":"error"}},{name:"2digits:yaml/standard",...w,rules:{"yml/block-mapping":"error","yml/block-sequence":"error","yml/plain-scalar":"error","yml/spaced-comment":"error"}},{name:"2digits:yaml/pnpm-workspace",...w,files:["pnpm-workspace.yaml"],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:".*"}]}},{name:"2digits:yaml/prettier",...w,rules:{"yml/block-mapping-colon-indicator-newline":"off","yml/block-mapping-question-indicator-newline":"off","yml/block-sequence-hyphen-indicator-newline":"off","yml/flow-mapping-curly-newline":"off","yml/flow-mapping-curly-spacing":"off","yml/flow-sequence-bracket-newline":"off","yml/flow-sequence-bracket-spacing":"off","yml/indent":"off","yml/key-spacing":"off","yml/no-multiple-empty-lines":"off","yml/no-trailing-zeros":"off","yml/quotes":"off"}}]}var w={files:[B],languageOptions:{parser:Ge}};function f(e,o){return typeof e=="boolean"?e:e?.enable??o??false}function u(e){if(typeof e=="boolean"||e===void 0)return {};let{enable:o,...a}=e;return a}async function Ke(e={},...o){let a;e.pnpm===void 0&&(a=findUp("pnpm-workspace.yaml"));let r=new FlatConfigComposer(J(e.ignores),K(e.js),W(),re(),E(),V(),fe(),ae(),ie(),N(),H(),A(),ue(),Y());f(e.turbo,isPackageExists("turbo"))&&(r=r.append(me(u(e.turbo))));let{overrides:l,...p}=u(e.ts);return f(e.ts,isPackageExists("typescript"))&&(r=r.append(de(u(e.ts)))),f(e.react,isPackageExists("react"))&&(r=r.append(ne({...u(e.react),...p}))),f(e.next,isPackageExists("next"))&&(r=r.append(Q({...u(e.next),...p}))),f(e.storybook,isPackageExists("storybook"))&&(r=r.append(pe({...u(e.storybook),...p}))),f(e.tailwind,isPackageExists("tailwindcss"))&&(r=r.append(le(u(e.tailwind)))),f(e.tanstack,isPackageExists("react-query")||isPackageExists("@tanstack/react-query")||isPackageExists("@tanstack/react-query-devtools"))&&(r=r.append(ce(u(e.tanstack)))),f(e.drizzle,isPackageExists("drizzle-kit")||isPackageExists("drizzle-orm"))&&(r=r.append(U(u(e.drizzle)))),f(e.graphql,isPackageExists("graphql"))&&(r=r.append($(u(e.graphql)))),f(e.pnpm,!!await a)&&(r=r.append(oe())),r=r.append(...o),isPackageExists("prettier")&&(r=r.append(te())),r.renamePlugins(c).toConfigs()}export{N as antfu,W as boolean,E as comments,A as css,Ke as default,U as drizzle,$ as graphql,J as ignores,K as javascript,V as jsdoc,H as jsonc,Y as markdown,Q as next,re as node,oe as pnpm,te as prettier,ne as react,ie as regexp,ae as sonar,pe as storybook,le as tailwind,ce as tanstack,me as turbo,Ke as twoDigits,de as typescript,fe as unicorn,ue as yaml};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|