Skip to content

Commit cd7ef5f

Browse files
authored
Merge pull request #1078 from minuteos/feat/migrate-to-eslint
Migrate to ESLint
2 parents 0df2d04 + 97532ea commit cd7ef5f

Some content is hidden

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

83 files changed

+2854
-2396
lines changed

.github/workflows/main.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
if: steps.cache-npm.outputs.cache-hit != 'true'
2323
run: |
2424
npm install
25-
25+
2626
build:
2727
name: Build
2828
needs: setup
@@ -58,4 +58,4 @@ jobs:
5858
path: ./node_modules
5959
key: npm-${{ hashFiles('./package-lock.json') }}
6060
- name: Lint Project
61-
run: ./node_modules/tslint/bin/tslint --project .
61+
run: npm run lint

.vscode/extensions.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"recommendations": [
33
"tobermory.es6-string-html",
4-
"ms-vscode.vscode-typescript-tslint-plugin"
4+
"dbaeumer.vscode-eslint"
55
]
66
}

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"editor.tabSize": 4,
44
"editor.insertSpaces": true,
55
"editor.useTabStops": false,
6-
"files.trimTrailingWhitespace": false,
6+
"eslint.useFlatConfig": true,
7+
"files.trimTrailingWhitespace": true,
78
"files.exclude": {
89
"out": false,
910
"dist": true,

eslint.config.mjs

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import eslint from '@eslint/js';
2+
import tseslint from 'typescript-eslint';
3+
import stylistic from '@stylistic/eslint-plugin';
4+
import globals from 'globals';
5+
6+
export default tseslint.config(
7+
{
8+
ignores: ['out/', 'dist/'],
9+
},
10+
eslint.configs.recommended,
11+
tseslint.configs.recommendedTypeChecked,
12+
stylistic.configs.customize({
13+
arrowParens: 'always',
14+
braceStyle: '1tbs',
15+
commaDangle: 'only-multiline',
16+
indent: 4,
17+
quotes: 'single',
18+
semi: 'always',
19+
}),
20+
{
21+
files: ['resources/*.js'],
22+
languageOptions: {
23+
globals: {
24+
acquireVsCodeApi: true, // available for VSCode WebViews
25+
},
26+
},
27+
},
28+
{
29+
languageOptions: {
30+
globals: {
31+
...globals.node,
32+
...globals.browser,
33+
},
34+
parserOptions: {
35+
project: true,
36+
tsconfigRootDir: import.meta.dirname,
37+
},
38+
},
39+
40+
rules: {
41+
'@typescript-eslint/no-base-to-string': 'off', // 1 instance
42+
43+
'@stylistic/indent-binary-ops': 'off', // this is a weird rule
44+
'@stylistic/max-len': ['error', {
45+
code: 160,
46+
ignoreTrailingComments: true,
47+
}],
48+
'@stylistic/max-statements-per-line': ['error', {
49+
ignoredNodes: ['IfStatement'],
50+
}],
51+
'@stylistic/member-delimiter-style': ['error', {
52+
multiline: { delimiter: 'semi' },
53+
singleline: { delimiter: 'semi' },
54+
}],
55+
'@stylistic/no-multi-spaces': ['error', {
56+
ignoreEOLComments: true,
57+
}],
58+
'@stylistic/quote-props': ['error', 'as-needed', {
59+
unnecessary: false,
60+
}],
61+
}
62+
},
63+
{
64+
// the following rules are being heavily violated in the current codebase,
65+
// we should work on being able to enable them...
66+
rules: {
67+
'@typescript-eslint/no-unsafe-member-access': 'off', // 742 instances
68+
'@typescript-eslint/no-unsafe-call': 'off', // 432 instances
69+
'@typescript-eslint/no-unsafe-assignment': 'off', // 429 instances
70+
'@typescript-eslint/no-unsafe-argument': 'off', // 401 instances
71+
'@typescript-eslint/no-explicit-any': 'off', // 226 instances
72+
'@typescript-eslint/no-unused-vars': 'off', // 204 instances
73+
'@typescript-eslint/no-unsafe-return': 'off', // 83 instances
74+
'@typescript-eslint/no-misused-promises': 'off', // 57 instances
75+
'@typescript-eslint/no-floating-promises': 'off', // 55 instances
76+
'no-useless-escape': 'off', // 38 instances
77+
'@typescript-eslint/prefer-promise-reject-errors': 'off', // 36 instances
78+
'no-async-promise-executor': 'off', // 29 instances
79+
'@typescript-eslint/no-require-imports': 'off', // 24 instances
80+
'no-cond-assign': 'off', // 21 instances
81+
'@typescript-eslint/require-await': 'off', // 11 instances
82+
}
83+
},
84+
{
85+
files: ['**/*.{js,mjs}'],
86+
extends: [tseslint.configs.disableTypeChecked],
87+
},
88+
);

0 commit comments

Comments
 (0)