forked from aws/aws-toolkit-vscode
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.js
119 lines (119 loc) · 5.48 KB
/
.eslintrc.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
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
env: {
node: true,
mocha: true,
},
plugins: ['@typescript-eslint', 'header', 'no-null'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/recommended',
'prettier',
],
rules: {
curly: 2, // Enforce braces on "if"/"for"/etc.
'id-length': [
'error',
{
min: 1,
max: 40,
exceptionPatterns: [
'^codecatalyst_', // CodeCatalyst telemetry names are verbose :(
],
},
],
// https://typescript-eslint.io/rules/naming-convention/
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: ['camelCase', 'PascalCase'],
// Allow underscores.
leadingUnderscore: 'allowSingleOrDouble',
trailingUnderscore: 'allowSingleOrDouble',
},
// Allow object properties, enums, and methods to have any format:
// {
// 'foo-1-2-3': 42,
// }
// https://github.com/typescript-eslint/typescript-eslint/issues/1483#issuecomment-733421303
{
selector: ['objectLiteralProperty', 'classMethod', 'enumMember'],
format: null,
// modifiers: ['requiresQuotes'],
},
],
// Avoid accidental use of "==" instead of "===".
eqeqeq: 'error',
// TODO reenable this rule (by removing this off)
'no-async-promise-executor': 'off',
// TODO reenable this rule (by removing this off)
'@typescript-eslint/no-misused-promises': 'off',
// TODO reenable this rule (by removing this off)
'@typescript-eslint/prefer-regexp-exec': 'off',
// TODO reenable this rule (by removing this off)
'no-async-promise-executors': 'off',
// TODO reenable this rule (by removing this off)
'@typescript-eslint/consistent-type-assertions': 'off',
// TODO reenable this rule (by removing this off)
'@typescript-eslint/ban-ts-ignore': 'off',
// TODO rennable this rule (by removing this off)
'@typescript-eslint/class-name-casing': 'off',
// TODO rennable this rule (by removing this off)
'@typescript-eslint/no-inferrable-types': 'off',
// TODO rennable this rule (by removing this off)
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
// TODO rennable this rule (by removing this off)
// this is another troublesome one, producing ~600 issues
'@typescript-eslint/no-use-before-define': 'off',
// TODO rennable this rule (by removing this off)
'no-useless-escape': 'off',
// TODO rennable this rule (by removing this off)
'@typescript-eslint/require-await': 'off',
// TODO rennable this rule (by removing this off)
'@typescript-eslint/no-non-null-assertion': 'off',
// TODO rennable this rule (by removing this off)
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
// TODO rennable this rule (by removing this off)
'@typescript-eslint/explicit-function-return-type': 'off',
// TODO reenable this rule, tests mostly break this one (by changing off to error)
// This currently produces 700 non fixable by --fix errors
'sort-imports': 'off',
'@typescript-eslint/no-namespace': 'error',
// This is off because prettier takes care of it
'no-extra-semi': 'off',
'no-null/no-null': 'error',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-unused-vars': 'off',
// New rules --> New TODOs
'@typescript-eslint/no-var-requires': 'off', // Should be able to remove with the full migration of SDK v3
'@typescript-eslint/no-unsafe-member-access': 'off', // use typeguard before accessing a member
'@typescript-eslint/no-unsafe-assignment': 'off', // 112 errors, similar to above
'@typescript-eslint/no-unsafe-return': 'off', // 26 errors, similar to above
'@typescript-eslint/no-unsafe-call': 'off', // 24 errors, need types for imported constructors
'@typescript-eslint/restrict-template-expressions': 'off', // 294 errors, forces template literals to be a certain type
'@typescript-eslint/no-floating-promises': 'off', // 274 errors, promises should catch errors or be awaited
'@typescript-eslint/ban-ts-comment': 'off', // 27 errors, bans compiler error exceptions
'@typescript-eslint/explicit-module-boundary-types': 'off', // Remove this once 'explicit-function-return-type' is on
// Do not check loops so while(true) works. Potentially reevalute this.
'no-constant-condition': ['error', { checkLoops: false }],
'no-empty': 'off',
'header/header': [
'error',
'block',
{
pattern:
'Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\\r?\\n \\* SPDX-License-Identifier: Apache-2.0',
},
{ lineEndings: 'unix' },
],
},
}