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

Ignore TypeScript type aliases in space-infix-ops #10922

Closed
madbence opened this issue Oct 5, 2018 · 2 comments
Closed

Ignore TypeScript type aliases in space-infix-ops #10922

madbence opened this issue Oct 5, 2018 · 2 comments
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

Comments

@madbence
Copy link
Contributor

madbence commented Oct 5, 2018

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.

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Oct 5, 2018
madbence added a commit to madbence/eslint that referenced this issue Oct 5, 2018
@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
@kaicataldo
Copy link
Member

Thanks for this issue. Since ESLint does officially support type annotations (as defined by ESTree), I wonder if we can add an option that makes space-infix-ops ignore types? If this doesn't cover all specific TS syntax, it might be best to create a new space-infix-ops specifically for TS (maybe in https://github.com/nzakas/eslint-plugin-typescript)?

@madbence
Copy link
Contributor Author

@kaicataldo i refactored the original rule, and eliminated the false positives. see #10935

madbence added a commit to madbence/eslint that referenced this issue Oct 16, 2018
@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

No branches or pull requests

2 participants