-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
74 lines (72 loc) · 1.96 KB
/
eslint.config.js
File metadata and controls
74 lines (72 loc) · 1.96 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';
import typescriptEslintPlugin from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const compat = new FlatCompat({ baseDirectory: __dirname });
export default [
js.configs.recommended,
...compat.extends('plugin:@typescript-eslint/recommended'),
...compat.extends('prettier'),
// TypeScript source files
{
files: ['src/**/*.ts', 'src/**/*.tsx'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: './tsconfig.json',
},
},
plugins: {
'@typescript-eslint': typescriptEslintPlugin,
},
rules: {
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-throw-literal': 'off',
'lines-between-class-members': 'off',
'@typescript-eslint/lines-between-class-members': 'off',
},
},
// TypeScript test files
{
files: ['tests/**/*.ts', 'tests/**/*.tsx'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: './tsconfig.test.json',
},
},
plugins: {
'@typescript-eslint': typescriptEslintPlugin,
},
rules: {
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-throw-literal': 'off',
'lines-between-class-members': 'off',
'@typescript-eslint/lines-between-class-members': 'off',
},
},
{
files: ['src/index.ts'],
rules: {
'no-restricted-exports': 'off',
},
},
{
ignores: ['dist', 'coverage'],
},
{
rules: {
'prefer-arrow-callback': 'error',
'func-names': 'off',
'no-use-before-define': 'off',
'require-await': 'error',
},
},
];