-
Notifications
You must be signed in to change notification settings - Fork 3
/
eslint.config.js
45 lines (44 loc) · 1.74 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// eslint.config.js
import typescriptParser from '@typescript-eslint/parser';
import typescriptPlugin from '@typescript-eslint/eslint-plugin';
export default [
{
files: ['**/*.ts', '**/*.tsx'], // Specify the files to apply this config
languageOptions: {
parser: typescriptParser, // Specify the ESLint parser for TypeScript
parserOptions: {
ecmaVersion: 2021, // Allow modern ECMAScript features
sourceType: 'module', // Allow the use of ES modules
},
},
plugins: {
'@typescript-eslint': typescriptPlugin,
},
rules: {
// Core TypeScript rules
'@typescript-eslint/no-unused-vars': 'warn', // Quick scan for unused variables
'no-undef': 'warn', // Prevent use of undefined variables
'@typescript-eslint/no-redeclare': 'warn', // Prevent variable redeclaration
'no-extra-semi': 'warn', // Check for unnecessary semicolons
'no-constant-condition': 'warn', // Warn about constant conditions in control statements
'no-console': 'off', // Allow console.log
},
},
{
files: ['**/*.js', '**/*.jsx'], // Specify the files to apply this config for JavaScript
languageOptions: {
parserOptions: {
ecmaVersion: 2021, // Allow modern ECMAScript features
sourceType: 'module', // Allow the use of ES modules
},
},
rules: {
'no-unused-vars': 'warn', // Warn about unused variables
'no-undef': 'warn', // Prevent use of undefined variables
'no-redeclare': 'warn', // Prevent variable redeclaration
'no-extra-semi': 'warn', // Check for unnecessary semicolons
'no-constant-condition': 'warn', // Warn about constant conditions in control statements
'no-console': 'off', // Allow console.log
},
},
];