|
| 1 | +import path from 'node:path'; |
| 2 | +import { fileURLToPath } from 'node:url'; |
| 3 | + |
| 4 | +import { includeIgnoreFile } from '@eslint/compat'; |
| 5 | +import { FlatCompat } from '@eslint/eslintrc'; |
| 6 | +import js from '@eslint/js'; |
| 7 | +import typescriptEslint from '@typescript-eslint/eslint-plugin'; |
| 8 | +import tsParser from '@typescript-eslint/parser'; |
| 9 | +import prettier from 'eslint-plugin-prettier'; |
| 10 | +import simpleImportSort from 'eslint-plugin-simple-import-sort'; |
| 11 | +import globals from 'globals'; |
| 12 | + |
| 13 | +const __filename = fileURLToPath(import.meta.url); |
| 14 | +const __dirname = path.dirname(__filename); |
| 15 | +const gitignorePath = path.resolve(__dirname, '.gitignore'); |
| 16 | + |
| 17 | +const compat = new FlatCompat({ |
| 18 | + baseDirectory: __dirname, |
| 19 | + recommendedConfig: js.configs.recommended, |
| 20 | + allConfig: js.configs.all, |
| 21 | +}); |
| 22 | + |
| 23 | +export default [ |
| 24 | + includeIgnoreFile(gitignorePath), |
| 25 | + |
| 26 | + ...compat.extends( |
| 27 | + 'eslint:recommended', |
| 28 | + 'plugin:@typescript-eslint/recommended', |
| 29 | + ), |
| 30 | + |
| 31 | + { |
| 32 | + plugins: { |
| 33 | + '@typescript-eslint': typescriptEslint, |
| 34 | + prettier, |
| 35 | + 'simple-import-sort': simpleImportSort, |
| 36 | + }, |
| 37 | + |
| 38 | + languageOptions: { |
| 39 | + globals: { |
| 40 | + ...globals.browser, |
| 41 | + ...globals.node, |
| 42 | + }, |
| 43 | + parser: tsParser, |
| 44 | + }, |
| 45 | + |
| 46 | + rules: { |
| 47 | + '@typescript-eslint/no-non-null-assertion': 'off', |
| 48 | + '@typescript-eslint/no-empty-function': 'off', |
| 49 | + 'no-console': 'error', |
| 50 | + 'no-debugger': 'error', |
| 51 | + 'prettier/prettier': 'error', |
| 52 | + 'simple-import-sort/exports': 'error', |
| 53 | + 'simple-import-sort/imports': 'error', |
| 54 | + }, |
| 55 | + }, |
| 56 | +]; |
0 commit comments