Repository navigation
Expand file tree
/
Copy patheslint.config.js
More file actions
51 lines (42 loc) · 1.51 KB
/
Copy patheslint.config.js
File metadata and controls
51 lines (42 loc) · 1.51 KB
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
46
47
48
49
50
51
/**
* eslint.config.js
*
* ESLint configuration using the "flat config" format (ESLint 9+).
*
* What is ESLint ?
* ----------------
* ESLint is a "linter" — a tool that scans your code and reports potential
* problems without running it. It catches things like :
* - Variables declared but never used
* - Missing `await` before async calls
* - Inconsistent code style
*
* Run it with : npm run lint
*
* The @typescript-eslint rules extend ESLint with TypeScript-aware checks.
*/
import tseslint from 'typescript-eslint'
export default tseslint.config(
...tseslint.configs.recommended,
{
// Apply these rules to all TypeScript source files.
files: ['src/**/*.ts'],
rules: {
// Allow `_` prefixed variables to be intentionally unused.
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
// `any` is sometimes unavoidable at boundary points.
'@typescript-eslint/no-explicit-any': 'warn',
// Require consistent use of `type` for type-only imports.
'@typescript-eslint/consistent-type-imports': 'error',
// Avoid floating promises (missing await).
'@typescript-eslint/no-floating-promises': 'error',
// Disallow using a variable before it is defined.
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error', { functions: false }],
},
},
{
// Exclude compiled output and third-party code.
ignores: ['dist/', 'node_modules/', 'jest.config.js', 'eslint.config.js'],
}
)