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

[camelcase] false positive on interface properties #177

Closed
bradzacher opened this issue Nov 19, 2018 · 4 comments
Closed

[camelcase] false positive on interface properties #177

bradzacher opened this issue Nov 19, 2018 · 4 comments
Assignees
Milestone

Comments

@bradzacher
Copy link
Owner

bradzacher commented Nov 19, 2018

Repro

{
  "rules": {
    "camelcase": ["error", { "properties": "never" }]
  }
}
interface Foo { b_ar: null }

Expected Result
No errors

Actual Result
Identifier 'b_ar' is not in camel case.

Additional Info
Moved from unresponsive PR #95
eslint/typescript-eslint-parser#492

@weirdpattern
Copy link
Collaborator

weirdpattern commented Nov 21, 2018

I will take a look at this over the holidays.
So assigning it to myself, if that is OK with everyone.

@bradzacher
Copy link
Owner Author

this is a huge problem (i'm surprised more people don't report it).

I dug into this a while ago, and only just remember where I put the issue (I've updated the OP with the link)

@weirdpattern
Copy link
Collaborator

Just read the bug you linked. I think extending the base ESLint rule to handle typescript specific nodes makes the most sense as we don't want to impact other rules that use the Identifier node.

We have done it before #68

Thoughts?

@bradzacher
Copy link
Owner Author

sounds good to me!

I don't remember if you can do this easily via eslint's context or not, but if you can, it should be as easy as interrogating the parent of the identifier!

Also considering we only currently have a minor modification - I wonder if it's possible to just import the existing eslint rule and do something like:

if (isTsInterfaceProp() && settings.properties === 'always') {
   eslintCamelcase()
}

weirdpattern added a commit to weirdpattern/eslint-plugin-typescript that referenced this issue Nov 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants