-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.cjs
127 lines (125 loc) · 4.37 KB
/
.eslintrc.cjs
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
127
// See https://typescript-eslint.io/play/#ts=5.1.6&showAST=es&fileType=.ts
const contexts = [
// All methods in an interface
'TSInterfaceDeclaration TSMethodSignature',
// All public methods in a class that does not implement an interface
'ClassDeclaration[implements.length=0] MethodDefinition[accessibility=public]',
// TODO: All methods public by default in a class that does not implement an interface
// 'ClassDeclaration[implements.length=0] MethodDefinition[accessibility=undefined][key.type=Identifier]',
// TODO: All export const from the top level of a file
// 'ExportNamedDeclaration[declaration.type=VariableDeclaration]',
// Legacy contexts (needs review)
'TSParameterProperty[accessibility=public]',
'TSPropertySignature',
'PropertySignature',
'TSInterfaceDeclaration',
'InterfaceDeclaration',
'TSPropertyDefinition[accessibility=public]',
'PropertyDefinition[accessibility=public]',
'TSTypeAliasDeclaration',
'TypeAliasDeclaration',
'TSTypeDeclaration',
'TypeDeclaration',
'TSEnumDeclaration',
'EnumDeclaration',
'TSClassDeclaration',
'ClassDeclaration',
'TSClassExpression',
'ClassExpression',
'TSFunctionExpression',
'FunctionExpression',
'TSInterfaceExpression',
'InterfaceExpression',
'TSEnumExpression',
'EnumExpression',
];
const JSDOC_RULES_LEVEL = 'error';
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'prettier',
],
settings: {
'import/resolver': {
typescript: true,
node: true,
},
},
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc', 'jsdoc', 'no-only-tests'],
overrides: [
{
files: ['*.cts', '*.mts', '*.ts', '*.tsx'],
parserOptions: {
// hacky workaround for CI not having the same tsconfig setup
project: true,
},
},
{
files: '*.test.ts',
rules: {
'jsdoc/require-jsdoc': 'off',
},
},
],
env: {
node: true,
},
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/no-floating-promises': 2,
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'require-await': 2,
'no-console': 'error',
'no-constant-condition': 'off',
curly: ['error', 'all'],
camelcase: 2,
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['client-dest'],
message: "Fix this absolute garbage import. It's your duty to solve it before it spreads.",
},
{
group: ['dest'],
message: 'You should not be importing from a build directory. Did you accidentally do a relative import?',
},
],
},
],
'import/no-extraneous-dependencies': 'error',
'import/no-cycle': 'warn',
'tsdoc/syntax': JSDOC_RULES_LEVEL,
'jsdoc/require-jsdoc': [
JSDOC_RULES_LEVEL,
{
contexts,
checkConstructors: false,
checkGetters: true,
checkSetters: true,
},
],
'jsdoc/require-description': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-hyphen-before-param-description': [JSDOC_RULES_LEVEL],
'jsdoc/require-param': [JSDOC_RULES_LEVEL, { contexts, checkDestructured: false }],
'jsdoc/require-param-description': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-param-name': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-property': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-property-description': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-property-name': [JSDOC_RULES_LEVEL, { contexts }],
'jsdoc/require-returns': 'off',
// this unfortunately doesn't block `fit` and `fdescribe`
'no-only-tests/no-only-tests': ['error'],
},
ignorePatterns: ['node_modules', 'dest*', 'dist', '*.js', '.eslintrc.cjs'],
};