Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: Ignore type aliases in space-infix-ops (fixes #10922) #10923

Closed
wants to merge 1 commit into from

Conversation

madbence
Copy link
Contributor

@madbence madbence commented Oct 5, 2018

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[x] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What rule do you want to change?

space-infix-ops

Does this change cause the rule to produce more or fewer warnings?

No change for javascript, no more false positives for typescript.

How will the change be implemented? (New option, new default behavior, etc.)?

Disable the rule for VariableDeclarators where the parent node is a VariableDeclaration with a non-standard kind (not var, let, or const). After this, eslint-plugin-typescript can implement the rule for typescript type aliases (which are represented as variable declarations, with kind: 'type').

Please provide some example code that this change will affect:

type Foo<T> = T;

What does the rule currently do for this code?

It reports a violation, as after Foo the < is not surrounded by whitespaces.

What will the rule do after it's changed?

It'll ignore typescript type aliases, so a plugin can handle the non-standard syntax.

What changes did you make? (Give an overview)

space-infix-ops will ignore non-standard declarations (everything that's not var, let, or const). a possible fix for #10922

Is there anything you'd like reviewers to focus on?

🤷‍♂️

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Oct 5, 2018
@platinumazure
Copy link
Member

Hi @madbence, thanks for the PR.

Is this change necessary? I think when plugins need to change the behavior of a rule, they usually just reimplement the rule (with the correct behavior for special syntax) and advise users to disable the core rule and enable the plugin rule.

@madbence
Copy link
Contributor Author

madbence commented Oct 5, 2018

I don't know what would be the correct approach here, to me it feels like that eslint shouldn't try to handle non-standard VariableDeclarators, and the plugin should handle only the syntax-specific stuff (like type aliases).

@kaicataldo kaicataldo added enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Oct 15, 2018
@madbence
Copy link
Contributor Author

#10935 resolved the issue, i think i'll close this PR

@madbence madbence closed this Oct 15, 2018
@madbence madbence deleted the issue-10922 branch October 16, 2018 00:34
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Apr 14, 2019
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Apr 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants