2026-03-27 14:50:34 +09:00
|
|
|
import tseslint from 'typescript-eslint';
|
|
|
|
|
import prettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
|
|
|
|
|
|
|
|
export default tseslint.config(
|
|
|
|
|
{ ignores: ['dist/**', 'coverage/**', 'eslint.config.js'] },
|
|
|
|
|
...tseslint.configs.recommended,
|
|
|
|
|
{
|
|
|
|
|
languageOptions: {
|
|
|
|
|
parserOptions: {
|
|
|
|
|
tsconfigRootDir: import.meta.dirname, // points to packages/api
|
|
|
|
|
project: ['./tsconfig.json', './tsconfig.test.json'],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
rules: {
|
|
|
|
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
|
|
|
'@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'explicit' }],
|
|
|
|
|
'@typescript-eslint/no-unused-vars': [
|
|
|
|
|
'error',
|
|
|
|
|
{
|
|
|
|
|
argsIgnorePattern: '^_',
|
|
|
|
|
varsIgnorePattern: '^_',
|
|
|
|
|
caughtErrorsIgnorePattern: '^_',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
'@typescript-eslint/consistent-type-imports': [
|
|
|
|
|
'error',
|
|
|
|
|
{ prefer: 'type-imports', fixStyle: 'inline-type-imports' },
|
|
|
|
|
],
|
2026-05-19 16:15:15 +09:00
|
|
|
'@typescript-eslint/member-ordering': [
|
|
|
|
|
'error',
|
|
|
|
|
{
|
|
|
|
|
default: [
|
|
|
|
|
'public-static-field',
|
|
|
|
|
'protected-static-field',
|
|
|
|
|
'private-static-field',
|
|
|
|
|
'public-instance-field',
|
|
|
|
|
'protected-instance-field',
|
|
|
|
|
'private-instance-field',
|
|
|
|
|
'constructor',
|
|
|
|
|
'public-instance-method',
|
|
|
|
|
'protected-instance-method',
|
|
|
|
|
'private-instance-method',
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
'@typescript-eslint/explicit-function-return-type': [
|
|
|
|
|
'error',
|
|
|
|
|
{
|
|
|
|
|
allowExpressions: true,
|
|
|
|
|
allowTypedFunctionExpressions: true,
|
|
|
|
|
allowHigherOrderFunctions: true,
|
|
|
|
|
allowDirectConstAssertionInArrowFunctions: true,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
'@typescript-eslint/no-unsafe-assignment': 'error',
|
|
|
|
|
'@typescript-eslint/no-unsafe-member-access': 'error',
|
|
|
|
|
'@typescript-eslint/no-unsafe-call': 'error',
|
|
|
|
|
'@typescript-eslint/no-unsafe-return': 'error',
|
|
|
|
|
'@typescript-eslint/naming-convention': [
|
|
|
|
|
'error',
|
|
|
|
|
{
|
|
|
|
|
selector: 'default',
|
|
|
|
|
format: ['camelCase'],
|
|
|
|
|
leadingUnderscore: 'allow',
|
|
|
|
|
trailingUnderscore: 'allow',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
selector: 'variable',
|
|
|
|
|
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
|
|
|
|
|
leadingUnderscore: 'allow',
|
|
|
|
|
trailingUnderscore: 'allow',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
selector: 'typeLike',
|
|
|
|
|
format: ['PascalCase'],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
selector: 'interface',
|
|
|
|
|
format: ['PascalCase'],
|
|
|
|
|
custom: {
|
|
|
|
|
regex: '^I[A-Z]',
|
|
|
|
|
match: false,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
selector: 'objectLiteralProperty',
|
|
|
|
|
format: null,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
selector: 'objectLiteralMethod',
|
|
|
|
|
format: null,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
'@typescript-eslint/no-floating-promises': 'error',
|
|
|
|
|
'@typescript-eslint/no-misused-promises': 'error',
|
2026-03-27 14:50:34 +09:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
// Relax some rules in test files
|
|
|
|
|
files: ['**/*.test.ts'],
|
|
|
|
|
rules: {
|
|
|
|
|
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
prettierRecommended,
|
|
|
|
|
);
|