|
| 1 | +import js from '@eslint/js' |
| 2 | +import tsPlugin from '@typescript-eslint/eslint-plugin' |
| 3 | +import tsParser from '@typescript-eslint/parser' |
| 4 | +import vuePlugin from 'eslint-plugin-vue' |
| 5 | +import vueParser from 'vue-eslint-parser' |
| 6 | + |
| 7 | +export default [ |
| 8 | + js.configs.recommended, |
| 9 | + { |
| 10 | + ignores: [ |
| 11 | + '**/dist/**', |
| 12 | + '**/build/**', |
| 13 | + '**/node_modules/**', |
| 14 | + '**/.git/**', |
| 15 | + '**/elle-hal/**', |
| 16 | + '**/*.min.js', |
| 17 | + '**/coverage/**' |
| 18 | + ] |
| 19 | + }, |
| 20 | + { |
| 21 | + files: ['elle-electron/**/*.ts', 'elle-electron/**/*.js'], |
| 22 | + languageOptions: { |
| 23 | + globals: { |
| 24 | + process: 'readonly', |
| 25 | + Buffer: 'readonly', |
| 26 | + __dirname: 'readonly', |
| 27 | + setTimeout: 'readonly', |
| 28 | + setInterval: 'readonly', |
| 29 | + clearTimeout: 'readonly', |
| 30 | + clearInterval: 'readonly', |
| 31 | + console: 'readonly', |
| 32 | + NodeJS: 'readonly' |
| 33 | + } |
| 34 | + } |
| 35 | + }, |
| 36 | + { |
| 37 | + files: ['elle-frontend/**/*.ts', 'elle-frontend/**/*.js', 'elle-frontend/**/*.vue'], |
| 38 | + languageOptions: { |
| 39 | + globals: { |
| 40 | + window: 'readonly', |
| 41 | + document: 'readonly', |
| 42 | + navigator: 'readonly', |
| 43 | + console: 'readonly', |
| 44 | + setTimeout: 'readonly', |
| 45 | + setInterval: 'readonly', |
| 46 | + clearTimeout: 'readonly', |
| 47 | + clearInterval: 'readonly', |
| 48 | + NodeJS: 'readonly', |
| 49 | + btoa: 'readonly', |
| 50 | + alert: 'readonly', |
| 51 | + fetch: 'readonly', |
| 52 | + HTMLElement: 'readonly', |
| 53 | + Event: 'readonly' |
| 54 | + } |
| 55 | + } |
| 56 | + }, |
| 57 | + { |
| 58 | + files: ['**/*.ts', '**/*.tsx'], |
| 59 | + languageOptions: { |
| 60 | + parser: tsParser, |
| 61 | + parserOptions: { |
| 62 | + ecmaVersion: 'latest', |
| 63 | + sourceType: 'module' |
| 64 | + } |
| 65 | + }, |
| 66 | + plugins: { |
| 67 | + '@typescript-eslint': tsPlugin |
| 68 | + }, |
| 69 | + rules: { |
| 70 | + ...tsPlugin.configs.recommended.rules, |
| 71 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 72 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 73 | + '@typescript-eslint/no-explicit-any': 'warn', |
| 74 | + '@typescript-eslint/no-unused-vars': ['error', { |
| 75 | + argsIgnorePattern: '^_', |
| 76 | + varsIgnorePattern: '^_' |
| 77 | + }], |
| 78 | + '@typescript-eslint/consistent-type-imports': ['error', { |
| 79 | + prefer: 'type-imports', |
| 80 | + disallowTypeAnnotations: false |
| 81 | + }] |
| 82 | + } |
| 83 | + }, |
| 84 | + ...vuePlugin.configs['flat/recommended'], |
| 85 | + { |
| 86 | + files: ['elle-frontend/**/*.vue'], |
| 87 | + languageOptions: { |
| 88 | + parser: vueParser, |
| 89 | + parserOptions: { |
| 90 | + parser: tsParser, |
| 91 | + ecmaVersion: 'latest', |
| 92 | + sourceType: 'module', |
| 93 | + extraFileExtensions: ['.vue'] |
| 94 | + } |
| 95 | + }, |
| 96 | + plugins: { |
| 97 | + vue: vuePlugin, |
| 98 | + '@typescript-eslint': tsPlugin |
| 99 | + }, |
| 100 | + rules: { |
| 101 | + 'vue/multi-word-component-names': 'off', |
| 102 | + 'vue/no-reserved-component-names': 'off', |
| 103 | + 'vue/max-attributes-per-line': ['error', { |
| 104 | + singleline: 3, |
| 105 | + multiline: 1 |
| 106 | + }], |
| 107 | + 'vue/singleline-html-element-content-newline': 'off', |
| 108 | + 'vue/html-self-closing': ['error', { |
| 109 | + html: { |
| 110 | + void: 'any', |
| 111 | + normal: 'any', |
| 112 | + component: 'always' |
| 113 | + }, |
| 114 | + svg: 'always', |
| 115 | + math: 'always' |
| 116 | + }] |
| 117 | + } |
| 118 | + }, |
| 119 | + { |
| 120 | + files: ['**/*.js', '**/*.ts', '**/*.vue'], |
| 121 | + rules: { |
| 122 | + 'no-console': 'off', |
| 123 | + 'no-debugger': 'warn', |
| 124 | + 'semi': ['error', 'never'], |
| 125 | + 'quotes': ['error', 'single', { avoidEscape: true }], |
| 126 | + 'comma-dangle': ['error', 'never'], |
| 127 | + 'indent': ['error', 2, { SwitchCase: 1 }], |
| 128 | + 'no-multiple-empty-lines': ['error', { max: 1 }], |
| 129 | + 'object-curly-spacing': ['error', 'always'], |
| 130 | + 'array-bracket-spacing': ['error', 'never'], |
| 131 | + 'space-before-function-paren': ['error', { |
| 132 | + anonymous: 'always', |
| 133 | + named: 'never', |
| 134 | + asyncArrow: 'always' |
| 135 | + }], |
| 136 | + 'keyword-spacing': ['error', { before: true, after: true }], |
| 137 | + 'space-infix-ops': 'error', |
| 138 | + 'eol-last': ['error', 'always'], |
| 139 | + 'no-trailing-spaces': 'error', |
| 140 | + 'no-var': 'error', |
| 141 | + 'prefer-const': 'error', |
| 142 | + 'prefer-template': 'error', |
| 143 | + 'arrow-body-style': ['error', 'as-needed'], |
| 144 | + 'curly': ['error', 'all'] |
| 145 | + } |
| 146 | + } |
| 147 | +] |
0 commit comments