|
| 1 | +import babelParser from '@babel/eslint-parser'; |
| 2 | +import path from 'node:path'; |
| 3 | +import { fileURLToPath } from 'node:url'; |
| 4 | +import js from '@eslint/js'; |
| 5 | +// eslint-disable-next-line spellcheck/spell-checker |
| 6 | +import { FlatCompat as FlatCompatibility } from '@eslint/eslintrc'; |
| 7 | +import stylistic from '@stylistic/eslint-plugin'; |
| 8 | +import i18N from 'eslint-plugin-i18n'; |
| 9 | +import noOnlyTests from 'eslint-plugin-no-only-tests'; |
| 10 | + |
| 11 | +const __filename = fileURLToPath(import.meta.url); |
| 12 | +const __dirname = path.dirname(__filename); |
| 13 | +const compatibility = new FlatCompatibility({ |
| 14 | + baseDirectory: __dirname, |
| 15 | + recommendedConfig: js.configs.recommended, |
| 16 | + allConfig: js.configs.all |
| 17 | +}); |
| 18 | + |
| 19 | +export default [ |
| 20 | + { |
| 21 | + ignores: [ |
| 22 | + 'node_modules/**', |
| 23 | + ], |
| 24 | + }, |
| 25 | + ...compatibility.extends('devextreme/spell-check'), |
| 26 | + { |
| 27 | + plugins: { |
| 28 | + 'no-only-tests': noOnlyTests, |
| 29 | + i18n: i18N, |
| 30 | + }, |
| 31 | + settings: { |
| 32 | + 'import/resolver': { |
| 33 | + node: { |
| 34 | + extensions: ['.js'], |
| 35 | + }, |
| 36 | + }, |
| 37 | + }, |
| 38 | + }, |
| 39 | + ...compatibility.extends('eslint:recommended', 'plugin:import/recommended').map(config => ({ |
| 40 | + ...config, |
| 41 | + files: ['**/*.js'] |
| 42 | + })), |
| 43 | + { |
| 44 | + files: ['**/*.js'], |
| 45 | + languageOptions: { |
| 46 | + globals: { |
| 47 | + setInterval: true, |
| 48 | + setTimeout: true, |
| 49 | + clearInterval: true, |
| 50 | + clearTimeout: true, |
| 51 | + require: true, |
| 52 | + module: true, |
| 53 | + exports: true, |
| 54 | + }, |
| 55 | + parser: babelParser, |
| 56 | + parserOptions: { |
| 57 | + requireConfigFile: false, |
| 58 | + }, |
| 59 | + }, |
| 60 | + plugins: { |
| 61 | + '@stylistic': stylistic, |
| 62 | + }, |
| 63 | + rules: { |
| 64 | + 'i18n/no-russian-character': ['error', { |
| 65 | + includeIdentifier: true, |
| 66 | + }], |
| 67 | + 'block-spacing': 'error', |
| 68 | + 'comma-spacing': 'error', |
| 69 | + 'computed-property-spacing': 'error', |
| 70 | + 'comma-style': ['error', 'last'], |
| 71 | + 'eqeqeq': ['error', 'allow-null'], |
| 72 | + 'strict': 'error', |
| 73 | + 'func-call-spacing': 'error', |
| 74 | + 'key-spacing': 'error', |
| 75 | + 'keyword-spacing': ['error', { |
| 76 | + overrides: { |
| 77 | + catch: { |
| 78 | + after: false, |
| 79 | + }, |
| 80 | + |
| 81 | + for: { |
| 82 | + after: false, |
| 83 | + }, |
| 84 | + |
| 85 | + if: { |
| 86 | + after: false, |
| 87 | + }, |
| 88 | + |
| 89 | + switch: { |
| 90 | + after: false, |
| 91 | + }, |
| 92 | + |
| 93 | + while: { |
| 94 | + after: false, |
| 95 | + }, |
| 96 | + }, |
| 97 | + }], |
| 98 | + 'no-multiple-empty-lines': ['error', { |
| 99 | + max: 2, |
| 100 | + }], |
| 101 | + 'no-multi-spaces': 'error', |
| 102 | + 'no-trailing-spaces': 'error', |
| 103 | + 'no-empty': ['error', { |
| 104 | + allowEmptyCatch: true, |
| 105 | + }], |
| 106 | + 'no-new-func': 'error', |
| 107 | + 'no-eval': 'error', |
| 108 | + 'no-undef-init': 'error', |
| 109 | + 'no-unused-vars': ['error', { |
| 110 | + args: 'none', |
| 111 | + caughtErrors: 'none', |
| 112 | + ignoreRestSiblings: true, |
| 113 | + }], |
| 114 | + 'no-extend-native': 'error', |
| 115 | + 'no-alert': 'error', |
| 116 | + 'no-console': 'error', |
| 117 | + 'no-restricted-syntax': ['error', 'ForOfStatement'], |
| 118 | + 'no-var': 'error', |
| 119 | + 'no-whitespace-before-property': 'error', |
| 120 | + 'object-curly-spacing': ['error', 'always'], |
| 121 | + 'one-var': ['error', 'never'], |
| 122 | + 'prefer-const': 'error', |
| 123 | + 'semi-spacing': 'error', |
| 124 | + 'semi': 'error', |
| 125 | + 'space-before-blocks': 'error', |
| 126 | + 'space-before-function-paren': ['error', 'never'], |
| 127 | + 'space-in-parens': 'error', |
| 128 | + 'space-infix-ops': 'error', |
| 129 | + 'space-unary-ops': 'error', |
| 130 | + '@stylistic/space-infix-ops': 'error', |
| 131 | + 'space-unary-ops': 'error', |
| 132 | + 'spaced-comment': ['error', 'always', { |
| 133 | + exceptions: ['#DEBUG', '#ENDDEBUG'], |
| 134 | + markers: ['/'], |
| 135 | + }], |
| 136 | + '@stylistic/brace-style': ['error', '1tbs', { |
| 137 | + allowSingleLine: true, |
| 138 | + }], |
| 139 | + 'curly': ['error', 'multi-line', 'consistent'], |
| 140 | + 'unicode-bom': ['error', 'never'], |
| 141 | + 'eol-last': ['error', 'always'], |
| 142 | + '@stylistic/indent': ['error', 4, { |
| 143 | + SwitchCase: 1, |
| 144 | + MemberExpression: 1, |
| 145 | + |
| 146 | + CallExpression: { |
| 147 | + arguments: 1, |
| 148 | + }, |
| 149 | + }], |
| 150 | + 'quotes': ['error', 'single'], |
| 151 | + 'import/named': 2, |
| 152 | + 'import/default': 2, |
| 153 | + 'import/no-duplicates': 2, |
| 154 | + /* |
| 155 | + TODO: Consider these rules comment before these rules, |
| 156 | + because these rules were disabled during the migration |
| 157 | + and may need consideration in the future |
| 158 | + */ |
| 159 | + 'import/no-unresolved': 'off', |
| 160 | + }, |
| 161 | + }, |
| 162 | +]; |
0 commit comments