Skip to content

[no-unused-vars] false positive for imported types #1542

Closed
@StrangeWill

Description

@StrangeWill

Repro

<script lang="ts">
// ...
import { AxiosError } from "axios";
// ...

const response = await this.$http
	.post<JwtToken>(
		"authentication_token",
		{
			email: this.username,
			password: this.password
		},
		{
			headers: {
				authorization: ""
			}
		}
	)
	.catch((error: AxiosError) => { // <-- this line right here
		if (error?.response?.status == 401) {
			throw "Login Failed";
		}

		throw error?.message;
	});
// ...

Expected Result

Should pass es-lint fine

Actual Result

It sometimes passes es-lint, appears to do it on first pass, but fails on subsequent passes when running npm run serve.

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 2.18.0
@typescript-eslint/parser 2.18.0
TypeScript 3.7.5
ESLint 6.8.0
node 12.14.1
npm 6.13.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginscope analyserIssues that are caused by bugs/incomplete cases in the scope analyser

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions