52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import type { FlatESLintConfig } from '@aet/eslint-define-config';
|
|
import js from '@eslint/js';
|
|
import * as tsParser from '@typescript-eslint/parser';
|
|
import importPlugin from 'eslint-plugin-import-x';
|
|
import unicorn from 'eslint-plugin-unicorn';
|
|
import tsEslint from 'typescript-eslint';
|
|
|
|
import { importRules } from './src/presets/typescript';
|
|
|
|
export default [
|
|
js.configs.recommended, //
|
|
...tsEslint.configs.recommendedTypeChecked,
|
|
unicorn.configs['flat/recommended'],
|
|
importPlugin.flatConfigs.recommended,
|
|
importPlugin.flatConfigs.react,
|
|
importPlugin.flatConfigs.typescript,
|
|
{
|
|
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
|
|
languageOptions: {
|
|
parserOptions: {
|
|
parser: tsParser,
|
|
projectService: true,
|
|
ecmaVersion: 'latest',
|
|
// https://github.com/unjs/jiti/issues/167 import.meta.dirname
|
|
tsconfigRootDir: __dirname,
|
|
sourceType: 'module',
|
|
},
|
|
},
|
|
settings: {
|
|
'import-x/parsers': {
|
|
'@typescript-eslint/parser': ['.ts', '.tsx', '.mts', '.cts'],
|
|
},
|
|
'import-x/resolver': {
|
|
typescript: true,
|
|
node: true,
|
|
},
|
|
},
|
|
ignores: ['eslint.config.cjs'],
|
|
rules: {
|
|
...importRules,
|
|
},
|
|
},
|
|
{
|
|
rules: {
|
|
'unicorn/prevent-abbreviations': 'off',
|
|
'unicorn/import-style': 'off',
|
|
'unicorn/switch-case-braces': ['error', 'avoid'],
|
|
'unicorn/no-null': 'off',
|
|
},
|
|
},
|
|
] as FlatESLintConfig[];
|