73 lines
1.9 KiB
JavaScript
73 lines
1.9 KiB
JavaScript
import tseslint from '@typescript-eslint/eslint-plugin';
|
|
import tsparser from '@typescript-eslint/parser';
|
|
import importPlugin from 'eslint-plugin-import';
|
|
import js from '@eslint/js';
|
|
|
|
export default [
|
|
js.configs.recommended,
|
|
{
|
|
ignores: [
|
|
'dist/**',
|
|
'build/**',
|
|
'node_modules/**',
|
|
'*.min.js',
|
|
'.eslintcache',
|
|
'*.tsbuildinfo',
|
|
'.vscode/**',
|
|
'.idea/**'
|
|
]
|
|
},
|
|
{
|
|
files: ['**/*.ts'],
|
|
languageOptions: {
|
|
parser: tsparser,
|
|
parserOptions: {
|
|
ecmaVersion: 2020,
|
|
sourceType: 'module',
|
|
project: './tsconfig.json'
|
|
},
|
|
ecmaVersion: 2020,
|
|
sourceType: 'module',
|
|
globals: {
|
|
document: 'readonly',
|
|
navigator: 'readonly',
|
|
window: 'readonly',
|
|
console: 'readonly',
|
|
alert: 'readonly'
|
|
}
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': tseslint,
|
|
'import': importPlugin
|
|
},
|
|
rules: {
|
|
// TypeScript specific rules
|
|
'@typescript-eslint/explicit-module-boundary-types': 'warn',
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_' }],
|
|
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
|
|
'@typescript-eslint/consistent-type-imports': 'error',
|
|
|
|
// Import rules
|
|
'import/no-unresolved': 'off', // Turn off because we're using TypeScript paths
|
|
'import/named': 'error',
|
|
'import/default': 'error',
|
|
'import/namespace': 'error',
|
|
'import/order': [
|
|
'error',
|
|
{
|
|
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
'newlines-between': 'always',
|
|
'alphabetize': { 'order': 'asc', 'caseInsensitive': true }
|
|
}
|
|
],
|
|
|
|
// General ESLint rules
|
|
'no-console': 'warn',
|
|
'eqeqeq': ['error', 'always'],
|
|
'no-var': 'error',
|
|
'prefer-const': 'error',
|
|
'curly': 'error',
|
|
}
|
|
}
|
|
]; |