Skip to content

Commit 481f25d

Browse files
authored
issue #4526 Replace TSLint with ESLint (#4857)
* replace tslint with eslint * eslint fixes * eslint fixes * fix tsc-compiler * eslint fixes * update tsconfig * update configs * eslint fixes * eslint fixes * remove tslint * eslint fixes * tsconfig update * fix patterns test * update config * fix tests * fix settings test * fix settings test * run prettier for all files * eslint fix * update .prettierignore * revert html changes * fix contact store tests * fix test parse * update prettier config * update codeql config * update codeql config * add gitguardian config * update gitguardian config * remove gitguardian config * remove unused files * disable prettier for extension lib and types * enable trailingComma rule * pr fixes * change printWidth to 160
1 parent 632270e commit 481f25d

File tree

337 files changed

+21439
-24109
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

337 files changed

+21439
-24109
lines changed

.eslintrc.js

+141-36
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,161 @@ module.exports = {
44
browser: true,
55
node: true,
66
commonjs: true,
7-
es6: true
7+
es6: true,
88
},
99
globals: {
10-
'$': false,
11-
'chrome': false,
12-
'OpenPGP': false
10+
$: false,
11+
chrome: false,
12+
OpenPGP: false,
13+
},
14+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
15+
ignorePatterns: ['.eslintrc.js'],
16+
parserOptions: {
17+
project: 'tsconfig.json',
18+
sourceType: 'module',
1319
},
14-
extends: [
15-
'eslint:recommended',
16-
'plugin:@typescript-eslint/base'
17-
// 'plugin:@typescript-eslint/recommended'
18-
],
1920
plugins: [
2021
'no-only-tests',
21-
'header'
22+
'header',
23+
'eslint-plugin-jsdoc',
24+
'eslint-plugin-prefer-arrow',
25+
'eslint-plugin-import',
26+
'eslint-plugin-no-null',
27+
'eslint-plugin-local-rules',
28+
'@typescript-eslint',
2229
],
30+
root: true,
2331
rules: {
32+
'@typescript-eslint/consistent-type-assertions': 'error',
33+
'@typescript-eslint/consistent-type-definitions': 'off',
34+
'@typescript-eslint/dot-notation': 'error',
35+
'@typescript-eslint/explicit-function-return-type': 'off',
36+
'@typescript-eslint/explicit-member-accessibility': [
37+
'error',
38+
{
39+
accessibility: 'explicit',
40+
},
41+
],
42+
'@typescript-eslint/explicit-module-boundary-types': 'off',
43+
'@typescript-eslint/member-ordering': 'error',
44+
'@typescript-eslint/naming-convention': [
45+
'error',
46+
{
47+
selector: 'default',
48+
format: ['camelCase'],
49+
leadingUnderscore: 'allow',
50+
trailingUnderscore: 'allow',
51+
},
52+
{
53+
selector: 'variable',
54+
format: ['camelCase', 'UPPER_CASE'],
55+
leadingUnderscore: 'allow',
56+
trailingUnderscore: 'allow',
57+
},
58+
{
59+
selector: 'typeLike',
60+
format: ['PascalCase'],
61+
},
62+
{
63+
selector: ['classProperty', 'objectLiteralProperty', 'typeProperty', 'classMethod', 'objectLiteralMethod', 'typeMethod', 'accessor', 'enumMember'],
64+
format: null,
65+
modifiers: ['requiresQuotes'],
66+
},
67+
{
68+
selector: ['classProperty'],
69+
format: ['camelCase', 'UPPER_CASE'],
70+
leadingUnderscore: 'allow',
71+
},
72+
],
73+
'@typescript-eslint/no-empty-function': 'error',
74+
'@typescript-eslint/no-empty-interface': 'off',
75+
'@typescript-eslint/no-explicit-any': ['warn'],
76+
'@typescript-eslint/no-floating-promises': 'error',
77+
'@typescript-eslint/no-misused-new': 'error',
78+
'@typescript-eslint/no-namespace': 'off',
79+
'@typescript-eslint/no-parameter-properties': 'off',
80+
'@typescript-eslint/no-shadow': 'off',
81+
'@typescript-eslint/no-unsafe-return': 'error',
2482
'@typescript-eslint/no-unused-vars': ['error'],
25-
'@typescript-eslint/semi': ['error'],
26-
"@typescript-eslint/no-explicit-any": ['warn'],
27-
'indent': ['error', 2, { SwitchCase: 1 }],
28-
'max-len': ['error', { code: 190 }],
83+
'@typescript-eslint/no-unused-expressions': 'error',
84+
'@typescript-eslint/no-use-before-define': 'off',
85+
'@typescript-eslint/no-var-requires': 'error',
86+
'@typescript-eslint/prefer-for-of': 'error',
87+
'@typescript-eslint/prefer-function-type': 'error',
88+
'@typescript-eslint/prefer-namespace-keyword': 'error',
89+
'@typescript-eslint/type-annotation-spacing': 'off',
90+
'@typescript-eslint/typedef': 'off',
91+
'@typescript-eslint/unbound-method': 'error',
92+
'@typescript-eslint/unified-signatures': 'error',
93+
complexity: 'off',
94+
'constructor-super': 'error',
95+
'dot-notation': 'error',
96+
eqeqeq: ['error', 'smart'],
97+
'guard-for-in': 'error',
98+
'header/header': ['error', 'block', ' ©️ 2016 - present FlowCrypt a.s. Limitations apply. Contact [email protected] '],
99+
'id-denylist': 'error',
100+
'id-match': 'error',
101+
'import/order': 'off',
102+
'jsdoc/check-alignment': 'off',
103+
'jsdoc/check-indentation': 'off',
104+
'jsdoc/newline-after-description': 'off',
105+
'max-classes-per-file': 'off',
106+
'no-bitwise': 'off',
107+
'no-caller': 'error',
108+
'no-cond-assign': 'error',
109+
'no-console': 'off',
29110
'no-constant-condition': 0,
111+
'no-control-regex': 0,
112+
'no-debugger': 'error',
113+
'no-empty': 'error',
114+
'no-empty-function': 'error',
115+
'no-empty-pattern': 0,
116+
'no-eval': 'error',
117+
'no-fallthrough': 0,
118+
'no-invalid-this': 'off',
119+
'no-new-wrappers': 'error',
120+
'no-null/no-null': 'error',
121+
'no-only-tests/no-only-tests': ['error', { block: ['ava.default'] }],
30122
'no-prototype-builtins': 0,
123+
'no-shadow': 'off',
124+
'no-throw-literal': 'error',
125+
'no-undef': 0,
126+
'no-undef-init': 'error',
127+
'no-underscore-dangle': 'error',
128+
'no-unsafe-finally': 'error',
129+
'no-unused-expressions': 'off',
130+
'no-unused-labels': 'error',
31131
'no-unused-vars': 0,
132+
'no-use-before-define': 'off',
32133
'no-useless-escape': 0,
33-
'no-only-tests/no-only-tests': ['error', { block: ['ava.default'] }],
134+
'no-var': 'error',
135+
'object-shorthand': 'error',
136+
'one-var': ['off', 'never'],
137+
'prefer-arrow/prefer-arrow-functions': 'error',
138+
'prefer-const': [
139+
'error',
140+
{
141+
destructuring: 'all',
142+
},
143+
],
144+
radix: 'off',
34145
'require-atomic-updates': 0,
35-
'no-empty-pattern': 0,
36-
'no-fallthrough': 0,
37-
'no-undef': 0,
38-
'no-control-regex': 0,
39-
'prefer-const': ['error', {
40-
destructuring: 'all',
41-
}],
42-
'semi': 0,
43-
'sort-imports': ['off', {
44-
"ignoreCase": false,
45-
"ignoreDeclarationSort": false,
46-
"ignoreMemberSort": false,
47-
"memberSyntaxSortOrder": ["none", "all", "multiple", "single"]
48-
}],
49-
'space-before-blocks': ['error', 'always'],
146+
'sort-imports': 'off',
147+
'spaced-comment': [
148+
'error',
149+
'always',
150+
{
151+
markers: ['/'],
152+
},
153+
],
154+
'local-rules/standard-loops': 'error',
50155
},
51156
overrides: [
52157
{
53-
'files': ['./extension/**/*.ts', './test/**/*.ts'],
54-
'rules': {
55-
'header/header': ['error', 'block', ' ©️ 2016 - present FlowCrypt a.s. Limitations apply. Contact [email protected] ']
56-
}
57-
}
58-
]
158+
files: './test/**/*.ts',
159+
rules: {
160+
'@typescript-eslint/no-unused-expressions': 'off',
161+
},
162+
},
163+
],
59164
};

.github/codeql/codeql-config.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
paths-ignore:
2+
- node_modules
3+
- 'test/source/**/*.ts'

.github/workflows/codeql-analysis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
- name: Initialize CodeQL
4141
uses: github/codeql-action/init@v1
4242
with:
43+
config-file: ./.github/codeql/codeql-config.yml
4344
languages: ${{ matrix.language }}
4445
# If you wish to specify custom queries, you can do so here or in a config file.
4546
# By default, queries listed here will override any specified in a config file.
@@ -63,4 +64,4 @@ jobs:
6364
# make release
6465

6566
- name: Perform CodeQL Analysis
66-
uses: github/codeql-action/analyze@v1
67+
uses: github/codeql-action/analyze@v1

.jsbeautifyrc

-31
This file was deleted.

.npmrc

-1
This file was deleted.

.prettierignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
build/*
2+
extension/lib
3+
extension/types
4+
*.css
5+
*.htm
6+
*.html
7+
*.md
8+
*.yml

.prettierrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
printWidth: 160
2+
semi: true
3+
singleQuote: true
4+
endOfLine: 'auto'
5+
arrowParens: 'avoid'

.semaphore/semaphore.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ blocks:
3030
jobs:
3131
- name: code quality
3232
commands:
33-
- npm run-script test_tslint
3433
- npm run-script test_eslint
3534
- npm run-script test_stylelint
3635
- npm run-script test_patterns
@@ -96,4 +95,4 @@ blocks:
9695
if [ -f build/test/test/debugArtifacts/debugHtmlAttachment-0.html ]; then
9796
echo "Uploading debug files as job artifacts..."
9897
artifact push job build/test/test/debugArtifacts/debugHtmlAttachment-0.html
99-
fi
98+
fi

.stylelintrc.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"extends": "stylelint-config-standard",
3-
"ignoreFiles": [
4-
"**/*.js",
5-
"**/*.ts"
6-
],
3+
"ignoreFiles": ["**/*.js", "**/*.ts"],
74
"rules": {
85
"alpha-value-notation": null,
96
"color-function-notation": null,
@@ -15,4 +12,4 @@
1512
"string-quotes": null,
1613
"value-no-vendor-prefix": null
1714
}
18-
}
15+
}

.vscode/launch.json

+14-26
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
"UNIT-TESTS",
1717
"--retry=false",
1818
"--debug",
19-
"--pool-size=1",
19+
"--pool-size=1"
2020
],
2121
"outputCapture": "std",
22-
"skipFiles": [
23-
"<node_internals>/**/*.js"
24-
]
22+
"skipFiles": ["<node_internals>/**/*.js"]
2523
},
2624
{
2725
"type": "node",
@@ -38,12 +36,10 @@
3836
"UNIT-TESTS",
3937
"--retry=false",
4038
"--debug",
41-
"--pool-size=1",
39+
"--pool-size=1"
4240
],
4341
"outputCapture": "std",
44-
"skipFiles": [
45-
"<node_internals>/**/*.js"
46-
]
42+
"skipFiles": ["<node_internals>/**/*.js"]
4743
},
4844
{
4945
"type": "node",
@@ -60,12 +56,10 @@
6056
"STANDARD-GROUP",
6157
"--retry=false",
6258
"--debug",
63-
"--pool-size=1",
59+
"--pool-size=1"
6460
],
6561
"outputCapture": "std",
66-
"skipFiles": [
67-
"<node_internals>/**/*.js"
68-
]
62+
"skipFiles": ["<node_internals>/**/*.js"]
6963
},
7064
{
7165
"type": "node",
@@ -82,12 +76,10 @@
8276
"FLAKY-GROUP",
8377
"--retry=false",
8478
"--debug",
85-
"--pool-size=1",
79+
"--pool-size=1"
8680
],
8781
"outputCapture": "std",
88-
"skipFiles": [
89-
"<node_internals>/**/*.js"
90-
]
82+
"skipFiles": ["<node_internals>/**/*.js"]
9183
},
9284
{
9385
"type": "node",
@@ -104,12 +96,10 @@
10496
"STANDARD-GROUP",
10597
"--retry=false",
10698
"--debug",
107-
"--pool-size=1",
99+
"--pool-size=1"
108100
],
109101
"outputCapture": "std",
110-
"skipFiles": [
111-
"<node_internals>/**/*.js"
112-
]
102+
"skipFiles": ["<node_internals>/**/*.js"]
113103
},
114104
{
115105
"type": "node",
@@ -126,12 +116,10 @@
126116
"STANDARD-GROUP",
127117
"--retry=false",
128118
"--debug",
129-
"--pool-size=1",
119+
"--pool-size=1"
130120
],
131121
"outputCapture": "std",
132-
"skipFiles": [
133-
"<node_internals>/**/*.js"
134-
]
135-
},
122+
"skipFiles": ["<node_internals>/**/*.js"]
123+
}
136124
]
137-
}
125+
}

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
{}

0 commit comments

Comments
 (0)