@debbl/eslint-config 3.0.4 → 3.0.5-beta.1
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 +1684 -1
- package/dist/index.js +1603 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1 +1,1684 @@
|
|
|
1
|
-
"use strict";var pe=Object.create;var v=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var ce=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty;var ue=(e,o)=>{for(var t in o)v(e,t,{get:o[t],enumerable:!0})},ee=(e,o,t,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of le(o))!me.call(e,i)&&i!==t&&v(e,i,{get:()=>o[i],enumerable:!(s=ae(o,i))||s.enumerable});return e};var n=(e,o,t)=>(t=e!=null?pe(ce(e)):{},ee(o||!e||!e.__esModule?v(t,"default",{value:e,enumerable:!0}):t,e)),fe=e=>ee(v({},"__esModule",{value:!0}),e);var Oe={};ue(Oe,{GLOB_ALL_SRC:()=>ye,GLOB_CSS:()=>T,GLOB_EXCLUDE:()=>S,GLOB_HTML:()=>oe,GLOB_JS:()=>de,GLOB_JSON:()=>O,GLOB_JSON5:()=>h,GLOB_JSONC:()=>I,GLOB_JSX:()=>C,GLOB_LESS:()=>L,GLOB_MARKDOWN:()=>f,GLOB_MARKDOWN_CODE:()=>D,GLOB_MDX:()=>y,GLOB_POSTCSS:()=>_,GLOB_SCSS:()=>G,GLOB_SRC:()=>d,GLOB_SRC_EXT:()=>u,GLOB_STYLE:()=>re,GLOB_TESTS:()=>B,GLOB_TOML:()=>x,GLOB_TS:()=>ge,GLOB_TSX:()=>w,GLOB_VUE:()=>j,GLOB_YAML:()=>g,combine:()=>b,comments:()=>P,config:()=>Z,default:()=>we,ignores:()=>F,imports:()=>R,interopDefault:()=>r,javascript:()=>q,jsdoc:()=>M,jsonc:()=>A,markdown:()=>J,node:()=>U,perfectionist:()=>z,prettier:()=>Q,sortPackageJson:()=>N,sortTsconfig:()=>$,test:()=>K,toml:()=>H,typescript:()=>V,unicorn:()=>W,vue:()=>X,yml:()=>Y});module.exports=fe(Oe);async function P(){return[{name:"eslint:eslint-comments",plugins:{"eslint-comments":await r(import("eslint-plugin-eslint-comments"))},rules:{"eslint-comments/no-aggregating-enable":"error","eslint-comments/no-duplicate-disable":"error","eslint-comments/no-unlimited-disable":"error","eslint-comments/no-unused-enable":"error"}}]}var E=n(require("fs"),1),te=n(require("path"),1);var u="?([cm])[jt]s?(x)",d="**/*.?([cm])[jt]s?(x)",de="**/*.?([cm])js",C="**/*.?([cm])jsx",ge="**/*.?([cm])ts",w="**/*.?([cm])tsx",re="**/*.{c,le,sc}ss",T="**/*.css",_="**/*.{p,post}css",L="**/*.less",G="**/*.scss",O="**/*.json",h="**/*.json5",I="**/*.jsonc",f="**/*.md",y="**/*.mdx",D=`${f}/${d}`,j="**/*.vue",g="**/*.y?(a)ml",x="**/*.toml",oe="**/*.htm?(l)",B=[`**/__tests__/**/*.${u}`,`**/*.spec.${u}`,`**/*.test.${u}`,`**/*.bench.${u}`,`**/*.benchmark.${u}`],ye=[d,re,O,h,f,j,g,oe],S=["**/node_modules","**/dist","**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml","**/bun.lockb","**/output","**/coverage","**/temp","**/.vitepress/cache","**/.nuxt","**/.next","**/.vercel","**/.changeset","**/.idea","**/.cache","**/.output","**/.vite-inspect","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts"];var xe=/\r?\n/g,be=e=>e.split(xe),F=async e=>{let{enableGitignore:o=!0,files:t=[]}=e,s=[];if(o){let l=".gitignore";typeof o!="boolean"&&(l=o.ignorePath);let m=te.default.join(process.cwd(),l);E.default.existsSync(m)&&(s=be(E.default.readFileSync(m).toString()).filter(a=>!(a.startsWith("#")||a.length===0)).map(a=>a.startsWith("/")?a.slice(1):a))}let i=[...S,...s];return typeof t=="function"?i=t(i):i=[...i,...t],[{ignores:[...S,...i]}]};async function b(...e){return(await Promise.all(e)).flat()}async function r(e){let o=await e;return o.default||o}async function R(){return[{name:"eslint:imports",plugins:{import:await r(import("eslint-plugin-i"))},rules:{"import/first":"error","import/no-duplicates":"error","import/no-mutable-exports":"error","import/no-named-default":"error","import/no-self-import":"error","import/no-webpack-loader-syntax":"error","import/order":"error","import/newline-after-import":["error",{considerComments:!0,count:1}]}}]}var k=n(require("globals"),1);var q=async e=>{let{overrides:o={}}=e,t=await r(import("eslint-plugin-unused-imports"));return[{name:"eslint:javascript",languageOptions:{ecmaVersion:2022,globals:{...k.default.browser,...k.default.es2021,...k.default.node,document:"readonly",navigator:"readonly",window:"readonly"},parserOptions:{ecmaFeatures:{jsx:!0},ecmaVersion:2022,sourceType:"module"},sourceType:"module"},linterOptions:{reportUnusedDisableDirectives:!0},plugins:{"unused-imports":t},rules:{"accessor-pairs":["error",{enforceForClassMembers:!0,setWithoutGet:!0}],"array-callback-return":"error","block-scoped-var":"error","constructor-super":"error","default-case-last":"error","dot-notation":["error",{allowKeywords:!0}],eqeqeq:["error","smart"],"new-cap":["error",{capIsNew:!1,newIsCap:!0,properties:!0}],"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-console":["error",{allow:["warn","error"]}],"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:!0}],"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-invalid-this":"error","no-irregular-whitespace":"error","no-iterator":"error","no-labels":["error",{allowLoop:!1,allowSwitch:!1}],"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-symbol":"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:!1}],"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[const=true]","TSExportAssignment"],"no-self-assign":["error",{props:!0}],"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:!1}],"no-unreachable":"error","no-unreachable-loop":"error","no-unsafe-finally":"error","no-unsafe-negation":"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-backreference":"error","no-useless-call":"error","no-useless-catch":"error","no-useless-computed-key":"error","no-useless-constructor":"error","no-useless-rename":"error","no-useless-return":"error","no-var":"error","no-with":"error","object-shorthand":["error","always",{avoidQuotes:!0,ignoreConstructors:!1}],"one-var":["error",{initialized:"never"}],"prefer-arrow-callback":["error",{allowNamedFunctions:!1,allowUnboundThis:!0}],"prefer-const":["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","sort-imports":["error",{allowSeparatedGroups:!1,ignoreCase:!1,ignoreDeclarationSort:!0,ignoreMemberSort:!1,memberSyntaxSortOrder:["none","all","multiple","single"]}],"symbol-description":"error","unicode-bom":["error","never"],"unused-imports/no-unused-imports":"warn","unused-imports/no-unused-vars":["error",{args:"after-used",argsIgnorePattern:"^_",vars:"all",varsIgnorePattern:"^_"}],"use-isnan":["error",{enforceForIndexOf:!0,enforceForSwitchCase:!0}],"valid-typeof":["error",{requireStringLiterals:!0}],"vars-on-top":"error",yoda:["error","never"],...o}},{name:"eslint:scripts-overrides",files:[`scripts/${d}`,`cli.${u}`],rules:{"no-console":"off"}}]};async function M(){return[{name:"eslint:jsdoc",plugins:{jsdoc:await r(import("eslint-plugin-jsdoc"))},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/check-alignment":"warn","jsdoc/multiline-blocks":"warn"}}]}var A=async e=>{let{overrides:o={}}=e,[t,s]=await Promise.all([r(import("eslint-plugin-jsonc")),r(import("jsonc-eslint-parser"))]);return[{name:"eslint:jsonc:setup",plugins:{jsonc:t}},{name:"eslint:jsonc:rules",files:[O,h,I],languageOptions:{parser:s},rules:{"jsonc/no-bigint-literals":"error","jsonc/no-binary-expression":"error","jsonc/no-binary-numeric-literals":"error","jsonc/no-dupe-keys":"error","jsonc/no-escape-sequence-in-identifier":"error","jsonc/no-floating-decimal":"error","jsonc/no-hexadecimal-numeric-literals":"error","jsonc/no-infinity":"error","jsonc/no-multi-str":"error","jsonc/no-nan":"error","jsonc/no-number-props":"error","jsonc/no-numeric-separators":"error","jsonc/no-octal":"error","jsonc/no-octal-escape":"error","jsonc/no-octal-numeric-literals":"error","jsonc/no-parenthesized":"error","jsonc/no-plus-sign":"error","jsonc/no-regexp-literals":"error","jsonc/no-sparse-arrays":"error","jsonc/no-template-literals":"error","jsonc/no-undefined-value":"error","jsonc/no-unicode-codepoint-escapes":"error","jsonc/no-useless-escape":"error","jsonc/space-unary-ops":"error","jsonc/valid-json-number":"error","jsonc/vue-custom-block/no-parsing-error":"error","jsonc/array-bracket-spacing":["error","never"],"jsonc/comma-style":["error","last"],"jsonc/indent":["error",2],"jsonc/key-spacing":["error",{afterColon:!0,beforeColon:!1}],"jsonc/object-curly-newline":["error",{consistent:!0,multiline:!0}],"jsonc/object-curly-spacing":["error","always"],"jsonc/object-property-newline":["error",{allowMultiplePropertiesPerLine:!0}],"jsonc/quote-props":"error","jsonc/quotes":"error",...o}}]};var J=async e=>{let{componentExts:o=[],overrides:t={}}=e,[s,i]=await Promise.all([r(import("eslint-plugin-mdx")),r(import("eslint-mdx"))]);return[{name:"eslint:markdown:setup",plugins:{mdx:s}},{name:"eslint:markdown:processor",files:[f,y],languageOptions:{ecmaVersion:"latest",parser:i,sourceType:"module"},processor:"mdx/remark",settings:{"mdx/code-blocks":!0}},{name:"eslint:markdown:rules",files:[D,...o.map(l=>`${f}/**/*.${l}`)],languageOptions:{parserOptions:{ecmaFeatures:{impliedStrict:!0}}},rules:{"no-alert":"off","no-console":"off","no-undef":"off","no-unused-expressions":"off","no-unused-vars":"off","node/prefer-global/process":"off","@typescript-eslint/consistent-type-imports":"off","@typescript-eslint/no-namespace":"off","@typescript-eslint/no-redeclare":"off","@typescript-eslint/no-require-imports":"off","@typescript-eslint/no-unused-vars":"off","@typescript-eslint/no-use-before-define":"off","@typescript-eslint/no-var-requires":"off","unicode-bom":"off","unused-imports/no-unused-imports":"off","unused-imports/no-unused-vars":"off","@typescript-eslint/await-thenable":"off","@typescript-eslint/dot-notation":"off","@typescript-eslint/no-floating-promises":"off","@typescript-eslint/no-for-in-array":"off","@typescript-eslint/no-implied-eval":"off","@typescript-eslint/no-misused-promises":"off","@typescript-eslint/no-throw-literal":"off","@typescript-eslint/no-unnecessary-type-assertion":"off","@typescript-eslint/no-unsafe-argument":"off","@typescript-eslint/no-unsafe-assignment":"off","@typescript-eslint/no-unsafe-call":"off","@typescript-eslint/no-unsafe-member-access":"off","@typescript-eslint/no-unsafe-return":"off","@typescript-eslint/restrict-plus-operands":"off","@typescript-eslint/restrict-template-expressions":"off","@typescript-eslint/unbound-method":"off",...t}}]};async function U(){return[{name:"eslint:node",plugins:{n:await r(import("eslint-plugin-n"))},rules:{"n/handle-callback-err":["error","^(err|error)$"],"n/no-deprecated-api":"error","n/no-exports-assign":"error","n/no-new-require":"error","n/no-path-concat":"error","n/prefer-global/buffer":["error","never"],"n/prefer-global/process":["error","never"],"n/process-exit-as-throw":"error"}}]}async function N(){return[{name:"eslint:sort-package-json",files:["**/package.json"],rules:{"jsonc/sort-array-values":["error",{order:{type:"asc"},pathPattern:"^files$"}],"jsonc/sort-keys":["error",{order:["publisher","name","displayName","type","version","private","packageManager","description","author","license","funding","homepage","repository","bugs","keywords","categories","sideEffects","exports","main","module","unpkg","jsdelivr","types","typesVersions","bin","icon","files","engines","activationEvents","contributes","scripts","peerDependencies","peerDependenciesMeta","dependencies","optionalDependencies","devDependencies","pnpm","overrides","resolutions","husky","simple-git-hooks","lint-staged","eslintConfig"],pathPattern:"^$"},{order:{type:"asc"},pathPattern:"^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"},{order:{type:"asc"},pathPattern:"^(?:resolutions|overrides|pnpm.overrides)$"},{order:["types","import","require","default"],pathPattern:"^exports.*$"}]}}]}async function $(){return[{name:"eslint:sort-tsconfig",files:["**/tsconfig.json","**/tsconfig.*.json"],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","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","esModuleInterop","forceConsistentCasingInFileNames","isolatedModules","preserveSymlinks","verbatimModuleSyntax","skipDefaultLibCheck","skipLibCheck"],pathPattern:"^compilerOptions$"}]}}]}var ne=n(require("process"),1);var ve={"dot-notation":"off","no-implied-eval":"off","no-throw-literal":"off","@typescript-eslint/await-thenable":"error","@typescript-eslint/dot-notation":["error",{allowKeywords:!0}],"@typescript-eslint/no-floating-promises":"error","@typescript-eslint/no-for-in-array":"error","@typescript-eslint/no-implied-eval":"error","@typescript-eslint/no-misused-promises":"error","@typescript-eslint/no-throw-literal":"error","@typescript-eslint/no-unnecessary-type-assertion":"error","@typescript-eslint/no-unsafe-argument":"error","@typescript-eslint/no-unsafe-assignment":"error","@typescript-eslint/no-unsafe-call":"error","@typescript-eslint/no-unsafe-member-access":"error","@typescript-eslint/no-unsafe-return":"error","@typescript-eslint/restrict-plus-operands":"error","@typescript-eslint/restrict-template-expressions":"error","@typescript-eslint/unbound-method":"error"},V=async e=>{let{overrides:o={},componentExts:t=[],parserOptions:s={},tsconfigPath:i}=e??{},[l,m]=await Promise.all([r(import("@typescript-eslint/eslint-plugin")),r(import("@typescript-eslint/parser"))]);return[{name:"eslint:typescript:setup",plugins:{"@typescript-eslint":l}},{name:"eslint:typescript:rules",files:[d,...t.map(a=>`**/*.${a}`)],languageOptions:{parser:m,parserOptions:{extraFileExtensions:t.map(a=>`.${a}`),sourceType:"module",...i?{project:[i],tsconfigRootDir:ne.default.cwd()}:{},...s}},rules:{...l.configs["eslint-recommended"].overrides[0].rules,...l.configs.strict.rules,"no-dupe-class-members":"off","no-invalid-this":"off","no-loss-of-precision":"off","no-redeclare":"off","no-use-before-define":"off","no-useless-constructor":"off","@typescript-eslint/ban-ts-comment":["error",{"ts-ignore":"allow-with-description"}],"@typescript-eslint/ban-types":["error",{types:{Function:!1}}],"@typescript-eslint/consistent-type-definitions":["error","interface"],"@typescript-eslint/consistent-type-imports":["error",{disallowTypeAnnotations:!1,prefer:"type-imports"}],"@typescript-eslint/no-dupe-class-members":"error","@typescript-eslint/no-dynamic-delete":"off","@typescript-eslint/no-explicit-any":"off","@typescript-eslint/no-extraneous-class":"off","@typescript-eslint/no-import-type-side-effects":"error","@typescript-eslint/no-invalid-this":"error","@typescript-eslint/no-invalid-void-type":"off","@typescript-eslint/no-loss-of-precision":"error","@typescript-eslint/no-non-null-assertion":"off","@typescript-eslint/no-redeclare":"error","@typescript-eslint/no-require-imports":"error","@typescript-eslint/no-unused-vars":"off","@typescript-eslint/no-use-before-define":["error",{classes:!1,functions:!1,variables:!0}],"@typescript-eslint/no-useless-constructor":"off","@typescript-eslint/prefer-ts-expect-error":"error","@typescript-eslint/triple-slash-reference":"off","@typescript-eslint/unified-signatures":"off",...i?ve:{},...o}},{name:"eslint:typescript:dts-overrides",files:["**/*.d.ts"],rules:{"eslint-comments/no-unlimited-disable":"off","import/no-duplicates":"off","no-restricted-syntax":"off","unused-imports/no-unused-vars":"off"}},{name:"eslint:typescript:tests-overrides",files:["**/*.{test,spec}.ts?(x)"],rules:{"no-unused-expressions":"off"}},{files:["**/*.js","**/*.cjs"],name:"eslint:typescript:javascript-overrides",rules:{"@typescript-eslint/no-require-imports":"off","@typescript-eslint/no-var-requires":"off"}}]};async function W(){return[{name:"eslint:unicorn",plugins:{unicorn:await r(import("eslint-plugin-unicorn"))},rules:{"unicorn/error-message":"error","unicorn/escape-case":"error","unicorn/no-instanceof-array":"error","unicorn/no-new-array":"error","unicorn/no-new-buffer":"error","unicorn/number-literal-case":"error","unicorn/prefer-dom-node-text-content":"error","unicorn/prefer-includes":"error","unicorn/prefer-node-protocol":"error","unicorn/prefer-number-properties":"error","unicorn/prefer-string-starts-ends-with":"error","unicorn/prefer-type-error":"error","unicorn/throw-new-error":"error"}}]}var X=async(e={})=>{let{overrides:o={},typescript:t}=e,[s,i]=await Promise.all([r(import("eslint-plugin-vue")),r(import("vue-eslint-parser"))]);return[{name:"eslint:vue:setup",plugins:{vue:s}},{name:"eslint:vue:rules",files:[j],languageOptions:{parser:i,parserOptions:{ecmaFeatures:{jsx:!0},extraFileExtensions:[".vue"],parser:t?await r(import("@typescript-eslint/parser")):null,sourceType:"module"}},processor:s.processors[".vue"],rules:{...s.configs.base.rules,...s.configs["vue3-essential"].rules,...s.configs["vue3-strongly-recommended"].rules,...s.configs["vue3-recommended"].rules,"node/prefer-global/process":"off","vue/block-order":["error",{order:["script","template","style"]}],"vue/component-name-in-template-casing":["error","PascalCase",{registeredComponentsOnly:!1}],"vue/component-options-name-casing":["error","PascalCase"],"vue/custom-event-name-casing":["error","camelCase"],"vue/define-macros-order":["error",{order:["defineOptions","defineProps","defineEmits","defineSlots"]}],"vue/dot-location":["error","property"],"vue/dot-notation":["error",{allowKeywords:!0}],"vue/eqeqeq":["error","smart"],"vue/html-indent":["error",2],"vue/html-quotes":["error","double"],"vue/max-attributes-per-line":"off","vue/multi-word-component-names":"off","vue/no-dupe-keys":"off","vue/no-empty-pattern":"error","vue/no-irregular-whitespace":"error","vue/no-loss-of-precision":"error","vue/no-restricted-syntax":["error","DebuggerStatement","LabeledStatement","WithStatement"],"vue/no-restricted-v-bind":["error","/^v-/"],"vue/no-setup-props-reactivity-loss":"off","vue/no-sparse-arrays":"error","vue/no-unused-refs":"error","vue/no-useless-v-bind":"error","vue/no-v-html":"off","vue/object-shorthand":["error","always",{avoidQuotes:!0,ignoreConstructors:!1}],"vue/prefer-separate-static-class":"error","vue/prefer-template":"error","vue/require-default-prop":"off","vue/require-prop-types":"off","vue/space-infix-ops":"error","vue/space-unary-ops":["error",{nonwords:!1,words:!0}],"vue/array-bracket-spacing":["error","never"],"vue/arrow-spacing":["error",{after:!0,before:!0}],"vue/block-spacing":["error","always"],"vue/block-tag-newline":["error",{multiline:"always",singleline:"always"}],"vue/brace-style":["error","stroustrup",{allowSingleLine:!0}],"vue/comma-dangle":["error","always-multiline"],"vue/comma-spacing":["error",{after:!0,before:!1}],"vue/comma-style":["error","last"],"vue/html-comment-content-spacing":["error","always",{exceptions:["-"]}],"vue/key-spacing":["error",{afterColon:!0,beforeColon:!1}],"vue/keyword-spacing":["error",{after:!0,before:!0}],"vue/object-curly-newline":"off","vue/object-curly-spacing":["error","always"],"vue/object-property-newline":["error",{allowMultiplePropertiesPerLine:!0}],"vue/operator-linebreak":["error","before"],"vue/padding-line-between-blocks":["error","always"],"vue/quote-props":["error","consistent-as-needed"],"vue/space-in-parens":["error","never"],"vue/template-curly-spacing":"error",...o}}]};var Y=async e=>{let{overrides:o={}}=e,[t,s]=await Promise.all([r(import("eslint-plugin-yml")),r(import("yaml-eslint-parser"))]);return[{name:"eslint:yaml:setup",plugins:{yml:t}},{name:"eslint:yaml:rules",files:[g],languageOptions:{parser:s},rules:{...t.configs.standard.rules,...t.configs.prettier.rules,"yml/block-mapping":"error","yml/block-sequence":"error","yml/no-empty-key":"error","yml/no-empty-sequence-entry":"error","yml/no-irregular-whitespace":"error","yml/plain-scalar":"error","yml/vue-custom-block/no-parsing-error":"error","yml/spaced-comment":"error",...o}}]};var H=async e=>{let{overrides:o={}}=e,[t,s]=await Promise.all([r(import("eslint-plugin-toml")),r(import("toml-eslint-parser"))]);return[{name:"eslint:toml:setup",plugins:{toml:t}},{name:"eslint:toml:rules",files:[x],languageOptions:{parser:s},rules:{"toml/comma-style":"error","toml/keys-order":"error","toml/no-space-dots":"error","toml/no-unreadable-number-separator":"error","toml/precision-of-fractional-seconds":"error","toml/precision-of-integer":"error","toml/tables-order":"error","toml/vue-custom-block/no-parsing-error":"error","toml/array-bracket-newline":"error","toml/array-bracket-spacing":"error","toml/array-element-newline":"error","toml/indent":["error",2],"toml/inline-table-curly-spacing":"error","toml/key-spacing":"error","toml/padding-line-between-pairs":"error","toml/padding-line-between-tables":"error","toml/quoted-keys":"error","toml/spaced-comment":"error","toml/table-bracket-spacing":"error",...o}}]};var K=async e=>{let{overrides:o={}}=e,[t,s]=await Promise.all([r(import("eslint-plugin-vitest")),r(import("eslint-plugin-no-only-tests"))]);return[{name:"eslint:test:setup",plugins:{test:{...t,rules:{...t.rules,...s.rules}}}},{name:"eslint:test:rules",files:B,rules:{"test/consistent-test-it":["error",{fn:"it",withinDescribe:"it"}],"test/no-identical-title":"error","test/no-only-tests":"error","test/prefer-hooks-in-order":"error","test/prefer-lowercase-title":"error",...o}}]};async function z(){return[{name:"eslint:perfectionist",plugins:{perfectionist:await r(import("eslint-plugin-perfectionist"))}}]}var Q=async e=>{let[o,t,s]=await Promise.all([r(import("eslint-plugin-prettier")),r(import("eslint-config-prettier")),r(import("eslint-parser-plain"))]),i=[{name:"eslint:prettier:markdown",files:[f],parser:"markdown"},{name:"eslint:prettier:mdx",files:[y],parser:"mdx"},{name:"eslint:prettier:html",files:["**/*.html"],parser:"html"},{name:"eslint:prettier:css",files:[T,_],parser:"css"},{name:"eslint:prettier:scss",files:[G],parser:"scss"},{name:"eslint:prettier:less",files:[L],parser:"less"},{name:"eslint:prettier:yaml",files:[g],parser:"yaml"},{name:"eslint:prettier:graphql",files:["**/*.graphql"],parser:"graphql"}].map(l=>({name:l.name,files:l.files,languageOptions:{parser:s},rules:{"prettier/prettier":["warn",{parser:l.parser,quoteProps:"consistent",...e}]}}));return[{name:"eslint:prettier:setup",plugins:{prettier:o}},{name:"eslint:prettier:rules",ignores:[x],rules:{...t.rules,...o.configs.recommended.rules,"prettier/prettier":["warn",{quoteProps:"consistent",...e}]}},...i]};async function Ce(){let e=await r(import("@next/eslint-plugin-next"));return[{name:"eslint:next:setup",plugins:{"@next/next":e}},{name:"eslint:next:rules",files:[w,C],languageOptions:{parserOptions:{sourceType:"module",ecmaFeatures:{jsx:!0}}},settings:{react:{version:"detect"}},rules:{...e.configs.recommended.rules,...e.configs["core-web-vitals"].rules}}]}var se=async e=>{let{next:o=!1,overrides:t={}}=e,[s,i]=await Promise.all([r(import("eslint-plugin-react")),r(import("eslint-plugin-react-hooks"))]),l=[{name:"eslint:react:setup",plugins:{react:s,"react-hooks":i}},{name:"eslint:react:rules",files:[w,C],languageOptions:{parserOptions:{sourceType:"module",ecmaFeatures:{jsx:!0}}},settings:{react:{version:"detect"}},rules:{...s.configs.recommended.rules,...i.configs.recommended.rules,"jsx-quotes":["error","prefer-double"],"react/react-in-jsx-scope":"off","react/jsx-indent":[1,2],"react/jsx-indent-props":[1,2],"react/jsx-closing-bracket-location":[1,{selfClosing:"tag-aligned",nonEmpty:"tag-aligned"}],...t}}];return b(l,o?Ce():[])};async function ie(){let e=await r(import("eslint-plugin-tailwindcss"));return[{name:"eslint:tailwindcss",plugins:{tailwindcss:e},rules:{...e.configs.recommended.rules}}]}function c(e){return e?typeof e!="boolean"?e:{}:{}}function Z(e={}){let{ignores:o=!0,vue:t,react:s,typescript:i,tailwindcss:l,componentExts:m=[]}=e,a=[];return a.push(F(c(o)),q(e.javascript??{}),P(),U(),M(),R(),W(),z()),t&&m.push("vue"),i&&a.push(V({...typeof i!="boolean"?i:{},componentExts:m})),(e.test??!0)&&a.push(K(c(e.test))),t&&a.push(X({...c(e.vue),typescript:!!i})),s&&a.push(se(c(s))),(e.jsonc??!0)&&a.push(A(c(e.jsonc)),N(),$()),(e.yml??!0)&&a.push(Y(c(e.yml))),(e.toml??!0)&&a.push(H(c(e.toml))),(e.markdown??!0)&&a.push(J({...c(e.markdown),componentExts:m})),l&&a.push(ie()),(e.prettier??!0)&&a.push(Q(c(e.prettier))),b(...a,e.customConfig??[])}var we=Z;0&&(module.exports={GLOB_ALL_SRC,GLOB_CSS,GLOB_EXCLUDE,GLOB_HTML,GLOB_JS,GLOB_JSON,GLOB_JSON5,GLOB_JSONC,GLOB_JSX,GLOB_LESS,GLOB_MARKDOWN,GLOB_MARKDOWN_CODE,GLOB_MDX,GLOB_POSTCSS,GLOB_SCSS,GLOB_SRC,GLOB_SRC_EXT,GLOB_STYLE,GLOB_TESTS,GLOB_TOML,GLOB_TS,GLOB_TSX,GLOB_VUE,GLOB_YAML,combine,comments,config,ignores,imports,interopDefault,javascript,jsdoc,jsonc,markdown,node,perfectionist,prettier,sortPackageJson,sortTsconfig,test,toml,typescript,unicorn,vue,yml});
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
GLOB_ALL_SRC: () => GLOB_ALL_SRC,
|
|
34
|
+
GLOB_CSS: () => GLOB_CSS,
|
|
35
|
+
GLOB_EXCLUDE: () => GLOB_EXCLUDE,
|
|
36
|
+
GLOB_HTML: () => GLOB_HTML,
|
|
37
|
+
GLOB_JS: () => GLOB_JS,
|
|
38
|
+
GLOB_JSON: () => GLOB_JSON,
|
|
39
|
+
GLOB_JSON5: () => GLOB_JSON5,
|
|
40
|
+
GLOB_JSONC: () => GLOB_JSONC,
|
|
41
|
+
GLOB_JSX: () => GLOB_JSX,
|
|
42
|
+
GLOB_LESS: () => GLOB_LESS,
|
|
43
|
+
GLOB_MARKDOWN: () => GLOB_MARKDOWN,
|
|
44
|
+
GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
|
|
45
|
+
GLOB_MDX: () => GLOB_MDX,
|
|
46
|
+
GLOB_POSTCSS: () => GLOB_POSTCSS,
|
|
47
|
+
GLOB_SCSS: () => GLOB_SCSS,
|
|
48
|
+
GLOB_SRC: () => GLOB_SRC,
|
|
49
|
+
GLOB_SRC_EXT: () => GLOB_SRC_EXT,
|
|
50
|
+
GLOB_STYLE: () => GLOB_STYLE,
|
|
51
|
+
GLOB_TESTS: () => GLOB_TESTS,
|
|
52
|
+
GLOB_TOML: () => GLOB_TOML,
|
|
53
|
+
GLOB_TS: () => GLOB_TS,
|
|
54
|
+
GLOB_TSX: () => GLOB_TSX,
|
|
55
|
+
GLOB_VUE: () => GLOB_VUE,
|
|
56
|
+
GLOB_YAML: () => GLOB_YAML,
|
|
57
|
+
combine: () => combine,
|
|
58
|
+
comments: () => comments,
|
|
59
|
+
config: () => config,
|
|
60
|
+
default: () => src_default,
|
|
61
|
+
ignores: () => ignores,
|
|
62
|
+
imports: () => imports,
|
|
63
|
+
interopDefault: () => interopDefault,
|
|
64
|
+
javascript: () => javascript,
|
|
65
|
+
jsdoc: () => jsdoc,
|
|
66
|
+
jsonc: () => jsonc,
|
|
67
|
+
markdown: () => markdown,
|
|
68
|
+
node: () => node,
|
|
69
|
+
perfectionist: () => perfectionist,
|
|
70
|
+
prettier: () => prettier,
|
|
71
|
+
sortPackageJson: () => sortPackageJson,
|
|
72
|
+
sortTsconfig: () => sortTsconfig,
|
|
73
|
+
test: () => test,
|
|
74
|
+
toml: () => toml,
|
|
75
|
+
typescript: () => typescript,
|
|
76
|
+
unicorn: () => unicorn,
|
|
77
|
+
vue: () => vue,
|
|
78
|
+
yml: () => yml
|
|
79
|
+
});
|
|
80
|
+
module.exports = __toCommonJS(src_exports);
|
|
81
|
+
|
|
82
|
+
// src/configs/comments.ts
|
|
83
|
+
async function comments() {
|
|
84
|
+
const pluginComments = await interopDefault(
|
|
85
|
+
// @ts-expect-error missing types
|
|
86
|
+
import("eslint-plugin-eslint-comments")
|
|
87
|
+
);
|
|
88
|
+
return [
|
|
89
|
+
{
|
|
90
|
+
name: "eslint:eslint-comments",
|
|
91
|
+
plugins: {
|
|
92
|
+
"eslint-comments": pluginComments
|
|
93
|
+
},
|
|
94
|
+
rules: {
|
|
95
|
+
"eslint-comments/no-aggregating-enable": "error",
|
|
96
|
+
"eslint-comments/no-duplicate-disable": "error",
|
|
97
|
+
"eslint-comments/no-unlimited-disable": "error",
|
|
98
|
+
"eslint-comments/no-unused-enable": "error"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// src/configs/ignores.ts
|
|
105
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
106
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
107
|
+
|
|
108
|
+
// src/globs.ts
|
|
109
|
+
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
110
|
+
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
111
|
+
var GLOB_JS = "**/*.?([cm])js";
|
|
112
|
+
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
113
|
+
var GLOB_TS = "**/*.?([cm])ts";
|
|
114
|
+
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
115
|
+
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
116
|
+
var GLOB_CSS = "**/*.css";
|
|
117
|
+
var GLOB_POSTCSS = "**/*.{p,post}css";
|
|
118
|
+
var GLOB_LESS = "**/*.less";
|
|
119
|
+
var GLOB_SCSS = "**/*.scss";
|
|
120
|
+
var GLOB_JSON = "**/*.json";
|
|
121
|
+
var GLOB_JSON5 = "**/*.json5";
|
|
122
|
+
var GLOB_JSONC = "**/*.jsonc";
|
|
123
|
+
var GLOB_MARKDOWN = "**/*.md";
|
|
124
|
+
var GLOB_MDX = "**/*.mdx";
|
|
125
|
+
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
126
|
+
var GLOB_VUE = "**/*.vue";
|
|
127
|
+
var GLOB_YAML = "**/*.y?(a)ml";
|
|
128
|
+
var GLOB_TOML = "**/*.toml";
|
|
129
|
+
var GLOB_HTML = "**/*.htm?(l)";
|
|
130
|
+
var GLOB_TESTS = [
|
|
131
|
+
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
132
|
+
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
133
|
+
`**/*.test.${GLOB_SRC_EXT}`,
|
|
134
|
+
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
135
|
+
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
136
|
+
];
|
|
137
|
+
var GLOB_ALL_SRC = [
|
|
138
|
+
GLOB_SRC,
|
|
139
|
+
GLOB_STYLE,
|
|
140
|
+
GLOB_JSON,
|
|
141
|
+
GLOB_JSON5,
|
|
142
|
+
GLOB_MARKDOWN,
|
|
143
|
+
GLOB_VUE,
|
|
144
|
+
GLOB_YAML,
|
|
145
|
+
GLOB_HTML
|
|
146
|
+
];
|
|
147
|
+
var GLOB_EXCLUDE = [
|
|
148
|
+
"**/node_modules",
|
|
149
|
+
"**/dist",
|
|
150
|
+
"**/package-lock.json",
|
|
151
|
+
"**/yarn.lock",
|
|
152
|
+
"**/pnpm-lock.yaml",
|
|
153
|
+
"**/bun.lockb",
|
|
154
|
+
"**/output",
|
|
155
|
+
"**/coverage",
|
|
156
|
+
"**/temp",
|
|
157
|
+
"**/.vitepress/cache",
|
|
158
|
+
"**/.nuxt",
|
|
159
|
+
"**/.next",
|
|
160
|
+
"**/.vercel",
|
|
161
|
+
"**/.changeset",
|
|
162
|
+
"**/.idea",
|
|
163
|
+
"**/.cache",
|
|
164
|
+
"**/.output",
|
|
165
|
+
"**/.vite-inspect",
|
|
166
|
+
"**/CHANGELOG*.md",
|
|
167
|
+
"**/*.min.*",
|
|
168
|
+
"**/LICENSE*",
|
|
169
|
+
"**/__snapshots__",
|
|
170
|
+
"**/auto-import?(s).d.ts",
|
|
171
|
+
"**/components.d.ts"
|
|
172
|
+
];
|
|
173
|
+
|
|
174
|
+
// src/configs/ignores.ts
|
|
175
|
+
var REGEX_SPLIT_ALL_CRLF = /\r?\n/g;
|
|
176
|
+
var splitPattern = (pattern) => pattern.split(REGEX_SPLIT_ALL_CRLF);
|
|
177
|
+
var ignores = async (options) => {
|
|
178
|
+
const { enableGitignore = true, files = [] } = options;
|
|
179
|
+
let gitIgnores = [];
|
|
180
|
+
if (enableGitignore) {
|
|
181
|
+
let ignorePath = ".gitignore";
|
|
182
|
+
if (typeof enableGitignore !== "boolean") {
|
|
183
|
+
ignorePath = enableGitignore.ignorePath;
|
|
184
|
+
}
|
|
185
|
+
const gitignorePath = import_node_path.default.join(process.cwd(), ignorePath);
|
|
186
|
+
if (import_node_fs.default.existsSync(gitignorePath)) {
|
|
187
|
+
gitIgnores = splitPattern(import_node_fs.default.readFileSync(gitignorePath).toString()).filter((i) => !(i.startsWith("#") || i.length === 0)).map((i) => i.startsWith("/") ? i.slice(1) : i);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
let ignores2 = [...GLOB_EXCLUDE, ...gitIgnores];
|
|
191
|
+
if (typeof files === "function") {
|
|
192
|
+
ignores2 = files(ignores2);
|
|
193
|
+
} else {
|
|
194
|
+
ignores2 = [...ignores2, ...files];
|
|
195
|
+
}
|
|
196
|
+
return [
|
|
197
|
+
{
|
|
198
|
+
ignores: [...GLOB_EXCLUDE, ...ignores2]
|
|
199
|
+
}
|
|
200
|
+
];
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// src/utils.ts
|
|
204
|
+
async function combine(...configs) {
|
|
205
|
+
const resolved = await Promise.all(configs);
|
|
206
|
+
return resolved.flat();
|
|
207
|
+
}
|
|
208
|
+
async function interopDefault(m) {
|
|
209
|
+
const resolved = await m;
|
|
210
|
+
return resolved.default || resolved;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// src/configs/imports.ts
|
|
214
|
+
async function imports() {
|
|
215
|
+
const pluginImport = await interopDefault(import("eslint-plugin-i"));
|
|
216
|
+
return [
|
|
217
|
+
{
|
|
218
|
+
name: "eslint:imports",
|
|
219
|
+
plugins: {
|
|
220
|
+
import: pluginImport
|
|
221
|
+
},
|
|
222
|
+
rules: {
|
|
223
|
+
"import/first": "error",
|
|
224
|
+
"import/no-duplicates": "error",
|
|
225
|
+
"import/no-mutable-exports": "error",
|
|
226
|
+
"import/no-named-default": "error",
|
|
227
|
+
"import/no-self-import": "error",
|
|
228
|
+
"import/no-webpack-loader-syntax": "error",
|
|
229
|
+
"import/order": "error",
|
|
230
|
+
"import/newline-after-import": [
|
|
231
|
+
"error",
|
|
232
|
+
{ considerComments: true, count: 1 }
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
];
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// src/configs/javascript.ts
|
|
240
|
+
var import_globals = __toESM(require("globals"), 1);
|
|
241
|
+
var javascript = async (options) => {
|
|
242
|
+
const { overrides = {} } = options;
|
|
243
|
+
const pluginUnusedImports = await interopDefault(
|
|
244
|
+
// @ts-expect-error missing types
|
|
245
|
+
import("eslint-plugin-unused-imports")
|
|
246
|
+
);
|
|
247
|
+
return [
|
|
248
|
+
{
|
|
249
|
+
name: "eslint:javascript",
|
|
250
|
+
languageOptions: {
|
|
251
|
+
ecmaVersion: 2022,
|
|
252
|
+
globals: {
|
|
253
|
+
...import_globals.default.browser,
|
|
254
|
+
...import_globals.default.es2021,
|
|
255
|
+
...import_globals.default.node,
|
|
256
|
+
document: "readonly",
|
|
257
|
+
navigator: "readonly",
|
|
258
|
+
window: "readonly"
|
|
259
|
+
},
|
|
260
|
+
parserOptions: {
|
|
261
|
+
ecmaFeatures: {
|
|
262
|
+
jsx: true
|
|
263
|
+
},
|
|
264
|
+
ecmaVersion: 2022,
|
|
265
|
+
sourceType: "module"
|
|
266
|
+
},
|
|
267
|
+
sourceType: "module"
|
|
268
|
+
},
|
|
269
|
+
linterOptions: {
|
|
270
|
+
reportUnusedDisableDirectives: true
|
|
271
|
+
},
|
|
272
|
+
plugins: {
|
|
273
|
+
"unused-imports": pluginUnusedImports
|
|
274
|
+
},
|
|
275
|
+
rules: {
|
|
276
|
+
"accessor-pairs": [
|
|
277
|
+
"error",
|
|
278
|
+
{ enforceForClassMembers: true, setWithoutGet: true }
|
|
279
|
+
],
|
|
280
|
+
"array-callback-return": "error",
|
|
281
|
+
"block-scoped-var": "error",
|
|
282
|
+
"constructor-super": "error",
|
|
283
|
+
"default-case-last": "error",
|
|
284
|
+
"dot-notation": ["error", { allowKeywords: true }],
|
|
285
|
+
"eqeqeq": ["error", "smart"],
|
|
286
|
+
"new-cap": [
|
|
287
|
+
"error",
|
|
288
|
+
{ capIsNew: false, newIsCap: true, properties: true }
|
|
289
|
+
],
|
|
290
|
+
"no-alert": "error",
|
|
291
|
+
"no-array-constructor": "error",
|
|
292
|
+
"no-async-promise-executor": "error",
|
|
293
|
+
"no-caller": "error",
|
|
294
|
+
"no-case-declarations": "error",
|
|
295
|
+
"no-class-assign": "error",
|
|
296
|
+
"no-compare-neg-zero": "error",
|
|
297
|
+
"no-cond-assign": ["error", "always"],
|
|
298
|
+
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
299
|
+
"no-const-assign": "error",
|
|
300
|
+
"no-control-regex": "error",
|
|
301
|
+
"no-debugger": "error",
|
|
302
|
+
"no-delete-var": "error",
|
|
303
|
+
"no-dupe-args": "error",
|
|
304
|
+
"no-dupe-class-members": "error",
|
|
305
|
+
"no-dupe-keys": "error",
|
|
306
|
+
"no-duplicate-case": "error",
|
|
307
|
+
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
308
|
+
"no-empty-character-class": "error",
|
|
309
|
+
"no-empty-pattern": "error",
|
|
310
|
+
"no-eval": "error",
|
|
311
|
+
"no-ex-assign": "error",
|
|
312
|
+
"no-extend-native": "error",
|
|
313
|
+
"no-extra-bind": "error",
|
|
314
|
+
"no-extra-boolean-cast": "error",
|
|
315
|
+
"no-fallthrough": "error",
|
|
316
|
+
"no-func-assign": "error",
|
|
317
|
+
"no-global-assign": "error",
|
|
318
|
+
"no-implied-eval": "error",
|
|
319
|
+
"no-import-assign": "error",
|
|
320
|
+
"no-invalid-regexp": "error",
|
|
321
|
+
"no-invalid-this": "error",
|
|
322
|
+
"no-irregular-whitespace": "error",
|
|
323
|
+
"no-iterator": "error",
|
|
324
|
+
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
|
325
|
+
"no-lone-blocks": "error",
|
|
326
|
+
"no-loss-of-precision": "error",
|
|
327
|
+
"no-misleading-character-class": "error",
|
|
328
|
+
"no-multi-str": "error",
|
|
329
|
+
"no-new": "error",
|
|
330
|
+
"no-new-func": "error",
|
|
331
|
+
"no-new-symbol": "error",
|
|
332
|
+
"no-new-wrappers": "error",
|
|
333
|
+
"no-obj-calls": "error",
|
|
334
|
+
"no-octal": "error",
|
|
335
|
+
"no-octal-escape": "error",
|
|
336
|
+
"no-proto": "error",
|
|
337
|
+
"no-prototype-builtins": "error",
|
|
338
|
+
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
339
|
+
"no-regex-spaces": "error",
|
|
340
|
+
"no-restricted-globals": [
|
|
341
|
+
"error",
|
|
342
|
+
{ message: "Use `globalThis` instead.", name: "global" },
|
|
343
|
+
{ message: "Use `globalThis` instead.", name: "self" }
|
|
344
|
+
],
|
|
345
|
+
"no-restricted-properties": [
|
|
346
|
+
"error",
|
|
347
|
+
{
|
|
348
|
+
message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
|
|
349
|
+
property: "__proto__"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
message: "Use `Object.defineProperty` instead.",
|
|
353
|
+
property: "__defineGetter__"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
message: "Use `Object.defineProperty` instead.",
|
|
357
|
+
property: "__defineSetter__"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
message: "Use `Object.getOwnPropertyDescriptor` instead.",
|
|
361
|
+
property: "__lookupGetter__"
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
message: "Use `Object.getOwnPropertyDescriptor` instead.",
|
|
365
|
+
property: "__lookupSetter__"
|
|
366
|
+
}
|
|
367
|
+
],
|
|
368
|
+
"no-restricted-syntax": [
|
|
369
|
+
"error",
|
|
370
|
+
"DebuggerStatement",
|
|
371
|
+
"LabeledStatement",
|
|
372
|
+
"WithStatement",
|
|
373
|
+
"TSEnumDeclaration[const=true]",
|
|
374
|
+
"TSExportAssignment"
|
|
375
|
+
],
|
|
376
|
+
"no-self-assign": ["error", { props: true }],
|
|
377
|
+
"no-self-compare": "error",
|
|
378
|
+
"no-sequences": "error",
|
|
379
|
+
"no-shadow-restricted-names": "error",
|
|
380
|
+
"no-sparse-arrays": "error",
|
|
381
|
+
"no-template-curly-in-string": "error",
|
|
382
|
+
"no-this-before-super": "error",
|
|
383
|
+
"no-throw-literal": "error",
|
|
384
|
+
"no-undef": "error",
|
|
385
|
+
"no-undef-init": "error",
|
|
386
|
+
"no-unexpected-multiline": "error",
|
|
387
|
+
"no-unmodified-loop-condition": "error",
|
|
388
|
+
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
389
|
+
"no-unreachable": "error",
|
|
390
|
+
"no-unreachable-loop": "error",
|
|
391
|
+
"no-unsafe-finally": "error",
|
|
392
|
+
"no-unsafe-negation": "error",
|
|
393
|
+
"no-unused-expressions": [
|
|
394
|
+
"error",
|
|
395
|
+
{
|
|
396
|
+
allowShortCircuit: true,
|
|
397
|
+
allowTaggedTemplates: true,
|
|
398
|
+
allowTernary: true
|
|
399
|
+
}
|
|
400
|
+
],
|
|
401
|
+
"no-unused-vars": [
|
|
402
|
+
"error",
|
|
403
|
+
{
|
|
404
|
+
args: "none",
|
|
405
|
+
caughtErrors: "none",
|
|
406
|
+
ignoreRestSiblings: true,
|
|
407
|
+
vars: "all"
|
|
408
|
+
}
|
|
409
|
+
],
|
|
410
|
+
"no-use-before-define": [
|
|
411
|
+
"error",
|
|
412
|
+
{ classes: false, functions: false, variables: true }
|
|
413
|
+
],
|
|
414
|
+
"no-useless-backreference": "error",
|
|
415
|
+
"no-useless-call": "error",
|
|
416
|
+
"no-useless-catch": "error",
|
|
417
|
+
"no-useless-computed-key": "error",
|
|
418
|
+
"no-useless-constructor": "error",
|
|
419
|
+
"no-useless-rename": "error",
|
|
420
|
+
"no-useless-return": "error",
|
|
421
|
+
"no-var": "error",
|
|
422
|
+
"no-with": "error",
|
|
423
|
+
"object-shorthand": [
|
|
424
|
+
"error",
|
|
425
|
+
"always",
|
|
426
|
+
{
|
|
427
|
+
avoidQuotes: true,
|
|
428
|
+
ignoreConstructors: false
|
|
429
|
+
}
|
|
430
|
+
],
|
|
431
|
+
"one-var": ["error", { initialized: "never" }],
|
|
432
|
+
"prefer-arrow-callback": [
|
|
433
|
+
"error",
|
|
434
|
+
{
|
|
435
|
+
allowNamedFunctions: false,
|
|
436
|
+
allowUnboundThis: true
|
|
437
|
+
}
|
|
438
|
+
],
|
|
439
|
+
"prefer-const": [
|
|
440
|
+
"error",
|
|
441
|
+
{
|
|
442
|
+
destructuring: "all",
|
|
443
|
+
ignoreReadBeforeAssign: true
|
|
444
|
+
}
|
|
445
|
+
],
|
|
446
|
+
"prefer-exponentiation-operator": "error",
|
|
447
|
+
"prefer-promise-reject-errors": "error",
|
|
448
|
+
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
449
|
+
"prefer-rest-params": "error",
|
|
450
|
+
"prefer-spread": "error",
|
|
451
|
+
"prefer-template": "error",
|
|
452
|
+
"sort-imports": [
|
|
453
|
+
"error",
|
|
454
|
+
{
|
|
455
|
+
allowSeparatedGroups: false,
|
|
456
|
+
ignoreCase: false,
|
|
457
|
+
ignoreDeclarationSort: true,
|
|
458
|
+
ignoreMemberSort: false,
|
|
459
|
+
memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
|
|
460
|
+
}
|
|
461
|
+
],
|
|
462
|
+
"symbol-description": "error",
|
|
463
|
+
"unicode-bom": ["error", "never"],
|
|
464
|
+
"unused-imports/no-unused-imports": "warn",
|
|
465
|
+
"unused-imports/no-unused-vars": [
|
|
466
|
+
"error",
|
|
467
|
+
{
|
|
468
|
+
args: "after-used",
|
|
469
|
+
argsIgnorePattern: "^_",
|
|
470
|
+
vars: "all",
|
|
471
|
+
varsIgnorePattern: "^_"
|
|
472
|
+
}
|
|
473
|
+
],
|
|
474
|
+
"use-isnan": [
|
|
475
|
+
"error",
|
|
476
|
+
{ enforceForIndexOf: true, enforceForSwitchCase: true }
|
|
477
|
+
],
|
|
478
|
+
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
479
|
+
"vars-on-top": "error",
|
|
480
|
+
"yoda": ["error", "never"],
|
|
481
|
+
...overrides
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
name: "eslint:scripts-overrides",
|
|
486
|
+
files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
487
|
+
rules: {
|
|
488
|
+
"no-console": "off"
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
];
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
// src/configs/jsdoc.ts
|
|
495
|
+
async function jsdoc() {
|
|
496
|
+
return [
|
|
497
|
+
{
|
|
498
|
+
name: "eslint:jsdoc",
|
|
499
|
+
plugins: {
|
|
500
|
+
jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
|
|
501
|
+
},
|
|
502
|
+
rules: {
|
|
503
|
+
"jsdoc/check-access": "warn",
|
|
504
|
+
"jsdoc/check-param-names": "warn",
|
|
505
|
+
"jsdoc/check-property-names": "warn",
|
|
506
|
+
"jsdoc/check-types": "warn",
|
|
507
|
+
"jsdoc/empty-tags": "warn",
|
|
508
|
+
"jsdoc/implements-on-classes": "warn",
|
|
509
|
+
"jsdoc/no-defaults": "warn",
|
|
510
|
+
"jsdoc/no-multi-asterisks": "warn",
|
|
511
|
+
"jsdoc/require-param-name": "warn",
|
|
512
|
+
"jsdoc/require-property": "warn",
|
|
513
|
+
"jsdoc/require-property-description": "warn",
|
|
514
|
+
"jsdoc/require-property-name": "warn",
|
|
515
|
+
"jsdoc/require-returns-check": "warn",
|
|
516
|
+
"jsdoc/require-returns-description": "warn",
|
|
517
|
+
"jsdoc/require-yields-check": "warn",
|
|
518
|
+
"jsdoc/check-alignment": "warn",
|
|
519
|
+
"jsdoc/multiline-blocks": "warn"
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
];
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// src/configs/jsonc.ts
|
|
526
|
+
var jsonc = async (options) => {
|
|
527
|
+
const { overrides = {} } = options;
|
|
528
|
+
const [pluginJsonc, parserJsonc] = await Promise.all([
|
|
529
|
+
interopDefault(import("eslint-plugin-jsonc")),
|
|
530
|
+
interopDefault(import("jsonc-eslint-parser"))
|
|
531
|
+
]);
|
|
532
|
+
return [
|
|
533
|
+
{
|
|
534
|
+
name: "eslint:jsonc:setup",
|
|
535
|
+
plugins: {
|
|
536
|
+
jsonc: pluginJsonc
|
|
537
|
+
}
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
name: "eslint:jsonc:rules",
|
|
541
|
+
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
542
|
+
languageOptions: {
|
|
543
|
+
parser: parserJsonc
|
|
544
|
+
},
|
|
545
|
+
rules: {
|
|
546
|
+
"jsonc/no-bigint-literals": "error",
|
|
547
|
+
"jsonc/no-binary-expression": "error",
|
|
548
|
+
"jsonc/no-binary-numeric-literals": "error",
|
|
549
|
+
"jsonc/no-dupe-keys": "error",
|
|
550
|
+
"jsonc/no-escape-sequence-in-identifier": "error",
|
|
551
|
+
"jsonc/no-floating-decimal": "error",
|
|
552
|
+
"jsonc/no-hexadecimal-numeric-literals": "error",
|
|
553
|
+
"jsonc/no-infinity": "error",
|
|
554
|
+
"jsonc/no-multi-str": "error",
|
|
555
|
+
"jsonc/no-nan": "error",
|
|
556
|
+
"jsonc/no-number-props": "error",
|
|
557
|
+
"jsonc/no-numeric-separators": "error",
|
|
558
|
+
"jsonc/no-octal": "error",
|
|
559
|
+
"jsonc/no-octal-escape": "error",
|
|
560
|
+
"jsonc/no-octal-numeric-literals": "error",
|
|
561
|
+
"jsonc/no-parenthesized": "error",
|
|
562
|
+
"jsonc/no-plus-sign": "error",
|
|
563
|
+
"jsonc/no-regexp-literals": "error",
|
|
564
|
+
"jsonc/no-sparse-arrays": "error",
|
|
565
|
+
"jsonc/no-template-literals": "error",
|
|
566
|
+
"jsonc/no-undefined-value": "error",
|
|
567
|
+
"jsonc/no-unicode-codepoint-escapes": "error",
|
|
568
|
+
"jsonc/no-useless-escape": "error",
|
|
569
|
+
"jsonc/space-unary-ops": "error",
|
|
570
|
+
"jsonc/valid-json-number": "error",
|
|
571
|
+
"jsonc/vue-custom-block/no-parsing-error": "error",
|
|
572
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
573
|
+
"jsonc/comma-style": ["error", "last"],
|
|
574
|
+
"jsonc/key-spacing": [
|
|
575
|
+
"error",
|
|
576
|
+
{ afterColon: true, beforeColon: false }
|
|
577
|
+
],
|
|
578
|
+
"jsonc/object-curly-newline": [
|
|
579
|
+
"error",
|
|
580
|
+
{ consistent: true, multiline: true }
|
|
581
|
+
],
|
|
582
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
583
|
+
"jsonc/object-property-newline": [
|
|
584
|
+
"error",
|
|
585
|
+
{ allowMultiplePropertiesPerLine: true }
|
|
586
|
+
],
|
|
587
|
+
"jsonc/quote-props": "error",
|
|
588
|
+
"jsonc/quotes": "error",
|
|
589
|
+
...overrides
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
];
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
// src/configs/markdown.ts
|
|
596
|
+
var markdown = async (options) => {
|
|
597
|
+
const { componentExts = [], overrides = {} } = options;
|
|
598
|
+
const [pluginMdx, parserMdx] = await Promise.all([
|
|
599
|
+
interopDefault(import("eslint-plugin-mdx")),
|
|
600
|
+
interopDefault(import("eslint-mdx"))
|
|
601
|
+
]);
|
|
602
|
+
return [
|
|
603
|
+
{
|
|
604
|
+
name: "eslint:markdown:setup",
|
|
605
|
+
plugins: {
|
|
606
|
+
mdx: pluginMdx
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
name: "eslint:markdown:processor",
|
|
611
|
+
files: [GLOB_MARKDOWN, GLOB_MDX],
|
|
612
|
+
languageOptions: {
|
|
613
|
+
ecmaVersion: "latest",
|
|
614
|
+
parser: parserMdx,
|
|
615
|
+
sourceType: "module"
|
|
616
|
+
},
|
|
617
|
+
processor: "mdx/remark",
|
|
618
|
+
settings: {
|
|
619
|
+
"mdx/code-blocks": true
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
name: "eslint:markdown:rules",
|
|
624
|
+
files: [
|
|
625
|
+
GLOB_MARKDOWN_CODE,
|
|
626
|
+
...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
|
|
627
|
+
],
|
|
628
|
+
languageOptions: {
|
|
629
|
+
parserOptions: {
|
|
630
|
+
ecmaFeatures: {
|
|
631
|
+
impliedStrict: true
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
},
|
|
635
|
+
rules: {
|
|
636
|
+
"no-alert": "off",
|
|
637
|
+
"no-console": "off",
|
|
638
|
+
"no-undef": "off",
|
|
639
|
+
"no-unused-expressions": "off",
|
|
640
|
+
"no-unused-vars": "off",
|
|
641
|
+
"node/prefer-global/process": "off",
|
|
642
|
+
"@typescript-eslint/consistent-type-imports": "off",
|
|
643
|
+
"@typescript-eslint/no-namespace": "off",
|
|
644
|
+
"@typescript-eslint/no-redeclare": "off",
|
|
645
|
+
"@typescript-eslint/no-require-imports": "off",
|
|
646
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
647
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
648
|
+
"@typescript-eslint/no-var-requires": "off",
|
|
649
|
+
"unicode-bom": "off",
|
|
650
|
+
"unused-imports/no-unused-imports": "off",
|
|
651
|
+
"unused-imports/no-unused-vars": "off",
|
|
652
|
+
// Type aware rules
|
|
653
|
+
...{
|
|
654
|
+
"@typescript-eslint/await-thenable": "off",
|
|
655
|
+
"@typescript-eslint/dot-notation": "off",
|
|
656
|
+
"@typescript-eslint/no-floating-promises": "off",
|
|
657
|
+
"@typescript-eslint/no-for-in-array": "off",
|
|
658
|
+
"@typescript-eslint/no-implied-eval": "off",
|
|
659
|
+
"@typescript-eslint/no-misused-promises": "off",
|
|
660
|
+
"@typescript-eslint/no-throw-literal": "off",
|
|
661
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "off",
|
|
662
|
+
"@typescript-eslint/no-unsafe-argument": "off",
|
|
663
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
664
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
665
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
666
|
+
"@typescript-eslint/no-unsafe-return": "off",
|
|
667
|
+
"@typescript-eslint/restrict-plus-operands": "off",
|
|
668
|
+
"@typescript-eslint/restrict-template-expressions": "off",
|
|
669
|
+
"@typescript-eslint/unbound-method": "off"
|
|
670
|
+
},
|
|
671
|
+
...overrides
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
];
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
// src/configs/node.ts
|
|
678
|
+
async function node() {
|
|
679
|
+
const pluginNode = await interopDefault(import("eslint-plugin-n"));
|
|
680
|
+
return [
|
|
681
|
+
{
|
|
682
|
+
name: "eslint:node",
|
|
683
|
+
plugins: {
|
|
684
|
+
n: pluginNode
|
|
685
|
+
},
|
|
686
|
+
rules: {
|
|
687
|
+
"n/handle-callback-err": ["error", "^(err|error)$"],
|
|
688
|
+
"n/no-deprecated-api": "error",
|
|
689
|
+
"n/no-exports-assign": "error",
|
|
690
|
+
"n/no-new-require": "error",
|
|
691
|
+
"n/no-path-concat": "error",
|
|
692
|
+
"n/prefer-global/buffer": ["error", "never"],
|
|
693
|
+
"n/prefer-global/process": ["error", "never"],
|
|
694
|
+
"n/process-exit-as-throw": "error"
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
];
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
// src/configs/sort.ts
|
|
701
|
+
async function sortPackageJson() {
|
|
702
|
+
return [
|
|
703
|
+
{
|
|
704
|
+
name: "eslint:sort-package-json",
|
|
705
|
+
files: ["**/package.json"],
|
|
706
|
+
rules: {
|
|
707
|
+
"jsonc/sort-array-values": [
|
|
708
|
+
"error",
|
|
709
|
+
{
|
|
710
|
+
order: { type: "asc" },
|
|
711
|
+
pathPattern: "^files$"
|
|
712
|
+
}
|
|
713
|
+
],
|
|
714
|
+
"jsonc/sort-keys": [
|
|
715
|
+
"error",
|
|
716
|
+
{
|
|
717
|
+
order: [
|
|
718
|
+
"publisher",
|
|
719
|
+
"name",
|
|
720
|
+
"displayName",
|
|
721
|
+
"type",
|
|
722
|
+
"version",
|
|
723
|
+
"private",
|
|
724
|
+
"packageManager",
|
|
725
|
+
"description",
|
|
726
|
+
"author",
|
|
727
|
+
"license",
|
|
728
|
+
"funding",
|
|
729
|
+
"homepage",
|
|
730
|
+
"repository",
|
|
731
|
+
"bugs",
|
|
732
|
+
"keywords",
|
|
733
|
+
"categories",
|
|
734
|
+
"sideEffects",
|
|
735
|
+
"exports",
|
|
736
|
+
"main",
|
|
737
|
+
"module",
|
|
738
|
+
"unpkg",
|
|
739
|
+
"jsdelivr",
|
|
740
|
+
"types",
|
|
741
|
+
"typesVersions",
|
|
742
|
+
"bin",
|
|
743
|
+
"icon",
|
|
744
|
+
"files",
|
|
745
|
+
"engines",
|
|
746
|
+
"activationEvents",
|
|
747
|
+
"contributes",
|
|
748
|
+
"scripts",
|
|
749
|
+
"peerDependencies",
|
|
750
|
+
"peerDependenciesMeta",
|
|
751
|
+
"dependencies",
|
|
752
|
+
"optionalDependencies",
|
|
753
|
+
"devDependencies",
|
|
754
|
+
"pnpm",
|
|
755
|
+
"overrides",
|
|
756
|
+
"resolutions",
|
|
757
|
+
"husky",
|
|
758
|
+
"simple-git-hooks",
|
|
759
|
+
"lint-staged",
|
|
760
|
+
"eslintConfig"
|
|
761
|
+
],
|
|
762
|
+
pathPattern: "^$"
|
|
763
|
+
},
|
|
764
|
+
{
|
|
765
|
+
order: { type: "asc" },
|
|
766
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$"
|
|
767
|
+
},
|
|
768
|
+
{
|
|
769
|
+
order: { type: "asc" },
|
|
770
|
+
pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
order: ["types", "import", "require", "default"],
|
|
774
|
+
pathPattern: "^exports.*$"
|
|
775
|
+
}
|
|
776
|
+
]
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
];
|
|
780
|
+
}
|
|
781
|
+
async function sortTsconfig() {
|
|
782
|
+
return [
|
|
783
|
+
{
|
|
784
|
+
name: "eslint:sort-tsconfig",
|
|
785
|
+
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
786
|
+
rules: {
|
|
787
|
+
"jsonc/sort-keys": [
|
|
788
|
+
"error",
|
|
789
|
+
{
|
|
790
|
+
order: [
|
|
791
|
+
"extends",
|
|
792
|
+
"compilerOptions",
|
|
793
|
+
"references",
|
|
794
|
+
"files",
|
|
795
|
+
"include",
|
|
796
|
+
"exclude"
|
|
797
|
+
],
|
|
798
|
+
pathPattern: "^$"
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
order: [
|
|
802
|
+
/* Projects */
|
|
803
|
+
"incremental",
|
|
804
|
+
"composite",
|
|
805
|
+
"tsBuildInfoFile",
|
|
806
|
+
"disableSourceOfProjectReferenceRedirect",
|
|
807
|
+
"disableSolutionSearching",
|
|
808
|
+
"disableReferencedProjectLoad",
|
|
809
|
+
/* Language and Environment */
|
|
810
|
+
"target",
|
|
811
|
+
"jsx",
|
|
812
|
+
"jsxFactory",
|
|
813
|
+
"jsxFragmentFactory",
|
|
814
|
+
"jsxImportSource",
|
|
815
|
+
"lib",
|
|
816
|
+
"moduleDetection",
|
|
817
|
+
"noLib",
|
|
818
|
+
"reactNamespace",
|
|
819
|
+
"useDefineForClassFields",
|
|
820
|
+
"emitDecoratorMetadata",
|
|
821
|
+
"experimentalDecorators",
|
|
822
|
+
/* Modules */
|
|
823
|
+
"baseUrl",
|
|
824
|
+
"rootDir",
|
|
825
|
+
"rootDirs",
|
|
826
|
+
"customConditions",
|
|
827
|
+
"module",
|
|
828
|
+
"moduleResolution",
|
|
829
|
+
"moduleSuffixes",
|
|
830
|
+
"noResolve",
|
|
831
|
+
"paths",
|
|
832
|
+
"resolveJsonModule",
|
|
833
|
+
"resolvePackageJsonExports",
|
|
834
|
+
"resolvePackageJsonImports",
|
|
835
|
+
"typeRoots",
|
|
836
|
+
"types",
|
|
837
|
+
"allowArbitraryExtensions",
|
|
838
|
+
"allowImportingTsExtensions",
|
|
839
|
+
"allowUmdGlobalAccess",
|
|
840
|
+
/* JavaScript Support */
|
|
841
|
+
"allowJs",
|
|
842
|
+
"checkJs",
|
|
843
|
+
"maxNodeModuleJsDepth",
|
|
844
|
+
/* Type Checking */
|
|
845
|
+
"strict",
|
|
846
|
+
"strictBindCallApply",
|
|
847
|
+
"strictFunctionTypes",
|
|
848
|
+
"strictNullChecks",
|
|
849
|
+
"strictPropertyInitialization",
|
|
850
|
+
"allowUnreachableCode",
|
|
851
|
+
"allowUnusedLabels",
|
|
852
|
+
"alwaysStrict",
|
|
853
|
+
"exactOptionalPropertyTypes",
|
|
854
|
+
"noFallthroughCasesInSwitch",
|
|
855
|
+
"noImplicitAny",
|
|
856
|
+
"noImplicitOverride",
|
|
857
|
+
"noImplicitReturns",
|
|
858
|
+
"noImplicitThis",
|
|
859
|
+
"noPropertyAccessFromIndexSignature",
|
|
860
|
+
"noUncheckedIndexedAccess",
|
|
861
|
+
"noUnusedLocals",
|
|
862
|
+
"noUnusedParameters",
|
|
863
|
+
"useUnknownInCatchVariables",
|
|
864
|
+
/* Emit */
|
|
865
|
+
"declaration",
|
|
866
|
+
"declarationDir",
|
|
867
|
+
"declarationMap",
|
|
868
|
+
"downlevelIteration",
|
|
869
|
+
"emitBOM",
|
|
870
|
+
"emitDeclarationOnly",
|
|
871
|
+
"importHelpers",
|
|
872
|
+
"importsNotUsedAsValues",
|
|
873
|
+
"inlineSourceMap",
|
|
874
|
+
"inlineSources",
|
|
875
|
+
"mapRoot",
|
|
876
|
+
"newLine",
|
|
877
|
+
"noEmit",
|
|
878
|
+
"noEmitHelpers",
|
|
879
|
+
"noEmitOnError",
|
|
880
|
+
"outDir",
|
|
881
|
+
"outFile",
|
|
882
|
+
"preserveConstEnums",
|
|
883
|
+
"preserveValueImports",
|
|
884
|
+
"removeComments",
|
|
885
|
+
"sourceMap",
|
|
886
|
+
"sourceRoot",
|
|
887
|
+
"stripInternal",
|
|
888
|
+
/* Interop Constraints */
|
|
889
|
+
"allowSyntheticDefaultImports",
|
|
890
|
+
"esModuleInterop",
|
|
891
|
+
"forceConsistentCasingInFileNames",
|
|
892
|
+
"isolatedModules",
|
|
893
|
+
"preserveSymlinks",
|
|
894
|
+
"verbatimModuleSyntax",
|
|
895
|
+
/* Completeness */
|
|
896
|
+
"skipDefaultLibCheck",
|
|
897
|
+
"skipLibCheck"
|
|
898
|
+
],
|
|
899
|
+
pathPattern: "^compilerOptions$"
|
|
900
|
+
}
|
|
901
|
+
]
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
];
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
// src/configs/typescript.ts
|
|
908
|
+
var import_node_process = __toESM(require("process"), 1);
|
|
909
|
+
var typeAwareRules = {
|
|
910
|
+
"dot-notation": "off",
|
|
911
|
+
"no-implied-eval": "off",
|
|
912
|
+
"no-throw-literal": "off",
|
|
913
|
+
"@typescript-eslint/await-thenable": "error",
|
|
914
|
+
"@typescript-eslint/dot-notation": ["error", { allowKeywords: true }],
|
|
915
|
+
"@typescript-eslint/no-floating-promises": "error",
|
|
916
|
+
"@typescript-eslint/no-for-in-array": "error",
|
|
917
|
+
"@typescript-eslint/no-implied-eval": "error",
|
|
918
|
+
"@typescript-eslint/no-misused-promises": "error",
|
|
919
|
+
"@typescript-eslint/no-throw-literal": "error",
|
|
920
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
921
|
+
"@typescript-eslint/no-unsafe-argument": "error",
|
|
922
|
+
"@typescript-eslint/no-unsafe-assignment": "error",
|
|
923
|
+
"@typescript-eslint/no-unsafe-call": "error",
|
|
924
|
+
"@typescript-eslint/no-unsafe-member-access": "error",
|
|
925
|
+
"@typescript-eslint/no-unsafe-return": "error",
|
|
926
|
+
"@typescript-eslint/restrict-plus-operands": "error",
|
|
927
|
+
"@typescript-eslint/restrict-template-expressions": "error",
|
|
928
|
+
"@typescript-eslint/unbound-method": "error"
|
|
929
|
+
};
|
|
930
|
+
var typescript = async (options) => {
|
|
931
|
+
const {
|
|
932
|
+
overrides = {},
|
|
933
|
+
componentExts = [],
|
|
934
|
+
parserOptions = {},
|
|
935
|
+
tsconfigPath
|
|
936
|
+
} = options ?? {};
|
|
937
|
+
const [pluginTs, parserTs] = await Promise.all([
|
|
938
|
+
interopDefault(import("@typescript-eslint/eslint-plugin")),
|
|
939
|
+
interopDefault(import("@typescript-eslint/parser"))
|
|
940
|
+
]);
|
|
941
|
+
return [
|
|
942
|
+
{
|
|
943
|
+
// Install the plugins without globs, so they can be configured separately.
|
|
944
|
+
name: "eslint:typescript:setup",
|
|
945
|
+
plugins: {
|
|
946
|
+
"@typescript-eslint": pluginTs
|
|
947
|
+
}
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
name: "eslint:typescript:rules",
|
|
951
|
+
files: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],
|
|
952
|
+
languageOptions: {
|
|
953
|
+
parser: parserTs,
|
|
954
|
+
parserOptions: {
|
|
955
|
+
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
956
|
+
sourceType: "module",
|
|
957
|
+
...tsconfigPath ? {
|
|
958
|
+
project: [tsconfigPath],
|
|
959
|
+
tsconfigRootDir: import_node_process.default.cwd()
|
|
960
|
+
} : {},
|
|
961
|
+
...parserOptions
|
|
962
|
+
}
|
|
963
|
+
},
|
|
964
|
+
rules: {
|
|
965
|
+
...pluginTs.configs["eslint-recommended"].overrides[0].rules,
|
|
966
|
+
...pluginTs.configs.strict.rules,
|
|
967
|
+
"no-dupe-class-members": "off",
|
|
968
|
+
"no-invalid-this": "off",
|
|
969
|
+
"no-loss-of-precision": "off",
|
|
970
|
+
"no-redeclare": "off",
|
|
971
|
+
"no-use-before-define": "off",
|
|
972
|
+
"no-useless-constructor": "off",
|
|
973
|
+
"@typescript-eslint/ban-ts-comment": [
|
|
974
|
+
"error",
|
|
975
|
+
{ "ts-ignore": "allow-with-description" }
|
|
976
|
+
],
|
|
977
|
+
"@typescript-eslint/ban-types": [
|
|
978
|
+
"error",
|
|
979
|
+
{ types: { Function: false } }
|
|
980
|
+
],
|
|
981
|
+
"@typescript-eslint/consistent-type-definitions": [
|
|
982
|
+
"error",
|
|
983
|
+
"interface"
|
|
984
|
+
],
|
|
985
|
+
"@typescript-eslint/consistent-type-imports": [
|
|
986
|
+
"error",
|
|
987
|
+
{ disallowTypeAnnotations: false, prefer: "type-imports" }
|
|
988
|
+
],
|
|
989
|
+
"@typescript-eslint/no-dupe-class-members": "error",
|
|
990
|
+
"@typescript-eslint/no-dynamic-delete": "off",
|
|
991
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
992
|
+
"@typescript-eslint/no-extraneous-class": "off",
|
|
993
|
+
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
994
|
+
"@typescript-eslint/no-invalid-this": "error",
|
|
995
|
+
"@typescript-eslint/no-invalid-void-type": "off",
|
|
996
|
+
"@typescript-eslint/no-loss-of-precision": "error",
|
|
997
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
998
|
+
"@typescript-eslint/no-redeclare": "error",
|
|
999
|
+
"@typescript-eslint/no-require-imports": "error",
|
|
1000
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
1001
|
+
"@typescript-eslint/no-use-before-define": [
|
|
1002
|
+
"error",
|
|
1003
|
+
{ classes: false, functions: false, variables: true }
|
|
1004
|
+
],
|
|
1005
|
+
"@typescript-eslint/no-useless-constructor": "off",
|
|
1006
|
+
"@typescript-eslint/prefer-ts-expect-error": "error",
|
|
1007
|
+
"@typescript-eslint/triple-slash-reference": "off",
|
|
1008
|
+
"@typescript-eslint/unified-signatures": "off",
|
|
1009
|
+
...tsconfigPath ? typeAwareRules : {},
|
|
1010
|
+
...overrides
|
|
1011
|
+
}
|
|
1012
|
+
},
|
|
1013
|
+
{
|
|
1014
|
+
name: "eslint:typescript:dts-overrides",
|
|
1015
|
+
files: ["**/*.d.ts"],
|
|
1016
|
+
rules: {
|
|
1017
|
+
"eslint-comments/no-unlimited-disable": "off",
|
|
1018
|
+
"import/no-duplicates": "off",
|
|
1019
|
+
"no-restricted-syntax": "off",
|
|
1020
|
+
"unused-imports/no-unused-vars": "off"
|
|
1021
|
+
}
|
|
1022
|
+
},
|
|
1023
|
+
{
|
|
1024
|
+
name: "eslint:typescript:tests-overrides",
|
|
1025
|
+
files: ["**/*.{test,spec}.ts?(x)"],
|
|
1026
|
+
rules: {
|
|
1027
|
+
"no-unused-expressions": "off"
|
|
1028
|
+
}
|
|
1029
|
+
},
|
|
1030
|
+
{
|
|
1031
|
+
files: ["**/*.js", "**/*.cjs"],
|
|
1032
|
+
name: "eslint:typescript:javascript-overrides",
|
|
1033
|
+
rules: {
|
|
1034
|
+
"@typescript-eslint/no-require-imports": "off",
|
|
1035
|
+
"@typescript-eslint/no-var-requires": "off"
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
];
|
|
1039
|
+
};
|
|
1040
|
+
|
|
1041
|
+
// src/configs/unicorn.ts
|
|
1042
|
+
async function unicorn() {
|
|
1043
|
+
const pluginUnicorn = await interopDefault(import("eslint-plugin-unicorn"));
|
|
1044
|
+
return [
|
|
1045
|
+
{
|
|
1046
|
+
name: "eslint:unicorn",
|
|
1047
|
+
plugins: {
|
|
1048
|
+
unicorn: pluginUnicorn
|
|
1049
|
+
},
|
|
1050
|
+
rules: {
|
|
1051
|
+
// Pass error message when throwing errors
|
|
1052
|
+
"unicorn/error-message": "error",
|
|
1053
|
+
// Uppercase regex escapes
|
|
1054
|
+
"unicorn/escape-case": "error",
|
|
1055
|
+
// Array.isArray instead of instanceof
|
|
1056
|
+
"unicorn/no-instanceof-array": "error",
|
|
1057
|
+
// Ban `new Array` as `Array` constructor's params are ambiguous
|
|
1058
|
+
"unicorn/no-new-array": "error",
|
|
1059
|
+
// Prevent deprecated `new Buffer()`
|
|
1060
|
+
"unicorn/no-new-buffer": "error",
|
|
1061
|
+
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
1062
|
+
"unicorn/number-literal-case": "error",
|
|
1063
|
+
// textContent instead of innerText
|
|
1064
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
1065
|
+
// includes over indexOf when checking for existence
|
|
1066
|
+
"unicorn/prefer-includes": "error",
|
|
1067
|
+
// Prefer using the node: protocol
|
|
1068
|
+
"unicorn/prefer-node-protocol": "error",
|
|
1069
|
+
// Prefer using number properties like `Number.isNaN` rather than `isNaN`
|
|
1070
|
+
"unicorn/prefer-number-properties": "error",
|
|
1071
|
+
// String methods startsWith/endsWith instead of more complicated stuff
|
|
1072
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1073
|
+
// Enforce throwing type error when throwing error while checking typeof
|
|
1074
|
+
"unicorn/prefer-type-error": "error",
|
|
1075
|
+
// Use new when throwing error
|
|
1076
|
+
"unicorn/throw-new-error": "error"
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
];
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
// src/configs/vue.ts
|
|
1083
|
+
var vue = async (options = {}) => {
|
|
1084
|
+
const { overrides = {}, typescript: isTypescript } = options;
|
|
1085
|
+
const [pluginVue, parserVue] = await Promise.all([
|
|
1086
|
+
// @ts-expect-error missing types
|
|
1087
|
+
interopDefault(import("eslint-plugin-vue")),
|
|
1088
|
+
interopDefault(import("vue-eslint-parser"))
|
|
1089
|
+
]);
|
|
1090
|
+
return [
|
|
1091
|
+
{
|
|
1092
|
+
name: "eslint:vue:setup",
|
|
1093
|
+
plugins: {
|
|
1094
|
+
vue: pluginVue
|
|
1095
|
+
}
|
|
1096
|
+
},
|
|
1097
|
+
{
|
|
1098
|
+
name: "eslint:vue:rules",
|
|
1099
|
+
files: [GLOB_VUE],
|
|
1100
|
+
languageOptions: {
|
|
1101
|
+
parser: parserVue,
|
|
1102
|
+
parserOptions: {
|
|
1103
|
+
ecmaFeatures: {
|
|
1104
|
+
jsx: true
|
|
1105
|
+
},
|
|
1106
|
+
extraFileExtensions: [".vue"],
|
|
1107
|
+
parser: isTypescript ? await interopDefault(
|
|
1108
|
+
import("@typescript-eslint/parser")
|
|
1109
|
+
) : null,
|
|
1110
|
+
sourceType: "module"
|
|
1111
|
+
}
|
|
1112
|
+
},
|
|
1113
|
+
processor: pluginVue.processors[".vue"],
|
|
1114
|
+
rules: {
|
|
1115
|
+
...pluginVue.configs.base.rules,
|
|
1116
|
+
...pluginVue.configs["vue3-essential"].rules,
|
|
1117
|
+
...pluginVue.configs["vue3-strongly-recommended"].rules,
|
|
1118
|
+
...pluginVue.configs["vue3-recommended"].rules,
|
|
1119
|
+
"node/prefer-global/process": "off",
|
|
1120
|
+
"vue/block-order": [
|
|
1121
|
+
"error",
|
|
1122
|
+
{
|
|
1123
|
+
order: ["script", "template", "style"]
|
|
1124
|
+
}
|
|
1125
|
+
],
|
|
1126
|
+
"vue/component-name-in-template-casing": [
|
|
1127
|
+
"error",
|
|
1128
|
+
"PascalCase",
|
|
1129
|
+
{
|
|
1130
|
+
registeredComponentsOnly: false
|
|
1131
|
+
}
|
|
1132
|
+
],
|
|
1133
|
+
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1134
|
+
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
1135
|
+
"vue/define-macros-order": [
|
|
1136
|
+
"error",
|
|
1137
|
+
{
|
|
1138
|
+
order: [
|
|
1139
|
+
"defineOptions",
|
|
1140
|
+
"defineProps",
|
|
1141
|
+
"defineEmits",
|
|
1142
|
+
"defineSlots"
|
|
1143
|
+
]
|
|
1144
|
+
}
|
|
1145
|
+
],
|
|
1146
|
+
"vue/dot-location": ["error", "property"],
|
|
1147
|
+
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1148
|
+
"vue/eqeqeq": ["error", "smart"],
|
|
1149
|
+
"vue/html-indent": ["error", 2],
|
|
1150
|
+
"vue/html-quotes": ["error", "double"],
|
|
1151
|
+
"vue/max-attributes-per-line": "off",
|
|
1152
|
+
"vue/multi-word-component-names": "off",
|
|
1153
|
+
"vue/no-dupe-keys": "off",
|
|
1154
|
+
"vue/no-empty-pattern": "error",
|
|
1155
|
+
"vue/no-irregular-whitespace": "error",
|
|
1156
|
+
"vue/no-loss-of-precision": "error",
|
|
1157
|
+
"vue/no-restricted-syntax": [
|
|
1158
|
+
"error",
|
|
1159
|
+
"DebuggerStatement",
|
|
1160
|
+
"LabeledStatement",
|
|
1161
|
+
"WithStatement"
|
|
1162
|
+
],
|
|
1163
|
+
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
1164
|
+
"vue/no-setup-props-reactivity-loss": "off",
|
|
1165
|
+
"vue/no-sparse-arrays": "error",
|
|
1166
|
+
"vue/no-unused-refs": "error",
|
|
1167
|
+
"vue/no-useless-v-bind": "error",
|
|
1168
|
+
"vue/no-v-html": "off",
|
|
1169
|
+
"vue/object-shorthand": [
|
|
1170
|
+
"error",
|
|
1171
|
+
"always",
|
|
1172
|
+
{
|
|
1173
|
+
avoidQuotes: true,
|
|
1174
|
+
ignoreConstructors: false
|
|
1175
|
+
}
|
|
1176
|
+
],
|
|
1177
|
+
"vue/prefer-separate-static-class": "error",
|
|
1178
|
+
"vue/prefer-template": "error",
|
|
1179
|
+
"vue/require-default-prop": "off",
|
|
1180
|
+
"vue/require-prop-types": "off",
|
|
1181
|
+
"vue/space-infix-ops": "error",
|
|
1182
|
+
"vue/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
1183
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
|
1184
|
+
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1185
|
+
"vue/block-spacing": ["error", "always"],
|
|
1186
|
+
"vue/block-tag-newline": [
|
|
1187
|
+
"error",
|
|
1188
|
+
{
|
|
1189
|
+
multiline: "always",
|
|
1190
|
+
singleline: "always"
|
|
1191
|
+
}
|
|
1192
|
+
],
|
|
1193
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1194
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1195
|
+
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1196
|
+
"vue/comma-style": ["error", "last"],
|
|
1197
|
+
"vue/html-comment-content-spacing": [
|
|
1198
|
+
"error",
|
|
1199
|
+
"always",
|
|
1200
|
+
{
|
|
1201
|
+
exceptions: ["-"]
|
|
1202
|
+
}
|
|
1203
|
+
],
|
|
1204
|
+
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1205
|
+
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1206
|
+
"vue/object-curly-newline": "off",
|
|
1207
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
1208
|
+
"vue/object-property-newline": [
|
|
1209
|
+
"error",
|
|
1210
|
+
{ allowMultiplePropertiesPerLine: true }
|
|
1211
|
+
],
|
|
1212
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
1213
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1214
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1215
|
+
"vue/space-in-parens": ["error", "never"],
|
|
1216
|
+
"vue/template-curly-spacing": "error",
|
|
1217
|
+
...overrides
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
];
|
|
1221
|
+
};
|
|
1222
|
+
|
|
1223
|
+
// src/configs/yml.ts
|
|
1224
|
+
var yml = async (options) => {
|
|
1225
|
+
const { overrides = {} } = options;
|
|
1226
|
+
const [pluginYml, parserYml] = await Promise.all([
|
|
1227
|
+
interopDefault(import("eslint-plugin-yml")),
|
|
1228
|
+
interopDefault(import("yaml-eslint-parser"))
|
|
1229
|
+
]);
|
|
1230
|
+
return [
|
|
1231
|
+
{
|
|
1232
|
+
name: "eslint:yaml:setup",
|
|
1233
|
+
plugins: {
|
|
1234
|
+
yml: pluginYml
|
|
1235
|
+
}
|
|
1236
|
+
},
|
|
1237
|
+
{
|
|
1238
|
+
name: "eslint:yaml:rules",
|
|
1239
|
+
files: [GLOB_YAML],
|
|
1240
|
+
languageOptions: {
|
|
1241
|
+
parser: parserYml
|
|
1242
|
+
},
|
|
1243
|
+
rules: {
|
|
1244
|
+
...pluginYml.configs.standard.rules,
|
|
1245
|
+
...pluginYml.configs.prettier.rules,
|
|
1246
|
+
"yml/block-mapping": "error",
|
|
1247
|
+
"yml/block-sequence": "error",
|
|
1248
|
+
"yml/no-empty-key": "error",
|
|
1249
|
+
"yml/no-empty-sequence-entry": "error",
|
|
1250
|
+
"yml/no-irregular-whitespace": "error",
|
|
1251
|
+
"yml/plain-scalar": "error",
|
|
1252
|
+
"yml/vue-custom-block/no-parsing-error": "error",
|
|
1253
|
+
"yml/spaced-comment": "error",
|
|
1254
|
+
...overrides
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
];
|
|
1258
|
+
};
|
|
1259
|
+
|
|
1260
|
+
// src/configs/toml.ts
|
|
1261
|
+
var toml = async (options) => {
|
|
1262
|
+
const { overrides = {} } = options;
|
|
1263
|
+
const [pluginToml, parserToml] = await Promise.all([
|
|
1264
|
+
interopDefault(import("eslint-plugin-toml")),
|
|
1265
|
+
interopDefault(import("toml-eslint-parser"))
|
|
1266
|
+
]);
|
|
1267
|
+
return [
|
|
1268
|
+
{
|
|
1269
|
+
name: "eslint:toml:setup",
|
|
1270
|
+
plugins: {
|
|
1271
|
+
toml: pluginToml
|
|
1272
|
+
}
|
|
1273
|
+
},
|
|
1274
|
+
{
|
|
1275
|
+
name: "eslint:toml:rules",
|
|
1276
|
+
files: [GLOB_TOML],
|
|
1277
|
+
languageOptions: {
|
|
1278
|
+
parser: parserToml
|
|
1279
|
+
},
|
|
1280
|
+
rules: {
|
|
1281
|
+
"toml/comma-style": "error",
|
|
1282
|
+
"toml/keys-order": "error",
|
|
1283
|
+
"toml/no-space-dots": "error",
|
|
1284
|
+
"toml/no-unreadable-number-separator": "error",
|
|
1285
|
+
"toml/precision-of-fractional-seconds": "error",
|
|
1286
|
+
"toml/precision-of-integer": "error",
|
|
1287
|
+
"toml/tables-order": "error",
|
|
1288
|
+
"toml/vue-custom-block/no-parsing-error": "error",
|
|
1289
|
+
"toml/array-bracket-newline": "error",
|
|
1290
|
+
"toml/array-bracket-spacing": "error",
|
|
1291
|
+
"toml/array-element-newline": "error",
|
|
1292
|
+
"toml/indent": ["error", 2],
|
|
1293
|
+
"toml/inline-table-curly-spacing": "error",
|
|
1294
|
+
"toml/key-spacing": "error",
|
|
1295
|
+
"toml/padding-line-between-pairs": "error",
|
|
1296
|
+
"toml/padding-line-between-tables": "error",
|
|
1297
|
+
"toml/quoted-keys": "error",
|
|
1298
|
+
"toml/spaced-comment": "error",
|
|
1299
|
+
"toml/table-bracket-spacing": "error",
|
|
1300
|
+
...overrides
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
];
|
|
1304
|
+
};
|
|
1305
|
+
|
|
1306
|
+
// src/configs/test.ts
|
|
1307
|
+
var test = async (options) => {
|
|
1308
|
+
const { overrides = {} } = options;
|
|
1309
|
+
const [pluginVitest, pluginNoOnlyTests] = await Promise.all([
|
|
1310
|
+
interopDefault(import("eslint-plugin-vitest")),
|
|
1311
|
+
// @ts-expect-error missing types
|
|
1312
|
+
interopDefault(import("eslint-plugin-no-only-tests"))
|
|
1313
|
+
]);
|
|
1314
|
+
return [
|
|
1315
|
+
{
|
|
1316
|
+
name: "eslint:test:setup",
|
|
1317
|
+
plugins: {
|
|
1318
|
+
test: {
|
|
1319
|
+
...pluginVitest,
|
|
1320
|
+
rules: {
|
|
1321
|
+
...pluginVitest.rules,
|
|
1322
|
+
// extend `test/no-only-tests` rule
|
|
1323
|
+
...pluginNoOnlyTests.rules
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
},
|
|
1328
|
+
{
|
|
1329
|
+
name: "eslint:test:rules",
|
|
1330
|
+
files: GLOB_TESTS,
|
|
1331
|
+
rules: {
|
|
1332
|
+
"test/consistent-test-it": [
|
|
1333
|
+
"error",
|
|
1334
|
+
{ fn: "it", withinDescribe: "it" }
|
|
1335
|
+
],
|
|
1336
|
+
"test/no-identical-title": "error",
|
|
1337
|
+
"test/no-only-tests": "error",
|
|
1338
|
+
"test/prefer-hooks-in-order": "error",
|
|
1339
|
+
"test/prefer-lowercase-title": "error",
|
|
1340
|
+
...overrides
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
];
|
|
1344
|
+
};
|
|
1345
|
+
|
|
1346
|
+
// src/configs/perfectionist.ts
|
|
1347
|
+
async function perfectionist() {
|
|
1348
|
+
const pluginPerfectionist = await interopDefault(
|
|
1349
|
+
// @ts-expect-error missing types
|
|
1350
|
+
import("eslint-plugin-perfectionist")
|
|
1351
|
+
);
|
|
1352
|
+
return [
|
|
1353
|
+
{
|
|
1354
|
+
name: "eslint:perfectionist",
|
|
1355
|
+
plugins: {
|
|
1356
|
+
perfectionist: pluginPerfectionist
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
];
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
// src/configs/prettier.ts
|
|
1363
|
+
var prettier = async (options) => {
|
|
1364
|
+
const [pluginPrettier, configPrettier, parserPlain] = await Promise.all([
|
|
1365
|
+
interopDefault(import("eslint-plugin-prettier")),
|
|
1366
|
+
// @ts-expect-error missing types
|
|
1367
|
+
interopDefault(import("eslint-config-prettier")),
|
|
1368
|
+
interopDefault(import("eslint-parser-plain"))
|
|
1369
|
+
]);
|
|
1370
|
+
const PlainFileRules = [
|
|
1371
|
+
{
|
|
1372
|
+
name: "eslint:prettier:markdown",
|
|
1373
|
+
files: [GLOB_MARKDOWN],
|
|
1374
|
+
parser: "markdown"
|
|
1375
|
+
},
|
|
1376
|
+
{
|
|
1377
|
+
name: "eslint:prettier:mdx",
|
|
1378
|
+
files: [GLOB_MDX],
|
|
1379
|
+
parser: "mdx"
|
|
1380
|
+
},
|
|
1381
|
+
{
|
|
1382
|
+
name: "eslint:prettier:html",
|
|
1383
|
+
files: ["**/*.html"],
|
|
1384
|
+
parser: "html"
|
|
1385
|
+
},
|
|
1386
|
+
{
|
|
1387
|
+
name: "eslint:prettier:css",
|
|
1388
|
+
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
1389
|
+
parser: "css"
|
|
1390
|
+
},
|
|
1391
|
+
{
|
|
1392
|
+
name: "eslint:prettier:scss",
|
|
1393
|
+
files: [GLOB_SCSS],
|
|
1394
|
+
parser: "scss"
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
name: "eslint:prettier:less",
|
|
1398
|
+
files: [GLOB_LESS],
|
|
1399
|
+
parser: "less"
|
|
1400
|
+
},
|
|
1401
|
+
{
|
|
1402
|
+
name: "eslint:prettier:yaml",
|
|
1403
|
+
files: [GLOB_YAML],
|
|
1404
|
+
parser: "yaml"
|
|
1405
|
+
},
|
|
1406
|
+
{
|
|
1407
|
+
name: "eslint:prettier:graphql",
|
|
1408
|
+
files: ["**/*.graphql"],
|
|
1409
|
+
parser: "graphql"
|
|
1410
|
+
}
|
|
1411
|
+
].map((rule) => ({
|
|
1412
|
+
name: rule.name,
|
|
1413
|
+
files: rule.files,
|
|
1414
|
+
languageOptions: {
|
|
1415
|
+
parser: parserPlain
|
|
1416
|
+
},
|
|
1417
|
+
rules: {
|
|
1418
|
+
"prettier/prettier": [
|
|
1419
|
+
"warn",
|
|
1420
|
+
{
|
|
1421
|
+
parser: rule.parser,
|
|
1422
|
+
quoteProps: "consistent",
|
|
1423
|
+
...options
|
|
1424
|
+
}
|
|
1425
|
+
]
|
|
1426
|
+
}
|
|
1427
|
+
}));
|
|
1428
|
+
return [
|
|
1429
|
+
{
|
|
1430
|
+
name: "eslint:prettier:setup",
|
|
1431
|
+
plugins: {
|
|
1432
|
+
prettier: pluginPrettier
|
|
1433
|
+
}
|
|
1434
|
+
},
|
|
1435
|
+
{
|
|
1436
|
+
name: "eslint:prettier:rules",
|
|
1437
|
+
ignores: [GLOB_TOML],
|
|
1438
|
+
rules: {
|
|
1439
|
+
...configPrettier.rules,
|
|
1440
|
+
...pluginPrettier.configs.recommended.rules,
|
|
1441
|
+
"prettier/prettier": [
|
|
1442
|
+
"warn",
|
|
1443
|
+
{
|
|
1444
|
+
quoteProps: "consistent",
|
|
1445
|
+
...options
|
|
1446
|
+
}
|
|
1447
|
+
]
|
|
1448
|
+
}
|
|
1449
|
+
},
|
|
1450
|
+
...PlainFileRules
|
|
1451
|
+
];
|
|
1452
|
+
};
|
|
1453
|
+
|
|
1454
|
+
// src/configs/react.ts
|
|
1455
|
+
async function next() {
|
|
1456
|
+
const pluginNext = await interopDefault(import("@next/eslint-plugin-next"));
|
|
1457
|
+
return [
|
|
1458
|
+
{
|
|
1459
|
+
name: "eslint:next:setup",
|
|
1460
|
+
plugins: {
|
|
1461
|
+
"@next/next": pluginNext
|
|
1462
|
+
}
|
|
1463
|
+
},
|
|
1464
|
+
{
|
|
1465
|
+
name: "eslint:next:rules",
|
|
1466
|
+
files: [GLOB_TSX, GLOB_JSX],
|
|
1467
|
+
languageOptions: {
|
|
1468
|
+
parserOptions: {
|
|
1469
|
+
sourceType: "module",
|
|
1470
|
+
ecmaFeatures: {
|
|
1471
|
+
jsx: true
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
},
|
|
1475
|
+
settings: {
|
|
1476
|
+
react: {
|
|
1477
|
+
version: "detect"
|
|
1478
|
+
}
|
|
1479
|
+
},
|
|
1480
|
+
rules: {
|
|
1481
|
+
...pluginNext.configs.recommended.rules,
|
|
1482
|
+
...pluginNext.configs["core-web-vitals"].rules
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
];
|
|
1486
|
+
}
|
|
1487
|
+
var react = async (options) => {
|
|
1488
|
+
const { next: enableNext = false, overrides = {} } = options;
|
|
1489
|
+
const [pluginReact, pluginReactHooks] = await Promise.all([
|
|
1490
|
+
// @ts-expect-error missing types
|
|
1491
|
+
interopDefault(import("eslint-plugin-react")),
|
|
1492
|
+
// @ts-expect-error missing types
|
|
1493
|
+
interopDefault(import("eslint-plugin-react-hooks"))
|
|
1494
|
+
]);
|
|
1495
|
+
const _react = [
|
|
1496
|
+
{
|
|
1497
|
+
name: "eslint:react:setup",
|
|
1498
|
+
plugins: {
|
|
1499
|
+
"react": pluginReact,
|
|
1500
|
+
"react-hooks": pluginReactHooks
|
|
1501
|
+
}
|
|
1502
|
+
},
|
|
1503
|
+
{
|
|
1504
|
+
name: "eslint:react:rules",
|
|
1505
|
+
files: [GLOB_TSX, GLOB_JSX],
|
|
1506
|
+
languageOptions: {
|
|
1507
|
+
parserOptions: {
|
|
1508
|
+
sourceType: "module",
|
|
1509
|
+
ecmaFeatures: {
|
|
1510
|
+
jsx: true
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
},
|
|
1514
|
+
settings: {
|
|
1515
|
+
react: {
|
|
1516
|
+
version: "detect"
|
|
1517
|
+
}
|
|
1518
|
+
},
|
|
1519
|
+
rules: {
|
|
1520
|
+
...pluginReact.configs.recommended.rules,
|
|
1521
|
+
...pluginReactHooks.configs.recommended.rules,
|
|
1522
|
+
"jsx-quotes": ["error", "prefer-double"],
|
|
1523
|
+
"react/react-in-jsx-scope": "off",
|
|
1524
|
+
"react/jsx-indent": [1, 2],
|
|
1525
|
+
"react/jsx-indent-props": [1, 2],
|
|
1526
|
+
"react/jsx-closing-bracket-location": [
|
|
1527
|
+
1,
|
|
1528
|
+
{ selfClosing: "tag-aligned", nonEmpty: "tag-aligned" }
|
|
1529
|
+
],
|
|
1530
|
+
...overrides
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
];
|
|
1534
|
+
return combine(_react, enableNext ? next() : []);
|
|
1535
|
+
};
|
|
1536
|
+
|
|
1537
|
+
// src/configs/tailwindcss.ts
|
|
1538
|
+
async function tailwindcss() {
|
|
1539
|
+
const pluginTailwindcss = await interopDefault(
|
|
1540
|
+
// @ts-expect-error missing types
|
|
1541
|
+
import("eslint-plugin-tailwindcss")
|
|
1542
|
+
);
|
|
1543
|
+
return [
|
|
1544
|
+
{
|
|
1545
|
+
name: "eslint:tailwindcss",
|
|
1546
|
+
plugins: {
|
|
1547
|
+
tailwindcss: pluginTailwindcss
|
|
1548
|
+
},
|
|
1549
|
+
rules: {
|
|
1550
|
+
...pluginTailwindcss.configs.recommended.rules
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
];
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
// src/factory.ts
|
|
1557
|
+
function getConfigOption(options) {
|
|
1558
|
+
return options ? typeof options !== "boolean" ? options : {} : {};
|
|
1559
|
+
}
|
|
1560
|
+
function config(options = {}) {
|
|
1561
|
+
const {
|
|
1562
|
+
ignores: enableGitignore = true,
|
|
1563
|
+
vue: enableVue,
|
|
1564
|
+
react: enableReact,
|
|
1565
|
+
typescript: enableTypeScript,
|
|
1566
|
+
tailwindcss: enableTailwindcss,
|
|
1567
|
+
componentExts = []
|
|
1568
|
+
} = options;
|
|
1569
|
+
const configs = [];
|
|
1570
|
+
configs.push(
|
|
1571
|
+
ignores(getConfigOption(enableGitignore)),
|
|
1572
|
+
javascript(options.javascript ?? {}),
|
|
1573
|
+
comments(),
|
|
1574
|
+
node(),
|
|
1575
|
+
jsdoc(),
|
|
1576
|
+
imports(),
|
|
1577
|
+
unicorn(),
|
|
1578
|
+
perfectionist()
|
|
1579
|
+
);
|
|
1580
|
+
if (enableVue)
|
|
1581
|
+
componentExts.push("vue");
|
|
1582
|
+
if (enableTypeScript) {
|
|
1583
|
+
configs.push(
|
|
1584
|
+
typescript({
|
|
1585
|
+
...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
|
|
1586
|
+
componentExts
|
|
1587
|
+
})
|
|
1588
|
+
);
|
|
1589
|
+
}
|
|
1590
|
+
if (options.test ?? true) {
|
|
1591
|
+
configs.push(test(getConfigOption(options.test)));
|
|
1592
|
+
}
|
|
1593
|
+
if (enableVue) {
|
|
1594
|
+
configs.push(
|
|
1595
|
+
vue({
|
|
1596
|
+
...getConfigOption(options.vue),
|
|
1597
|
+
typescript: !!enableTypeScript
|
|
1598
|
+
})
|
|
1599
|
+
);
|
|
1600
|
+
}
|
|
1601
|
+
if (enableReact) {
|
|
1602
|
+
configs.push(react(getConfigOption(enableReact)));
|
|
1603
|
+
}
|
|
1604
|
+
if (options.jsonc ?? true) {
|
|
1605
|
+
configs.push(
|
|
1606
|
+
jsonc(getConfigOption(options.jsonc)),
|
|
1607
|
+
sortPackageJson(),
|
|
1608
|
+
sortTsconfig()
|
|
1609
|
+
);
|
|
1610
|
+
}
|
|
1611
|
+
if (options.yml ?? true) {
|
|
1612
|
+
configs.push(yml(getConfigOption(options.yml)));
|
|
1613
|
+
}
|
|
1614
|
+
if (options.toml ?? true) {
|
|
1615
|
+
configs.push(toml(getConfigOption(options.toml)));
|
|
1616
|
+
}
|
|
1617
|
+
if (options.markdown ?? true) {
|
|
1618
|
+
configs.push(
|
|
1619
|
+
markdown({
|
|
1620
|
+
...getConfigOption(options.markdown),
|
|
1621
|
+
componentExts
|
|
1622
|
+
})
|
|
1623
|
+
);
|
|
1624
|
+
}
|
|
1625
|
+
if (enableTailwindcss) {
|
|
1626
|
+
configs.push(tailwindcss());
|
|
1627
|
+
}
|
|
1628
|
+
if (options.prettier ?? true) {
|
|
1629
|
+
configs.push(prettier(getConfigOption(options.prettier)));
|
|
1630
|
+
}
|
|
1631
|
+
const merged = combine(...configs, options.customConfig ?? []);
|
|
1632
|
+
return merged;
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
// src/index.ts
|
|
1636
|
+
var src_default = config;
|
|
1637
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1638
|
+
0 && (module.exports = {
|
|
1639
|
+
GLOB_ALL_SRC,
|
|
1640
|
+
GLOB_CSS,
|
|
1641
|
+
GLOB_EXCLUDE,
|
|
1642
|
+
GLOB_HTML,
|
|
1643
|
+
GLOB_JS,
|
|
1644
|
+
GLOB_JSON,
|
|
1645
|
+
GLOB_JSON5,
|
|
1646
|
+
GLOB_JSONC,
|
|
1647
|
+
GLOB_JSX,
|
|
1648
|
+
GLOB_LESS,
|
|
1649
|
+
GLOB_MARKDOWN,
|
|
1650
|
+
GLOB_MARKDOWN_CODE,
|
|
1651
|
+
GLOB_MDX,
|
|
1652
|
+
GLOB_POSTCSS,
|
|
1653
|
+
GLOB_SCSS,
|
|
1654
|
+
GLOB_SRC,
|
|
1655
|
+
GLOB_SRC_EXT,
|
|
1656
|
+
GLOB_STYLE,
|
|
1657
|
+
GLOB_TESTS,
|
|
1658
|
+
GLOB_TOML,
|
|
1659
|
+
GLOB_TS,
|
|
1660
|
+
GLOB_TSX,
|
|
1661
|
+
GLOB_VUE,
|
|
1662
|
+
GLOB_YAML,
|
|
1663
|
+
combine,
|
|
1664
|
+
comments,
|
|
1665
|
+
config,
|
|
1666
|
+
ignores,
|
|
1667
|
+
imports,
|
|
1668
|
+
interopDefault,
|
|
1669
|
+
javascript,
|
|
1670
|
+
jsdoc,
|
|
1671
|
+
jsonc,
|
|
1672
|
+
markdown,
|
|
1673
|
+
node,
|
|
1674
|
+
perfectionist,
|
|
1675
|
+
prettier,
|
|
1676
|
+
sortPackageJson,
|
|
1677
|
+
sortTsconfig,
|
|
1678
|
+
test,
|
|
1679
|
+
toml,
|
|
1680
|
+
typescript,
|
|
1681
|
+
unicorn,
|
|
1682
|
+
vue,
|
|
1683
|
+
yml
|
|
1684
|
+
});
|