-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypescript.js
82 lines (76 loc) · 2.39 KB
/
typescript.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
require('@rushstack/eslint-patch/modern-module-resolution');
/** @type {import('@typescript-eslint/experimental-utils').TSESLint.Linter.Config} */
const eslintConfigTypescript = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
rules: {
/**
* Require explicit return types on functions and class methods
*
* @see https://typescript-eslint.io/rules/explicit-module-boundary-types
*/
'@typescript-eslint/explicit-module-boundary-types': 'warn',
/**
* Require a consistent member declaration order.
*
* @see https://typescript-eslint.io/rules/member-ordering
*/
'@typescript-eslint/member-ordering': 'error',
/**
* Disallow unused variables.
*
* Exceptions:
* - Variables that start with an underscore
* - Rest siblings
* - Caught errors
*
* @see https://typescript-eslint.io/rules/no-unused-vars
*/
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
caughtErrors: 'all',
},
],
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/prefer-ts-expect-error': 'error',
/**
* By default, the `recommended-type-checked` config includes
* the require-await rule. This rule disallows async functions
* which have no await expression.
*
* This rule is disabled because it is incompatible with
* Fastify plugins, which are async functions that do not
* await anything.
*
* Sometimes it's necessary to make asynchronous function
* calls without awaiting them. For example, when making
* a function that will later need to use await.
*/
'@typescript-eslint/require-await': 'off',
},
overrides: [
{
files: ['**/*.test.ts'],
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-var-requires': 'off',
},
},
{
files: ['*.js'],
extends: ['plugin:@typescript-eslint/disable-type-checked'],
},
],
};
// eslint-disable-next-line no-undef
module.exports = eslintConfigTypescript;