To prevent inaccurate error reporting, it is recommended to deactivate the base rule. For more information, please refer to: Deactivating Base Rule
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { args: "none" }]
UserModel.ts
export class UserModel {
username: string;
}
MyComponent.ts
import { UserModel } from './UserModel'
export class MyComponent {
async myFunction(): Promise<UserModel> {
// Some code here
}
}
Below is a simplified version of my eslint configuration
module.exports = {
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint/eslint-plugin"],
"env": {
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ['error'],
}
}
dependencies in package.json
{
"scripts": {
"lint": "eslint app.ts"
},
"devDependencies": {
"@types/eslint": "7.2.4",
"@types/node": "13.7.7",
"@typescript-eslint/eslint-plugin": "4.14.1",
"@typescript-eslint/parser": "4.14.1",
"eslint": "7.18.0",
"ts-node": "8.6.2",
"typescript": "3.8.3"
}
}