67 lines
1.7 KiB
TypeScript
67 lines
1.7 KiB
TypeScript
/* eslint-disable @typescript-eslint/naming-convention */
|
|
import pluginPerfectionist from 'eslint-plugin-perfectionist';
|
|
import pluginPrettier from 'eslint-plugin-prettier';
|
|
import pluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
import pluginSonarjs from 'eslint-plugin-sonarjs';
|
|
import pluginUnicorn from 'eslint-plugin-unicorn';
|
|
import tseslint from 'typescript-eslint';
|
|
|
|
import { sortBaseRule, sortDetailedRule } from './sort';
|
|
|
|
const ignores = {
|
|
ignores: [
|
|
'dist/**',
|
|
'**/dist/**',
|
|
'build/**',
|
|
'**/build/**',
|
|
'eslint.config.ts',
|
|
],
|
|
} as const;
|
|
|
|
const configs = [
|
|
tseslint.configs.stylisticTypeChecked,
|
|
tseslint.configs.eslintRecommended,
|
|
tseslint.configs.recommendedTypeChecked,
|
|
pluginPrettierRecommended,
|
|
pluginPerfectionist.configs['recommended-natural'],
|
|
pluginUnicorn.configs.all,
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
(pluginSonarjs.configs?.recommended ?? {}) as any, // broken sonarjs types?
|
|
] as const;
|
|
|
|
export const config = [
|
|
...configs,
|
|
ignores,
|
|
{
|
|
languageOptions: {
|
|
parserOptions: {
|
|
projectService: true,
|
|
tsconfigRootDir: process.cwd(),
|
|
},
|
|
},
|
|
},
|
|
{
|
|
rules: {
|
|
'@typescript-eslint/naming-convention': 'error',
|
|
'perfectionist/sort-classes': ['error', sortDetailedRule],
|
|
'perfectionist/sort-interfaces': ['error', sortBaseRule],
|
|
'perfectionist/sort-object-types': ['error', sortBaseRule],
|
|
'perfectionist/sort-objects': ['error', sortBaseRule],
|
|
},
|
|
},
|
|
{
|
|
plugins: {
|
|
prettier: pluginPrettier,
|
|
},
|
|
rules: {
|
|
'prettier/prettier': [
|
|
'error',
|
|
{
|
|
singleQuote: true,
|
|
},
|
|
],
|
|
},
|
|
},
|
|
];
|
|
|
|
export default config;
|