@bassist/eslint
Version:
Flat ESLint config for JavaScript, TypeScript, Vue, React, Prettier and so on by @chengpeiquan .
10 lines (9 loc) • 10.2 kB
JavaScript
/**
* name: @bassist/eslint
* version: v0.7.1
* description: Flat ESLint config for JavaScript, TypeScript, Vue, React, Prettier and so on by @chengpeiquan .
* author: chengpeiquan <chengpeiquan@chengpeiquan.com>
* homepage: https://github.com/chengpeiquan/bassist/tree/eslint%400.7.0/packages/eslint
* license: MIT
*/
import{defineFlatConfig as A}from"eslint-define-config";import d from"eslint-plugin-import";import b from"eslint-plugin-antfu";var u="?([cm])[jt]s?(x)",t="**/*.?([cm])[jt]s?(x)",f="**/*.?([cm])js",m="**/*.?([cm])jsx",i="**/*.?([cm])ts",p="**/*.?([cm])tsx";var n="**/*.md",a="**/*.vue";var C="**/node_modules",_="**/dist",E=["**/package-lock.json","**/yarn.lock","**/pnpm-lock.yaml"],e=[C,_,...E,"**/output","**/coverage","**/temp","**/fixtures","**/.vitepress/cache","**/.nuxt","**/.vercel","**/.changeset","**/.idea","**/.output","**/.vite-inspect","**/.svelte-kit","**/CHANGELOG*.md","**/*.min.*","**/LICENSE*","**/__snapshots__","**/auto-import?(s).d.ts","**/components.d.ts"];var W=[{plugins:{import:d,antfu:b},settings:{"import/resolver":{node:{extensions:[".js",".mjs",".ts",".mts",".d.ts"]}}},rules:{"import/first":"error","import/no-mutable-exports":"error","import/no-duplicates":"error","import/order":["error",{groups:["builtin","external","internal","parent","sibling","index","object","type"],pathGroups:[{pattern:"@/**",group:"internal"}],pathGroupsExcludedImportTypes:["type"]}],"import/no-default-export":"error","antfu/import-dedupe":"error","antfu/prefer-inline-type-import":"error"}},{files:[`**/*config*.${u}`,`**/views/${t}`,`**/pages/${t}`,"**/{index,vite,esbuild,rollup,webpack,rspack}.ts","**/*.d.ts",`${n}/**`],plugins:{import:d},rules:{"import/no-default-export":"off"}}];import c from"globals";import G from"@eslint/js";var z=[G.configs.recommended,{languageOptions:{globals:{...c.browser,...c.es2021,...c.node},sourceType:"module"},rules:{"no-unused-vars":["error",{args:"none",ignoreRestSiblings:!0}],"no-constant-condition":"warn","no-debugger":"warn","no-console":["warn",{allow:["warn","error"]}],"no-restricted-syntax":["error","ForInStatement","LabeledStatement","WithStatement"],"no-return-await":"warn","no-empty":["error",{allowEmptyCatch:!0}],"sort-imports":["error",{ignoreCase:!1,ignoreDeclarationSort:!0,ignoreMemberSort:!1,memberSyntaxSortOrder:["none","all","multiple","single"],allowSeparatedGroups:!1}],"dot-notation":"warn","no-var":"error","prefer-const":["warn",{destructuring:"all",ignoreReadBeforeAssign:!0}],"prefer-arrow-callback":["error",{allowNamedFunctions:!1,allowUnboundThis:!0}],"object-shorthand":["error","always",{ignoreConstructors:!1,avoidQuotes:!0}],"prefer-rest-params":"error","prefer-spread":"error","prefer-template":"error","require-await":"error","array-callback-return":"error","block-scoped-var":"error",eqeqeq:["error","smart"],"no-alert":"warn","no-case-declarations":"error","no-fallthrough":["warn",{commentPattern:"break[\\s\\w]*omitted"}],"no-multi-str":"error","no-with":"error","no-void":"error","no-duplicate-imports":"error","no-unused-expressions":["error",{allowShortCircuit:!0,allowTernary:!0,allowTaggedTemplates:!0}],"no-lonely-if":"error","prefer-exponentiation-operator":"error"}},{files:["**/scripts/*","**/cli.*"],rules:{"no-console":"off"}},{files:["**/*.{test,spec}.js?(x)"],rules:{"no-unused-expressions":"off"}}],Z=[{files:["**/*.jsx"],languageOptions:{parserOptions:{ecmaFeatures:{jsx:!0}}}}];import x from"eslint-plugin-markdown";import B from"@typescript-eslint/parser";import o from"@typescript-eslint/eslint-plugin";var s=B;var g=o.configs,h=g["eslint-recommended"],l=[{files:[i,p],languageOptions:{parser:s,parserOptions:{sourceType:"module"}},plugins:{"@typescript-eslint":o},rules:{...h.overrides[0].rules,...g.strict.rules,"@typescript-eslint/no-redeclare":"error","@typescript-eslint/ban-ts-comment":"off","@typescript-eslint/ban-types":"off","@typescript-eslint/consistent-type-imports":["error",{fixStyle:"inline-type-imports",disallowTypeAnnotations:!1}],"@typescript-eslint/no-explicit-any":"off","@typescript-eslint/no-non-null-assertion":"off","@typescript-eslint/prefer-as-const":"warn"}},{files:["**/*.d.ts"],rules:{"import/no-duplicates":"off"}},{files:["**/*.{test,spec}.ts?(x)"],rules:{"no-unused-expressions":"off"}},{files:["**/*.js","**/*.cjs"],rules:{"@typescript-eslint/no-var-requires":"off"}}];var ar=[{files:[n],plugins:{markdown:x},processor:"markdown/markdown"},{files:[`${n}/${t}`,`${n}/${a}`],languageOptions:{parserOptions:{ecmaFeatures:{impliedStrict:!0}}},plugins:{"@typescript-eslint":o},rules:{...x.configs.recommended.overrides[1].rules,"@typescript-eslint/no-redeclare":"off","@typescript-eslint/no-unused-vars":"off","@typescript-eslint/no-use-before-define":"off","@typescript-eslint/no-var-requires":"off","@typescript-eslint/no-extraneous-class":"off","no-alert":"off","no-console":"off","no-restricted-imports":"off","no-undef":"off","no-unused-expressions":"off","no-unused-vars":"off"},ignores:[...e]}];import y from"eslint-plugin-prettier";import F from"eslint-config-prettier";var mr=[{plugins:{prettier:y},rules:{...F.rules,...y.configs.recommended.rules,"prettier/prettier":"warn"},ignores:[...e]}];import R from"globals";import L from"eslint-plugin-react";import v from"eslint-plugin-react-hooks";import k from"eslint-plugin-react-refresh";var j={"react/jsx-uses-react":"error","react/jsx-uses-vars":"error"},Or=[{settings:{react:{version:"detect"}},files:[f,m,i,p],plugins:{react:L,"react-hooks":v,"react-refresh":k,"@typescript-eslint":o},languageOptions:{ecmaVersion:"latest",parser:s,parserOptions:{sourceType:"module",ecmaFeatures:{jsx:!0}},globals:{...R.browser}},rules:{...l[0].rules,...L.configs.recommended.rules,...v.configs.recommended.rules,...j},ignores:[...e]}];import T from"eslint-plugin-unicorn";var _r=[{plugins:{unicorn:T},rules:{"unicorn/better-regex":"error","unicorn/catch-error-name":"error","unicorn/custom-error-definition":"error","unicorn/error-message":"error","unicorn/escape-case":"error","unicorn/explicit-length-check":"error","unicorn/filename-case":["error",{cases:{kebabCase:!0,pascalCase:!0},ignore:[/^[A-Z]+\..*$/]}],"unicorn/new-for-builtins":"error","unicorn/no-array-callback-reference":"error","unicorn/no-array-method-this-argument":"error","unicorn/no-array-push-push":"error","unicorn/no-console-spaces":"error","unicorn/no-for-loop":"error","unicorn/no-hex-escape":"error","unicorn/no-instanceof-array":"error","unicorn/no-invalid-remove-event-listener":"error","unicorn/no-lonely-if":"error","unicorn/no-new-array":"error","unicorn/no-new-buffer":"error","unicorn/no-static-only-class":"error","unicorn/no-unnecessary-await":"error","unicorn/no-zero-fractions":"error","unicorn/prefer-add-event-listener":"error","unicorn/prefer-array-find":"error","unicorn/prefer-array-flat-map":"error","unicorn/prefer-array-index-of":"error","unicorn/prefer-array-some":"error","unicorn/prefer-at":"error","unicorn/prefer-blob-reading-methods":"error","unicorn/prefer-date-now":"error","unicorn/prefer-dom-node-append":"error","unicorn/prefer-dom-node-dataset":"error","unicorn/prefer-dom-node-remove":"error","unicorn/prefer-dom-node-text-content":"error","unicorn/prefer-includes":"error","unicorn/prefer-keyboard-event-key":"error","unicorn/prefer-math-trunc":"error","unicorn/prefer-modern-dom-apis":"error","unicorn/prefer-modern-math-apis":"error","unicorn/prefer-negative-index":"error","unicorn/prefer-node-protocol":"error","unicorn/prefer-number-properties":"error","unicorn/prefer-optional-catch-binding":"error","unicorn/prefer-prototype-methods":"error","unicorn/prefer-query-selector":"error","unicorn/prefer-reflect-apply":"error","unicorn/prefer-regexp-test":"error","unicorn/prefer-string-replace-all":"error","unicorn/prefer-string-slice":"error","unicorn/prefer-string-starts-ends-with":"error","unicorn/prefer-string-trim-start-end":"error","unicorn/prefer-top-level-await":"error","unicorn/prefer-type-error":"error","unicorn/throw-new-error":"error"}}];import S from"@unocss/eslint-plugin";var Gr=[{plugins:{"@unocss":S},rules:{...S.configs.recommended.rules}}];import P from"vue-eslint-parser";import r from"eslint-plugin-vue";var $=[{languageOptions:{globals:{$:"readonly",$$:"readonly",$computed:"readonly",$customRef:"readonly",$ref:"readonly",$shallowRef:"readonly",$toRef:"readonly"}},plugins:{vue:r},rules:{"vue/no-setup-props-destructure":"off"}}],q={"vue/component-tags-order":["off",{order:["script","template","style"]}],"vue/custom-event-name-casing":["error","camelCase"],"vue/eqeqeq":["error","smart"],"vue/html-self-closing":["error",{html:{void:"always",normal:"always",component:"always"},svg:"always",math:"always"}],"vue/max-attributes-per-line":"off","vue/multi-word-component-names":"off","vue/no-constant-condition":"warn","vue/no-empty-pattern":"error","vue/no-loss-of-precision":"error","vue/no-unused-refs":"error","vue/no-useless-v-bind":"error","vue/no-v-html":"off","vue/object-shorthand":["error","always",{ignoreConstructors:!1,avoidQuotes:!0}],"vue/padding-line-between-blocks":["error","always"],"vue/prefer-template":"error","vue/require-prop-types":"off","vue/require-default-prop":"off"},D={...r.configs.base.rules,...r.configs["vue3-essential"].rules,...r.configs["vue3-strongly-recommended"].rules,...r.configs["vue3-recommended"].rules},X={...r.configs.base.rules,...r.configs.essential.rules,...r.configs["strongly-recommended"].rules,...r.configs.recommended.rules};function O(w){return[{files:[a],plugins:{vue:r,"@typescript-eslint":o},languageOptions:{ecmaVersion:"latest",parser:P,parserOptions:{parser:s,sourceType:"module",extraFileExtensions:[".vue"],ecmaFeatures:{jsx:!0}}},processor:r.processors[".vue"],rules:{...l[0].rules},ignores:[...e]},{plugins:{vue:r},rules:{...w,...q},ignores:[...e]},...$]}var jr=O(X),Tr=O(D);export{b as antfuPlugin,A as defineConfig,A as defineFlatConfig,d as importPlugin,W as imports,z as js,Z as jsx,ar as markdown,x as markdownPlugin,mr as prettier,y as prettierPlugin,Or as react,L as reactPlugin,$ as reactivityTransform,s as tsParser,o as tsPlugin,l as typescript,_r as unicorn,T as unicornPlugin,Gr as unocss,Tr as vue,jr as vueLegacy,P as vueParser,r as vuePlugin};