Skip to content

Commit

Permalink
Merge pull request #1078 from minuteos/feat/migrate-to-eslint
Browse files Browse the repository at this point in the history
Migrate to ESLint
  • Loading branch information
haneefdm authored Jan 17, 2025
2 parents 0df2d04 + 97532ea commit cd7ef5f
Show file tree
Hide file tree
Showing 83 changed files with 2,854 additions and 2,396 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
if: steps.cache-npm.outputs.cache-hit != 'true'
run: |
npm install
build:
name: Build
needs: setup
Expand Down Expand Up @@ -58,4 +58,4 @@ jobs:
path: ./node_modules
key: npm-${{ hashFiles('./package-lock.json') }}
- name: Lint Project
run: ./node_modules/tslint/bin/tslint --project .
run: npm run lint
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"recommendations": [
"tobermory.es6-string-html",
"ms-vscode.vscode-typescript-tslint-plugin"
"dbaeumer.vscode-eslint"
]
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.useTabStops": false,
"files.trimTrailingWhitespace": false,
"eslint.useFlatConfig": true,
"files.trimTrailingWhitespace": true,
"files.exclude": {
"out": false,
"dist": true,
Expand Down
88 changes: 88 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import stylistic from '@stylistic/eslint-plugin';
import globals from 'globals';

export default tseslint.config(
{
ignores: ['out/', 'dist/'],
},
eslint.configs.recommended,
tseslint.configs.recommendedTypeChecked,
stylistic.configs.customize({
arrowParens: 'always',
braceStyle: '1tbs',
commaDangle: 'only-multiline',
indent: 4,
quotes: 'single',
semi: 'always',
}),
{
files: ['resources/*.js'],
languageOptions: {
globals: {
acquireVsCodeApi: true, // available for VSCode WebViews
},
},
},
{
languageOptions: {
globals: {
...globals.node,
...globals.browser,
},
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},

rules: {
'@typescript-eslint/no-base-to-string': 'off', // 1 instance

'@stylistic/indent-binary-ops': 'off', // this is a weird rule
'@stylistic/max-len': ['error', {
code: 160,
ignoreTrailingComments: true,
}],
'@stylistic/max-statements-per-line': ['error', {
ignoredNodes: ['IfStatement'],
}],
'@stylistic/member-delimiter-style': ['error', {
multiline: { delimiter: 'semi' },
singleline: { delimiter: 'semi' },
}],
'@stylistic/no-multi-spaces': ['error', {
ignoreEOLComments: true,
}],
'@stylistic/quote-props': ['error', 'as-needed', {
unnecessary: false,
}],
}
},
{
// the following rules are being heavily violated in the current codebase,
// we should work on being able to enable them...
rules: {
'@typescript-eslint/no-unsafe-member-access': 'off', // 742 instances
'@typescript-eslint/no-unsafe-call': 'off', // 432 instances
'@typescript-eslint/no-unsafe-assignment': 'off', // 429 instances
'@typescript-eslint/no-unsafe-argument': 'off', // 401 instances
'@typescript-eslint/no-explicit-any': 'off', // 226 instances
'@typescript-eslint/no-unused-vars': 'off', // 204 instances
'@typescript-eslint/no-unsafe-return': 'off', // 83 instances
'@typescript-eslint/no-misused-promises': 'off', // 57 instances
'@typescript-eslint/no-floating-promises': 'off', // 55 instances
'no-useless-escape': 'off', // 38 instances
'@typescript-eslint/prefer-promise-reject-errors': 'off', // 36 instances
'no-async-promise-executor': 'off', // 29 instances
'@typescript-eslint/no-require-imports': 'off', // 24 instances
'no-cond-assign': 'off', // 21 instances
'@typescript-eslint/require-await': 'off', // 11 instances
}
},
{
files: ['**/*.{js,mjs}'],
extends: [tseslint.configs.disableTypeChecked],
},
);
Loading

0 comments on commit cd7ef5f

Please sign in to comment.