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

WIP: Add array-type rule #117

Closed
wants to merge 1 commit into from

Conversation

macklinu
Copy link
Collaborator

@macklinu macklinu commented Mar 13, 2018

I'd like to contribute the array-type rule in #5, but I'm running into issues. None of my console.log statements are being hit, so the nodes don't seem to be visited. All of my invalid test cases should pass (in theory), but they are all currently failing.

Here's an AST Explorer with the test cases I have, if you'd like to check out the AST.

Why aren't these nodes being visited? Any suggestions on how to approach checking type annotations?

@bradzacher
Copy link
Owner

OOOOOOkaaay.
I did some digging.
A lot of digging.
I setup debugging locally and explored how exactly eslint decides to traverse nodes and their children.

I've outlined the problem here: eslint/typescript-eslint-parser#532
The TL;DR is that eslint doesn't know about Identifier's typeAnnotation property, so it doesn't traverse it.

You'll notice in no-explicit-any explicitly defines an Identifier selector, which manually traverses typeAnnotation: https://github.com/nzakas/eslint-plugin-typescript/blob/master/lib/rules/no-explicit-any.js#L89-L95

So to make this work, you'll have to do the same!

@armano2
Copy link
Contributor

armano2 commented Dec 4, 2018

@macklinu are you planning to finish this rule?

@armano2
Copy link
Contributor

armano2 commented Dec 8, 2018

@bradzacher do you mind if i take this one over?

looks like @macklinu is not interested in finishing it

@bradzacher
Copy link
Owner

@armano2 no response doesn't mean not interested. Just means they're busy on other priorities!

I'm not going to stand in the way of progress (and I'm sure @macklinu would be happy for you to commandeer his work if he has other priorities atm)

@armano2
Copy link
Contributor

armano2 commented Dec 10, 2018

@bradzacher that's what i meant, i put it in wrong words 👍

@bradzacher bradzacher closed this Dec 11, 2018
@armano2 armano2 mentioned this pull request Dec 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants