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

feat(eslint-plugin): support type assertions in no-extra-parens rule #311

Merged
merged 7 commits into from Apr 11, 2019
Merged

Conversation

webschik
Copy link
Contributor

Fixes #12

@codecov
Copy link

codecov bot commented Feb 23, 2019

Codecov Report

Merging #311 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #311      +/-   ##
==========================================
+ Coverage   97.14%   97.14%   +<.01%     
==========================================
  Files          73       74       +1     
  Lines        2868     2875       +7     
  Branches      473      473              
==========================================
+ Hits         2786     2793       +7     
  Misses         49       49              
  Partials       33       33
Impacted Files Coverage Δ
...ackages/eslint-plugin/src/rules/no-extra-parens.ts 100% <100%> (ø)

Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In terms of documentation - do we just want to link to the ESLint documentation instead of copying it over here?
I know we've copied it in the past, but maybe if we just document our changes to the base rule, and link out it'd be cleaner for us?

Thoughts @typescript-eslint/core-team ?
If yes - we should fix it across the board (in a separate PR).

If no then this PR LGTM (apart from the one minor nit).


Great work @webschik.
👍 Figured out all the pieces to extending a base rule without any documentation.

packages/eslint-plugin/src/rules/no-extra-parens.ts Outdated Show resolved Hide resolved
@j-f1
Copy link
Contributor

j-f1 commented Feb 25, 2019

I’d say we should link to the original docs and describe how our rule differs.

@webschik
Copy link
Contributor Author

@bradzacher , @j-f1 , I can update eslint-plugin/docs/rules/no-extra-parens.md file. Smth like

disallow unnecessary parentheses (no-extra-parens)

Rule Details

This rule extends the base eslint/no-extra-parens rule.
It supports all options and features of the base rule plus TS type assertions.

How to use

{
    // note you must disable the base rule as it can report incorrect errors
    "no-extra-parens": "off",
    "@typescript-eslint/no-extra-parens": ["error"]
}

Options

See eslint/no-extra-parens options.

@webschik
Copy link
Contributor Author

@bradzacher , can we merge this PR?

@bradzacher bradzacher added the enhancement: new plugin rule New rule request for eslint-plugin label Mar 15, 2019
@bradzacher
Copy link
Member

Sorry @webschik - it got lost in my notifications.

@bradzacher bradzacher merged commit 116ca75 into typescript-eslint:master Apr 11, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement: new plugin rule New rule request for eslint-plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

no-extra-parens error when doing a type assertion
4 participants