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): [strict-boolean-expression] rework options #1631

Merged
merged 8 commits into from May 10, 2020
Merged

feat(eslint-plugin): [strict-boolean-expression] rework options #1631

merged 8 commits into from May 10, 2020

Conversation

phaux
Copy link
Contributor

@phaux phaux commented Feb 23, 2020

closes #1515

Changes from last PR (#1480 ):

  • rewrote tests completely
  • there was a bug with bigint where it was treated as an object and it's fixed now
  • now only the outermost operands of logical expressions are checked instead of checking recursively and looking which errors first
    • for logical expressions (&&/||) nested in test expressions (if/while/for/?:/!) all the operands are checked.
    • for logical expression which are not part of a test expression, the rightmost operands aren't checked

I also refactored the rule slightly so it is now trivial to add fixers or suggestions for every case. A follow-up PR could add a fixer for nullable object error which changes expr to expr != null

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @phaux!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@phaux phaux changed the title [strict-boolean-expression] rework options feat(eslint-plugin): [strict-boolean-expression] rework options Feb 24, 2020
@bradzacher bradzacher added breaking change This change will require a new major version to be released enhancement: plugin rule option New rule option for an existing eslint-plugin rule refactor PRs that refactor code only labels Feb 24, 2020
@bradzacher bradzacher added this to the 3.0.0 milestone Feb 24, 2020
@phaux phaux changed the title feat(eslint-plugin): [strict-boolean-expression] rework options [WIP] feat(eslint-plugin): [strict-boolean-expression] rework options Mar 5, 2020
@phaux
Copy link
Contributor Author

phaux commented Mar 5, 2020

Added [WIP] because I forgot to update docs

@phaux phaux changed the title [WIP] feat(eslint-plugin): [strict-boolean-expression] rework options feat(eslint-plugin): [strict-boolean-expression] rework options Mar 20, 2020
@phaux
Copy link
Contributor Author

phaux commented Mar 20, 2020

Added docs!

@codecov
Copy link

codecov bot commented Mar 20, 2020

Codecov Report

Merging #1631 into v3 will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##               v3    #1631      +/-   ##
==========================================
+ Coverage   93.74%   93.75%   +0.01%     
==========================================
  Files         172      172              
  Lines        7813     7810       -3     
  Branches     2245     2240       -5     
==========================================
- Hits         7324     7322       -2     
  Misses        228      228              
+ Partials      261      260       -1     
Flag Coverage Δ
#unittest 93.75% <100.00%> (+0.01%) ⬆️
Impacted Files Coverage Δ
...int-plugin/src/rules/strict-boolean-expressions.ts 97.77% <100.00%> (+1.00%) ⬆️

@bradzacher bradzacher changed the base branch from master to v3 May 10, 2020 04:11
# Conflicts:
#	packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking change This change will require a new major version to be released enhancement: plugin rule option New rule option for an existing eslint-plugin rule refactor PRs that refactor code only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[strict-boolean-expression] Rework options
2 participants