|
| 1 | +import { defineConfig, globalIgnores } from 'eslint/config'; |
| 2 | +import i18N from 'eslint-plugin-i18n'; |
| 3 | +import simpleImportSort from 'eslint-plugin-simple-import-sort'; |
| 4 | +import path from 'node:path'; |
| 5 | +import { fileURLToPath } from 'node:url'; |
| 6 | +import { FlatCompat } from '@eslint/eslintrc'; |
| 7 | +import js from '@eslint/js'; |
| 8 | +import typescriptEslint from '@typescript-eslint/eslint-plugin'; |
| 9 | +import tsParser from '@typescript-eslint/parser'; |
| 10 | + |
| 11 | +const __filename = fileURLToPath(import.meta.url); |
| 12 | +const __dirname = path.dirname(__filename); |
| 13 | +const compat = new FlatCompat({ |
| 14 | + baseDirectory: __dirname, |
| 15 | + recommendedConfig: js.configs.recommended, |
| 16 | + allConfig: js.configs.all, |
| 17 | +}); |
| 18 | + |
| 19 | +export const BASE_CONFIG = { |
| 20 | + extends: compat.extends( |
| 21 | + 'eslint:recommended', |
| 22 | + 'plugin:@typescript-eslint/eslint-recommended', |
| 23 | + 'plugin:@typescript-eslint/recommended', |
| 24 | + 'prettier', |
| 25 | + 'plugin:prettier/recommended', |
| 26 | + ), |
| 27 | + |
| 28 | + plugins: { |
| 29 | + '@typescript-eslint': typescriptEslint, |
| 30 | + i18n: i18N, |
| 31 | + 'simple-import-sort': simpleImportSort, |
| 32 | + }, |
| 33 | + |
| 34 | + languageOptions: { |
| 35 | + parser: tsParser, |
| 36 | + }, |
| 37 | + |
| 38 | + rules: { |
| 39 | + 'i18n/no-russian-character': 1, |
| 40 | + |
| 41 | + 'simple-import-sort/imports': [ |
| 42 | + 'error', |
| 43 | + { |
| 44 | + groups: [ |
| 45 | + ['^react', 'lodash', '^\\w', '^@?\\w'], |
| 46 | + ['^components', '^layouts'], |
| 47 | + ['^consts', '^hooks', '^libs', '^routes', '^services', '^types'], |
| 48 | + ['^App', '^pages'], |
| 49 | + ['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'], |
| 50 | + ['./constants/.'], |
| 51 | + ['./definitions/.', './types'], |
| 52 | + ['^.+\\.svg', '^.+\\.png$', '^.+\\.jpg', '^.+\\.s?css$'], |
| 53 | + ], |
| 54 | + }, |
| 55 | + ], |
| 56 | + }, |
| 57 | +}; |
| 58 | + |
| 59 | +export default defineConfig([ |
| 60 | + globalIgnores([ |
| 61 | + 'node_modules', |
| 62 | + 'build', |
| 63 | + 'server.js', |
| 64 | + 'src/locale', |
| 65 | + 'src/types', |
| 66 | + 'src/setupProxy.js', |
| 67 | + 'webpack/**/*', |
| 68 | + 'webpack/env.js', |
| 69 | + 'webpack/prod.js', |
| 70 | + 'public', |
| 71 | + 'staticServer.js', |
| 72 | + 'webpack.config.js', |
| 73 | + ]), |
| 74 | + { ...BASE_CONFIG }, |
| 75 | +]); |
0 commit comments