Some checks failed
Main Workflow / Test and Build (20.x) (push) Successful in 3m58s
Main Workflow / Security Audit (push) Successful in 4m10s
Main Workflow / Test and Build (18.x) (push) Failing after 2m46s
Main Workflow / Build Release Artifacts (push) Has been skipped
Main Workflow / Code Quality Check (push) Failing after 1m51s
Main Workflow / Notification (push) Failing after 21s
127 lines
3.2 KiB
JavaScript
127 lines
3.2 KiB
JavaScript
import js from '@eslint/js';
|
|
import tseslint from '@typescript-eslint/eslint-plugin';
|
|
import tsparser from '@typescript-eslint/parser';
|
|
|
|
export default [
|
|
// Base JavaScript configuration
|
|
js.configs.recommended,
|
|
|
|
// Configuration for TypeScript files
|
|
{
|
|
files: ['**/*.ts', '**/*.tsx'],
|
|
ignores: ['**/*.test.ts', '**/*.spec.ts', 'src/tests/**/*.ts'],
|
|
languageOptions: {
|
|
parser: tsparser,
|
|
parserOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: 'module',
|
|
project: './tsconfig.json',
|
|
},
|
|
globals: {
|
|
console: 'readonly',
|
|
process: 'readonly',
|
|
Buffer: 'readonly',
|
|
global: 'readonly',
|
|
},
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': tseslint,
|
|
},
|
|
rules: {
|
|
// TypeScript recommended rules
|
|
...tseslint.configs.recommended.rules,
|
|
|
|
// Custom rules for the project
|
|
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'@typescript-eslint/no-var-requires': 'error',
|
|
|
|
// General JavaScript/TypeScript rules
|
|
'no-console': 'warn',
|
|
'no-debugger': 'error',
|
|
'no-duplicate-imports': 'error',
|
|
'no-unused-expressions': 'error',
|
|
'prefer-const': 'error',
|
|
'no-var': 'error',
|
|
|
|
// Style rules
|
|
'indent': ['error', 2],
|
|
'quotes': ['error', 'single'],
|
|
'semi': ['error', 'always'],
|
|
'comma-dangle': ['error', 'always-multiline'],
|
|
'object-curly-spacing': ['error', 'always'],
|
|
'array-bracket-spacing': ['error', 'never'],
|
|
},
|
|
},
|
|
|
|
// Specific configuration for test files
|
|
{
|
|
files: ['**/*.test.ts', '**/*.spec.ts', 'src/tests/**/*.ts'],
|
|
languageOptions: {
|
|
parser: tsparser,
|
|
parserOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: 'module',
|
|
},
|
|
globals: {
|
|
console: 'readonly',
|
|
process: 'readonly',
|
|
Buffer: 'readonly',
|
|
global: 'writable',
|
|
describe: 'readonly',
|
|
it: 'readonly',
|
|
test: 'readonly',
|
|
expect: 'readonly',
|
|
beforeEach: 'readonly',
|
|
afterEach: 'readonly',
|
|
beforeAll: 'readonly',
|
|
afterAll: 'readonly',
|
|
jest: 'readonly',
|
|
require: 'readonly',
|
|
},
|
|
},
|
|
plugins: {
|
|
'@typescript-eslint': tseslint,
|
|
},
|
|
rules: {
|
|
// Allow console.log in tests
|
|
'no-console': 'off',
|
|
// Allow any in tests for mocking
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
// Allow unused vars in tests (for setup)
|
|
'@typescript-eslint/no-unused-vars': 'off',
|
|
},
|
|
},
|
|
|
|
// Configuration for JavaScript files (if any)
|
|
{
|
|
files: ['**/*.js', '**/*.mjs'],
|
|
languageOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: 'module',
|
|
},
|
|
rules: {
|
|
'no-console': 'warn',
|
|
'no-debugger': 'error',
|
|
'prefer-const': 'error',
|
|
'no-var': 'error',
|
|
},
|
|
},
|
|
|
|
// Files and directories to ignore
|
|
{
|
|
ignores: [
|
|
'node_modules/**',
|
|
'build/**',
|
|
'dist/**',
|
|
'*.config.js',
|
|
'coverage/**',
|
|
'.git/**',
|
|
'.vscode/**',
|
|
'*.min.js',
|
|
],
|
|
},
|
|
];
|