Let eslint check imports

This commit is contained in:
Lars Strojny 2022-11-08 19:36:50 +01:00
parent 84761dfa93
commit d35e28e377
3 changed files with 1161 additions and 406 deletions

View file

@ -1,7 +1,7 @@
module.exports = { module.exports = {
extends: ['eslint:recommended'], extends: ['eslint:recommended', 'plugin:import/recommended'],
parser: '@typescript-eslint/parser', parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'prettier'], plugins: ['@typescript-eslint', 'prettier', 'import'],
root: true, root: true,
rules: { rules: {
'prettier/prettier': 'warn', 'prettier/prettier': 'warn',
@ -12,6 +12,13 @@ module.exports = {
ignoreDeclarationSort: true, ignoreDeclarationSort: true,
}, },
], ],
'import/no-unresolved': 'error',
'import/no-extraneous-dependencies': 'error',
'import/first': 'error',
'import/no-duplicates': 'error',
'import/no-default-export': 'error',
'import/no-namespace': 'error',
'import/no-useless-path-segments': 'error',
}, },
overrides: [ overrides: [
{ {
@ -19,6 +26,7 @@ module.exports = {
extends: [ extends: [
'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking', 'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:import/typescript',
], ],
parserOptions: { parserOptions: {
project: ['./tsconfig.json'], project: ['./tsconfig.json'],
@ -26,6 +34,13 @@ module.exports = {
rules: { rules: {
'@typescript-eslint/explicit-module-boundary-types': 'error', '@typescript-eslint/explicit-module-boundary-types': 'error',
}, },
settings: {
'import/resolver': {
typescript: {
project: './',
},
},
},
}, },
{ {
files: ['.eslintrc.js', 'jest.config.js', 'prettier.config.js'], files: ['.eslintrc.js', 'jest.config.js', 'prettier.config.js'],

1544
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -30,10 +30,13 @@
"homebridge-plugin" "homebridge-plugin"
], ],
"devDependencies": { "devDependencies": {
"@jest/globals": "^29.3.0",
"@types/node": "^16.10.9", "@types/node": "^16.10.9",
"@typescript-eslint/eslint-plugin": "^5.42.0", "@typescript-eslint/eslint-plugin": "^5.42.0",
"@typescript-eslint/parser": "^5.42.0", "@typescript-eslint/parser": "^5.42.0",
"eslint": "^8.0.1", "eslint": "^8.0.1",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"homebridge": "^1.3.5", "homebridge": "^1.3.5",
"homebridge-cmdswitch2": "^0.2.10", "homebridge-cmdswitch2": "^0.2.10",
@ -47,6 +50,7 @@
"dependencies": { "dependencies": {
"fastify": "^4.9.2", "fastify": "^4.9.2",
"hap-node-client": "git+https://github.com/NorthernMan54/Hap-Node-Client.git#fe200ba", "hap-node-client": "git+https://github.com/NorthernMan54/Hap-Node-Client.git#fe200ba",
"hap-nodejs": "^0.10.4",
"json-schema-to-zod": "^0.2.0", "json-schema-to-zod": "^0.2.0",
"zod": "^3.19.1" "zod": "^3.19.1"
}, },