-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patheslint.config.mjs
More file actions
109 lines (94 loc) · 2.66 KB
/
Copy patheslint.config.mjs
File metadata and controls
109 lines (94 loc) · 2.66 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 js from '@eslint/js'
import { defineConfig } from 'eslint/config'
import tseslint from 'typescript-eslint'
import stylistic from '@stylistic/eslint-plugin'
/* eslint-disable quote-props */
const baseRules = {
'eqeqeq': ['error', 'smart'],
'no-var': 'error',
'no-unneeded-ternary': 'error',
'arrow-parens': ['error', 'always'],
'quote-props': ['error', 'as-needed'],
}
const tsRules = {
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/require-await': 'error',
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-namespace': ['error', { allowDeclarations: true }],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'no-useless-constructor': 'off',
'require-await': 'off',
}
const stylisticRules = {
'@stylistic/comma-spacing': 'error',
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
'@stylistic/semi': ['error', 'never'],
'@stylistic/space-before-function-paren': [
'error',
{
anonymous: 'always',
named: 'never',
asyncArrow: 'always',
},
],
}
export default defineConfig([
{
extends: [js.configs.recommended],
rules: baseRules,
ignores: [
'dist/**',
'dist-es/**',
'generator-scripts/**',
'src/generated',
],
},
{
files: ['src/**/*.ts'],
ignores: ['src/generated/*.ts'],
extends: [tseslint.configs.recommendedTypeChecked],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
'@typescript-eslint': tseslint.plugin,
'@stylistic': stylistic,
},
rules: {
...tsRules,
...stylisticRules,
},
},
{
files: ['tests/**/*.ts'],
extends: [tseslint.configs.recommendedTypeChecked],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: './tests/tsconfig.json',
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
'@typescript-eslint': tseslint.plugin,
'@stylistic': stylistic,
},
rules: {
...tsRules,
...stylisticRules,
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'off'
},
},
])