Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Identifier used as type definition is recognised as unused #48

Closed
OliverJAsh opened this issue Jul 13, 2016 · 2 comments
Closed

Identifier used as type definition is recognised as unused #48

OliverJAsh opened this issue Jul 13, 2016 · 2 comments
Labels

Comments

@OliverJAsh
Copy link

Hi, thanks for your amazing work. I have some feedback but I am very aware this project is still in the very early stages.

When I import an identifier and use it only as a type definition, the parser considers the identifier as unused. It is in fact unused in the JS, but used in the TS. I'm not sure how the parser should handle this?

Versions:

$ npm ls eslint typescript-eslint-parser
/Users/OliverJAsh/Development/samefourchords.com
├── [email protected]
└── [email protected]

ESLint config:

{
    "extends": "eslint:recommended",
    "parser": "typescript-eslint-parser",
    "parserOptions": {
        "ecmaVersion": 6,
        "sourceType": "module",
        "ecmaFeatures": {
            "modules": true
        }
    }
}

Input and output:

$ echo "import { Post } from './models'; let post: Post; post;" > test.js
$ eslint test.js

/Users/OliverJAsh/Development/samefourchords.com/test.js
  1:10  error  'Post' is defined but never used  no-unused-vars
@nzakas
Copy link
Member

nzakas commented Jul 16, 2016

Sorry, same response as here: #47 (comment)

@nzakas nzakas closed this as completed Jul 16, 2016
@OliverJAsh
Copy link
Author

Hi, this still appears to be an issue. Do you know whether this is something we can fix? Keen to help :-)

@eslint eslint locked and limited conversation to collaborators Aug 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants