|
| 1 | +import path from 'node:path'; |
| 2 | +import { fileURLToPath } from 'node:url'; |
| 3 | + |
| 4 | +import { fixupPluginRules, 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 _import from 'eslint-plugin-import'; |
| 10 | +import jsdoc from 'eslint-plugin-jsdoc'; |
| 11 | +import prettier from 'eslint-plugin-prettier'; |
| 12 | + |
| 13 | +const __filename = fileURLToPath(import.meta.url); |
| 14 | +const __dirname = path.dirname(__filename); |
| 15 | +const compat = new FlatCompat({ |
| 16 | + baseDirectory: __dirname, |
| 17 | + recommendedConfig: js.configs.recommended, |
| 18 | + allConfig: js.configs.all, |
| 19 | +}); |
| 20 | +const gitignorePath = path.resolve(__dirname, '.gitignore'); |
| 21 | + |
| 22 | +export default [ |
| 23 | + { |
| 24 | + ignores: ['**/*.js', '**/test-resources'], |
| 25 | + }, |
| 26 | + includeIgnoreFile(gitignorePath), |
| 27 | + ...compat.extends('eslint:recommended', 'plugin:@typescript-eslint/recommended'), |
| 28 | + { |
| 29 | + files: ['**/*.ts', '**/*.tsx'], |
| 30 | + |
| 31 | + plugins: { |
| 32 | + '@typescript-eslint': typescriptEslint, |
| 33 | + jsdoc, |
| 34 | + 'import': fixupPluginRules(_import), |
| 35 | + prettier, |
| 36 | + }, |
| 37 | + |
| 38 | + languageOptions: { |
| 39 | + parser: tsParser, |
| 40 | + }, |
| 41 | + |
| 42 | + rules: { |
| 43 | + 'semi': [2, 'always'], |
| 44 | + '@typescript-eslint/no-unused-vars': 0, |
| 45 | + '@typescript-eslint/no-explicit-any': 0, |
| 46 | + '@typescript-eslint/explicit-module-boundary-types': 0, |
| 47 | + '@typescript-eslint/no-non-null-assertion': 0, |
| 48 | + |
| 49 | + 'import/order': [ |
| 50 | + 'error', |
| 51 | + { |
| 52 | + 'alphabetize': { |
| 53 | + order: 'asc', |
| 54 | + }, |
| 55 | + |
| 56 | + 'newlines-between': 'always', |
| 57 | + 'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'], |
| 58 | + }, |
| 59 | + ], |
| 60 | + }, |
| 61 | + }, |
| 62 | +]; |
0 commit comments