generated from JoshuaKGoldberg/create-typescript-app
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
126 lines (109 loc) · 3.24 KB
/
eslint.config.js
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
116
117
118
119
120
121
122
123
124
125
126
import eslint from '@eslint/js';
import stylistic from '@stylistic/eslint-plugin';
import n from 'eslint-plugin-n';
import perfectionist from 'eslint-plugin-perfectionist';
import tseslint from 'typescript-eslint';
export default tseslint.config(
{
ignores: ['dist', 'node_modules', 'package-lock.json', '**/*.snap'],
},
{
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
},
eslint.configs.recommended,
perfectionist.configs['recommended-natural'],
n.configs['flat/recommended'],
...tseslint.config({
extends: tseslint.configs.recommendedTypeChecked,
files: ['**/*.js', '**/*.ts'],
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject: ['*.js', '.*.js'],
},
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
'@stylistic': stylistic,
},
rules: {
'@stylistic/lines-around-comment': [
'warn',
{
allowArrayStart: true,
allowBlockStart: true,
allowClassStart: true,
allowInterfaceStart: true,
// these conflict with prettier, so we must allow them
allowObjectStart: true,
allowTypeStart: true,
beforeBlockComment: true,
},
],
'@stylistic/lines-between-class-members': 'error',
'@stylistic/padding-line-between-statements': [
'error',
{blankLine: 'always', next: 'export', prev: '*'},
],
'@stylistic/semi': ['error', 'always'],
'@typescript-eslint/consistent-type-exports': [
'error',
{fixMixedExportsWithInlineTypeSpecifier: true},
],
'@typescript-eslint/consistent-type-imports': [
'error',
{
disallowTypeAnnotations: true,
fixStyle: 'inline-type-imports',
prefer: 'type-imports',
},
],
// and sometimes you gotta use any
'@typescript-eslint/no-explicit-any': 'off',
// this rule seems broken
'@typescript-eslint/no-invalid-void-type': 'off',
// HATE IT
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': [
'error',
{
allowComparingNullableBooleansToFalse: true,
allowComparingNullableBooleansToTrue: true,
},
],
// too many false positives
'@typescript-eslint/no-unnecessary-condition': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
// these 6 bytes add up
'@typescript-eslint/require-await': 'off',
// I like my template expressions
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/unified-signatures': [
'error',
{
ignoreDifferentlyNamedParameters: true,
},
],
// seems to be incompatible with tshy
'n/no-extraneous-import': 'off',
'n/no-unpublished-import': 'off',
'no-use-before-define': 'off',
},
}),
{
files: ['test/**/*.ts'],
rules: {
'@typescript-eslint/no-floating-promises': 'off',
},
},
);