-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy patheslint.config.mjs
More file actions
84 lines (81 loc) · 2.31 KB
/
eslint.config.mjs
File metadata and controls
84 lines (81 loc) · 2.31 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
75
76
77
78
79
80
81
82
83
84
// eslint.config.mjs
import chaiFriendly from 'eslint-plugin-chai-friendly';
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import prettier from 'eslint-config-prettier';
import globals from 'globals';
const jsLanguageOptions = {
globals: {
// Add any specific globals you need
...globals.node,
},
};
const tsLanguageOptions = {
parser: tseslint.parser,
parserOptions: {
project: './tsconfig.json',
},
ecmaVersion: 2015,
sourceType: 'module',
globals: {
// Add any specific globals you need
...globals.node,
},
};
export default [
{
ignores: [
// don't ever lint node_modules
'**/node_modules/**',
// don't lint build output (make sure
// it's set to your correct build folder name)
'dist/**',
],
},
{
// Javascript files like build and config scripts
files: ['**/*.js'],
...js.configs.recommended,
languageOptions: jsLanguageOptions,
},
// Recommended rules config array must only apply
// to Typescript files, not plain Javascript, and
// should use same language options as
...tseslint.configs.recommended.map((config) => ({
files: ['**/*.ts', '**/*.tsx'],
...config,
languageOptions: tsLanguageOptions,
})),
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: tsLanguageOptions,
plugins: {
'@typescript-eslint': tseslint.plugin,
'chai-friendly': chaiFriendly,
},
rules: {
...prettier.rules,
'@typescript-eslint/no-explicit-any': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
// For backwards compatibility with older recommended rules
// in eslint/typescript-eslint, based on existing "disable"
// directives
'@typescript-eslint/no-non-null-assertion': 'error',
// Turn off the "no-unused-expressions" default rules...
'no-unused-expressions': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
// ... and turn on the chai-friendly version
'chai-friendly/no-unused-expressions': 'error',
// Disallow using an async function as a Promise executor
'no-async-promise-executor': 'error',
},
},
];