|
| 1 | +import js from "@eslint/js"; |
| 2 | +import * as tseslint from "typescript-eslint"; |
| 3 | +import vuePlugin from "eslint-plugin-vue"; |
| 4 | +import prettierPlugin from "eslint-plugin-prettier"; |
| 5 | +import prettierConfig from "eslint-config-prettier"; |
| 6 | + |
| 7 | +const isProduction = import.meta.env?.PROD || process.env.NODE_ENV === "production"; |
| 8 | + |
| 9 | +export default [ |
| 10 | + js.configs.recommended, |
| 11 | + ...tseslint.configs.recommended, |
| 12 | + |
| 13 | + // Vue configuration |
| 14 | + { |
| 15 | + files: ["**/*.vue"], |
| 16 | + plugins: { |
| 17 | + vue: vuePlugin, |
| 18 | + }, |
| 19 | + languageOptions: { |
| 20 | + parser: "vue-eslint-parser", |
| 21 | + parserOptions: { |
| 22 | + parser: tseslint.parser, |
| 23 | + ecmaVersion: 2022, |
| 24 | + extraFileExtensions: [".vue"], |
| 25 | + sourceType: "module", |
| 26 | + }, |
| 27 | + }, |
| 28 | + rules: { |
| 29 | + ...vuePlugin.configs.essential.rules, |
| 30 | + "vue/multi-word-component-names": "off", |
| 31 | + "vue/script-setup-uses-vars": "warn", |
| 32 | + "vue/no-unused-components": "off", |
| 33 | + }, |
| 34 | + }, |
| 35 | + |
| 36 | + // Global configuration |
| 37 | + { |
| 38 | + languageOptions: { |
| 39 | + ecmaVersion: 2022, |
| 40 | + sourceType: "module", |
| 41 | + }, |
| 42 | + plugins: { |
| 43 | + prettier: prettierPlugin, |
| 44 | + }, |
| 45 | + rules: { |
| 46 | + "no-console": isProduction ? "warn" : "off", |
| 47 | + "no-debugger": isProduction ? "warn" : "off", |
| 48 | + "no-unused-vars": "off", |
| 49 | + "@typescript-eslint/no-var-requires": "off", |
| 50 | + "prettier/prettier": "warn", |
| 51 | + }, |
| 52 | + }, |
| 53 | + |
| 54 | + prettierConfig, // Turn off rules that conflict with prettier |
| 55 | +]; |
0 commit comments