-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
109 lines (105 loc) · 3.65 KB
/
eslint.config.mjs
File metadata and controls
109 lines (105 loc) · 3.65 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
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
import jseslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import tsParser from '@typescript-eslint/parser';
import pPromise from 'eslint-plugin-promise';
import pImport from 'eslint-plugin-import';
import pNode from 'eslint-plugin-node';
import globals from 'globals';
export default tseslint.config(
{ ignores: ['vite.config.mjs', 'newrelic.js', 'dist', 'coverage', 'node_modules'] },
pPromise.configs['flat/recommended'],
jseslint.configs.recommended,
tseslint.configs.recommended,
{
files: ['**/*.ts'],
languageOptions: {
globals: { ...globals.node },
ecmaVersion: 'latest',
sourceType: 'module',
parser: tsParser,
parserOptions: {
project: './tsconfig.json',
},
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts'],
},
},
plugins: {
import: pImport,
node: pNode,
promise: pPromise,
},
rules: {
...pImport.configs.typescript.rules,
'quotes': ['error', 'single'],
// Import Rules
'import/no-duplicates': 'warn',
'import/no-cycle': 'error',
// General Code Style
'object-curly-spacing': ['error', 'always'],
'max-len': [
'warn',
{
code: 100,
tabWidth: 2,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
},
],
// TypeScript Specific
'@typescript-eslint/consistent-generic-constructors': 'warn',
'@typescript-eslint/consistent-indexed-object-style': 'warn',
'@typescript-eslint/consistent-type-definitions': 'error',
'@typescript-eslint/consistent-type-exports': 'warn',
'@typescript-eslint/consistent-type-imports': 'warn',
'@typescript-eslint/default-param-last': 'error',
'@typescript-eslint/method-signature-style': 'warn',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'variableLike',
format: ['camelCase', 'UPPER_CASE'],
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
],
'@typescript-eslint/no-array-constructor': 'error',
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
'@typescript-eslint/no-confusing-void-expression': 'error',
'@typescript-eslint/no-duplicate-type-constituents': 'warn',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-extra-non-null-assertion': 'error',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/no-redundant-type-constituents': 'warn',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'warn',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{
ignoreRestSiblings: true,
args: 'none',
},
],
'@typescript-eslint/no-useless-constructor': 'warn',
'@typescript-eslint/only-throw-error': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/require-await': 'error',
'@typescript-eslint/return-await': 'error',
// Disabled/Modified Rules
'@typescript-eslint/no-use-before-define': 'off',
'require-await': 'off',
},
},
);