eslint.config.mjs•2.39 kB
import js from '@eslint/js'
import typescript from '@typescript-eslint/eslint-plugin'
import typescriptParser from '@typescript-eslint/parser'
import prettier from 'eslint-plugin-prettier'
import prettierConfig from 'eslint-config-prettier'
import nodePlugin from 'eslint-plugin-n'
export default [
{
ignores: ['dist/**', 'node_modules/**', '*.js', '*.mjs', '*.cjs', 'src/generated/**'],
},
js.configs.recommended,
nodePlugin.configs['flat/recommended'],
{
files: ['src/**/*.ts'],
languageOptions: {
parser: typescriptParser,
ecmaVersion: 2023,
sourceType: 'module',
parserOptions: {
project: './tsconfig.json',
},
globals: {
...nodePlugin.configs['flat/recommended'].languageOptions.globals,
RequestInit: 'readonly',
URLSearchParams: 'readonly',
fetch: 'readonly',
},
},
plugins: {
'@typescript-eslint': typescript,
prettier,
n: nodePlugin,
},
rules: {
...typescript.configs['recommended'].rules,
...typescript.configs['recommended-requiring-type-checking'].rules,
...typescript.configs['strict'].rules,
...prettierConfig.rules,
'prettier/prettier': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-use-before-define': ['error', { functions: false }],
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'no-console': ['warn', { allow: ['warn', 'error'] }],
// Node plugin rules
'n/no-missing-import': 'off', // TypeScript handles this
'n/no-unpublished-import': 'off', // We have dev dependencies
'n/no-unsupported-features/es-syntax': 'off', // We use TypeScript
'n/no-unsupported-features/node-builtins': 'error',
'n/shebang': 'off',
'n/hashbang': 'off', // We use shebang in src/server.ts for CLI
'n/no-process-exit': 'off', // OK for CLI tools
},
},
]