Skip to content

Commit

Permalink
fix: Migrate to eslint 9 (#7961)
Browse files Browse the repository at this point in the history
* Update to eslint 9

* Automatic changes

* Manual changes

* fix no-return-await

* @typescript-eslint/await-thenable

* @typescript-eslint/no-unused-vars

* @typescript-eslint/ban-ts-comment

* ignore @typescript-eslint/explicit-function-return-type

* no-prototype-builtins

* process feedback

* @typescript-eslint/return-await

* `@typescript-eslint/return-await` `always`
  • Loading branch information
Koenkk authored Sep 12, 2024
1 parent 861f8df commit c7b8902
Show file tree
Hide file tree
Showing 234 changed files with 2,227 additions and 2,233 deletions.
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

55 changes: 0 additions & 55 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/update_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
node-version: 20
cache: npm
- run: npx npm-check-updates -u -x eslint
- run: npx npm-check-updates -u
- run: rm -f package-lock.json
- run: npm install
- uses: peter-evans/create-pull-request@v7
Expand Down
20 changes: 19 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,23 @@
"printWidth": 150,
"bracketSpacing": false,
"endOfLine": "lf",
"tabWidth": 4
"tabWidth": 4,
"importOrder": [
"",
"<TYPES>^(node:)",
"",
"<TYPES>",
"",
"<TYPES>^[.]",
"",
"<BUILTIN_MODULES>",
"",
"<THIRD_PARTY_MODULES>",
"",
"^zigbee",
"",
"^[.]"
],
"importOrderParserPlugins": ["typescript", "decorators"],
"plugins": ["@ianvs/prettier-plugin-sort-imports"]
}
33 changes: 33 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// @ts-check

import eslint from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import tseslint from 'typescript-eslint';

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
languageOptions: {
parserOptions: {
project: true,
},
},
rules: {
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-comment': 'error',
// Not enabled for now, gives 3.6k errors which require manual fixing.
// '@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': ['error', {args: 'none'}],
'array-bracket-spacing': ['error', 'never'],
'@typescript-eslint/return-await': ['error', 'always'],
'object-curly-spacing': ['error', 'never'],
'@typescript-eslint/no-floating-promises': 'error',
},
},
{
ignores: ['test/', 'index.*', 'converters/', 'devices/', 'lib/', 'scripts/', '**/*.mjs'],
},
eslintConfigPrettier,
);
Loading

0 comments on commit c7b8902

Please sign in to comment.