@bit-ocean/eslint-config
Version:
Universal ESLint configuration.
2 lines • 5.78 kB
JavaScript
import D from'node:fs';import {resolve,join}from'node:path';import {rules}from'eslint-plugin-jsx-a11y';var A=Object.defineProperty,T=Object.defineProperties;var S=Object.getOwnPropertyDescriptors;var l=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var p=(t,e,r)=>e in t?A(t,e,{enumerable:true,configurable:true,writable:true,value:r}):t[e]=r,o=(t,e)=>{for(var r in e||(e={}))E.call(e,r)&&p(t,r,e[r]);if(l)for(var r of l(e))N.call(e,r)&&p(t,r,e[r]);return t},c=(t,e)=>T(t,S(e));var a=(t,e,r)=>p(t,typeof e!="symbol"?e+"":e,r);var B={"react/no-unknown-property":"off","react/jsx-filename-extension":[1,{extensions:[".astro"]}],"consistent-return":"off"},f=t=>({files:["*.astro"],parser:"astro-eslint-parser",parserOptions:{parser:"@typescript-eslint/parser",extraFileExtensions:[".astro"],project:t,ecmaVersion:"latest",sourceType:"module"},globals:{Astro:"readonly"},rules:B,settings:{"import/resolver":{typescript:{project:t}}}});var u={"import/order":"off","import/first":"error","import/newline-after-import":"error","import/no-unresolved":"off","import/no-absolute-path":"off","import/no-duplicates":"error","import/extensions":"off","import/no-extraneous-dependencies":"off","import/no-mutable-exports":"error","import/no-self-import":"error","import/prefer-default-export":"off"};var d={quotes:["error","single"],semi:["error","never"],"no-unused-vars":"off","class-methods-use-this":"off","max-classes-per-file":"off","no-param-reassign":["warn",{props:true,ignorePropertyModificationsFor:["target","descriptor","req","request","args","draft","acc","props"],ignorePropertyModificationsForRegex:["^item","Item$"]}]},m={files:["*.{js,cjs,mjs,jsx}"],extends:"plugin:@typescript-eslint/disable-type-checked",rules:{"@typescript-eslint/no-var-requires":"off","@typescript-eslint/no-require-imports":"off"}};var y={"react-refresh/only-export-components":"off"};var x={"react/checked-requires-onchange-or-readonly":"error","react/destructuring-assignment":["error","always"],"react/display-name":"error","react/forbid-component-props":"error","react/function-component-definition":"error","react/hook-use-state":"error","react/iframe-missing-sandbox":"error","react/jsx-key":"error","react/jsx-no-comment-textnodes":"error","react/jsx-no-duplicate-props":"error","react/jsx-no-target-blank":["error",{enforceDynamicLinks:"always"}],"react/jsx-no-undef":"off","react/no-children-prop":"error","react/no-danger-with-children":"error","react/no-deprecated":"error","react/no-find-dom-node":"error","react/no-is-mounted":"error","react/no-render-return-value":"error","react/no-string-refs":"error","react/no-unescaped-entities":"error","react/no-unknown-property":"error","react/prop-types":"error","react/jsx-props-no-spreading":"off","react/jsx-filename-extension":["warn",{extensions:[".jsx",".tsx"]}],"react/jsx-no-useless-fragment":["error",{allowExpressions:true}],"react/no-array-index-key":"off","react/no-unstable-nested-components":["error",{allowAsProps:true,customValidators:[]}],"react/require-default-props":"off"};var R={"global-require":"off","react-native/no-inline-styles":"off"};var v={"react-refresh/only-export-components":["warn",{allowConstantExport:true,allowExportNames:[]}]};var g={"simple-import-sort/imports":"error","simple-import-sort/exports":"error"};var L={"tailwindcss/classnames-order":"off","tailwindcss/enforces-shorthand":"error","tailwindcss/enforces-negative-arbitrary-values":"error","tailwindcss/no-contradicting-classname":"warn","tailwindcss/no-custom-classname":"off","tailwindcss/no-unnecessary-arbitrary-value":"error"};var b={"@typescript-eslint/no-explicit-any":"off","@typescript-eslint/comma-dangle":"off","@typescript-eslint/consistent-type-imports":"error","@typescript-eslint/triple-slash-reference":"off","@typescript-eslint/no-unused-vars":"off","@typescript-eslint/no-use-before-define":["error",{functions:false,classes:false}],"@typescript-eslint/no-throw-literal":"off","@typescript-eslint/no-empty-function":"off"},w=t=>({files:["*.{ts,tsx,cts,mts}"],parser:"@typescript-eslint/parser",parserOptions:{project:t,ecmaVersion:"latest",sourceType:"module"},rules:{"no-undef":"off","react/jsx-no-undef":"off"},settings:{"import/resolver":{typescript:{project:t}}}}),h={files:["*.d.ts"],rules:{"import/no-duplicates":"off"}};var O={"unused-imports/no-unused-imports":"error","unused-imports/no-unused-vars":["warn",{vars:"all",varsIgnorePattern:"^_",args:"after-used",argsIgnorePattern:"^_"}]};var j={"vue/no-v-html":"off","vue/multi-word-component-names":"off","vue/component-tags-order":["error",{order:["script","template","style"]}]},C={files:["*.vue"],rules:{"no-undef":"off"}};var P=class t{constructor(e,r){a(this,"config");a(this,"ignorePatterns",["node_modules","dist","src-tauri","@types/auto-imports.d.ts","storybook-static"]);this.config=c(o({},e),{root:true,ignorePatterns:this.ignorePatterns,reportUnusedDisableDirectives:true,rules:this.buildRules(r),overrides:this.buildOverrides(r)});}build(){return this.config}buildOverrides(e,r=t.buildTypeScriptProject()){let{typescript:i,vue:s,astro:n}=e!=null?e:{};return [m,...i?[w(r),h]:[],...s?[C]:[],...n?[f(r)]:[]]}buildRules(e){let{typescript:r,react:i,reactNative:s,next:n,tailwind:q,vue:I}=e!=null?e:{};return o(o(o(o(o(o(o(o(o(o({},d),O),g),u),r?b:{}),s?R:{}),i||s?o(o(o({},x),v),this.disableA11y()):{}),n?y:{}),q?L:{}),I?j:{})}disableA11y(){return Object.keys(rules).reduce((e,r)=>(e[`jsx-a11y/${r}`]="off",e),{})}static buildTypeScriptProject(){return D.existsSync(join(process.cwd(),"tsconfig.eslint.json"))?resolve(process.cwd(),"tsconfig.eslint.json"):resolve(process.cwd(),"tsconfig.json")}};export{P as a};//# sourceMappingURL=chunk-RNBDPU75.mjs.map
//# sourceMappingURL=chunk-RNBDPU75.mjs.map