-
Notifications
You must be signed in to change notification settings - Fork 7
/
eslint.config.mjs
116 lines (112 loc) · 2.98 KB
/
eslint.config.mjs
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// eslint.config.js
import globals from "globals";
import typescriptParser from '@typescript-eslint/parser';
import typescriptPlugin from '@typescript-eslint/eslint-plugin';
import eslint from '@eslint/js';
export default [
{
files: [
'src/**/*.ts',
],
ignores: ['dist/**/*', 'jest.config.ts'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 6,
node: true,
project: './tsconfig.json',
},
globals: {
...globals.browser,
Parse: true,
},
},
plugins: {
'@typescript-eslint': typescriptPlugin,
},
rules: {
...eslint.configs.recommended.rules,
...typescriptPlugin.configs.recommended.rules,
// Stuff to re-evaluate later
// '@typescript-eslint/require-ts-comment-description' : 'error',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
eqeqeq: 'error',
'no-invalid-this': 'error',
'no-return-assign': 'error',
'no-unused-expressions': [
'error',
{
allowTernary: true,
},
],
// 'no-unused-vars': [
// 'error', {
// 'args': 'after-used'
// }
// ],
curly: ['error', 'all'],
'no-useless-concat': 'error',
'no-useless-return': 'error',
'init-declarations': 'error',
'no-use-before-define': 'error',
'no-lonely-if': 'error',
'no-unneeded-ternary': 'error',
'no-whitespace-before-property': 'error',
'nonblock-statement-body-position': 'error',
'no-confusing-arrow': 'error',
'no-duplicate-imports': 'error',
'no-var': 'error',
'object-shorthand': 'error',
'prefer-const': 'error',
'prefer-template': 'error',
},
},
{
// spec files
files: [
'spec/**/*.spec.ts',
],
ignores: ['dist/**/*', 'jest.config.ts'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 6,
node: true,
project: './tsconfig.json',
},
globals: {
...globals.node,
...globals.browser,
...globals.jest,
Parse: true,
},
},
plugins: {
'@typescript-eslint': typescriptPlugin,
},
rules: {
'no-undef': 'off',
},
},
{
// Configuration for JavaScript files
files: ['src/**/*.js'],
ignores: ['dist/**/*', '.eslintrc.js'],
languageOptions: {
ecmaVersion: 2022,
globals: {
...globals.browser,
Parse: true,
},
},
rules: {
...eslint.configs.recommended.rules
},
},
{
ignores: ['dist/**/*', 'coverage/**/*', '.eslintrc.js'],
}
]