|
| 1 | +import unicorn from "eslint-plugin-unicorn"; |
| 2 | +import typescript from "@typescript-eslint/eslint-plugin"; |
| 3 | +import typescriptParser from "@typescript-eslint/parser"; |
| 4 | +import vue from "eslint-plugin-vue"; |
| 5 | +import vueParser from "vue-eslint-parser"; |
| 6 | + |
| 7 | +export default [ |
| 8 | + { |
| 9 | + ignores: [ |
| 10 | + "node_modules/**", |
| 11 | + "dist/**", |
| 12 | + ".nuxt/**", |
| 13 | + "packages/*/dist/**", |
| 14 | + "packages/app/.nuxt/**", |
| 15 | + "packages/cli/dist/**", |
| 16 | + ], |
| 17 | + }, |
| 18 | + // JavaScript and TypeScript files |
| 19 | + { |
| 20 | + files: ["**/*.js", "**/*.ts"], |
| 21 | + languageOptions: { |
| 22 | + ecmaVersion: 2022, |
| 23 | + sourceType: "module", |
| 24 | + parser: typescriptParser, |
| 25 | + parserOptions: { |
| 26 | + ecmaFeatures: { |
| 27 | + jsx: true, |
| 28 | + }, |
| 29 | + }, |
| 30 | + }, |
| 31 | + linterOptions: { |
| 32 | + reportUnusedDisableDirectives: true, |
| 33 | + }, |
| 34 | + plugins: { |
| 35 | + unicorn, |
| 36 | + "@typescript-eslint": typescript, |
| 37 | + }, |
| 38 | + rules: { |
| 39 | + // Basic rules |
| 40 | + "no-console": "warn", |
| 41 | + "no-debugger": "warn", |
| 42 | + "no-unused-vars": "warn", |
| 43 | + "prefer-const": "error", |
| 44 | + "no-useless-constructor": "error", |
| 45 | + |
| 46 | + // TypeScript rules |
| 47 | + "@typescript-eslint/no-unused-vars": [ |
| 48 | + "warn", |
| 49 | + { |
| 50 | + argsIgnorePattern: "^_", |
| 51 | + varsIgnorePattern: "^_", |
| 52 | + }, |
| 53 | + ], |
| 54 | + "@typescript-eslint/no-namespace": "error", |
| 55 | + "@typescript-eslint/no-non-null-assertion": "off", |
| 56 | + |
| 57 | + // Async rules |
| 58 | + "require-await": "off", |
| 59 | + |
| 60 | + // Unicorn rules |
| 61 | + "unicorn/no-null": "off", |
| 62 | + "unicorn/filename-case": "off", |
| 63 | + "unicorn/no-process-exit": "error", |
| 64 | + "unicorn/prefer-ternary": "off", |
| 65 | + "unicorn/prefer-top-level-await": "off", |
| 66 | + "unicorn/prefer-code-point": "off", |
| 67 | + "unicorn/prefer-string-slice": "off", |
| 68 | + "unicorn/prefer-at": "off", |
| 69 | + "unicorn/explicit-length-check": "off", |
| 70 | + "unicorn/prefer-set-has": "off", |
| 71 | + "unicorn/no-empty-file": "error", |
| 72 | + |
| 73 | + // Other rules |
| 74 | + camelcase: "off", |
| 75 | + "no-empty": [ |
| 76 | + "error", |
| 77 | + { |
| 78 | + allowEmptyCatch: true, |
| 79 | + }, |
| 80 | + ], |
| 81 | + }, |
| 82 | + }, |
| 83 | + // Vue files |
| 84 | + { |
| 85 | + files: ["**/*.vue"], |
| 86 | + languageOptions: { |
| 87 | + parser: vueParser, |
| 88 | + parserOptions: { |
| 89 | + parser: typescriptParser, |
| 90 | + ecmaVersion: 2022, |
| 91 | + sourceType: "module", |
| 92 | + ecmaFeatures: { |
| 93 | + jsx: true, |
| 94 | + }, |
| 95 | + extraFileExtensions: [".vue"], |
| 96 | + }, |
| 97 | + }, |
| 98 | + plugins: { |
| 99 | + vue, |
| 100 | + "@typescript-eslint": typescript, |
| 101 | + unicorn, |
| 102 | + }, |
| 103 | + rules: { |
| 104 | + // Vue rules |
| 105 | + "vue/multi-word-component-names": "off", |
| 106 | + "vue/no-unused-vars": "warn", |
| 107 | + "vue/no-v-html": "off", |
| 108 | + |
| 109 | + // Basic rules |
| 110 | + "no-console": "warn", |
| 111 | + "no-debugger": "warn", |
| 112 | + "prefer-const": "error", |
| 113 | + |
| 114 | + // TypeScript rules |
| 115 | + "@typescript-eslint/no-unused-vars": [ |
| 116 | + "warn", |
| 117 | + { |
| 118 | + argsIgnorePattern: "^_", |
| 119 | + varsIgnorePattern: "^_", |
| 120 | + }, |
| 121 | + ], |
| 122 | + "@typescript-eslint/no-namespace": "error", |
| 123 | + "@typescript-eslint/no-non-null-assertion": "off", |
| 124 | + |
| 125 | + // Unicorn rules |
| 126 | + "unicorn/no-null": "off", |
| 127 | + "unicorn/prefer-code-point": "off", |
| 128 | + "unicorn/prefer-string-slice": "off", |
| 129 | + "unicorn/prefer-ternary": "off", |
| 130 | + }, |
| 131 | + }, |
| 132 | +]; |
0 commit comments