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): [prefer-optional-chain] added option to convert to suggestion fixer #1965

merged 7 commits into from May 4, 2020


Copy link

Fixes #1820

Added the option suggestInsteadOfAutofix which converts the rule into a suggestion fixer when set to true.

Copy link

Thanks for the PR, @tianxinx99!

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 As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

Copy link

codecov bot commented May 2, 2020

Codecov Report

Merging #1965 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1965   +/-   ##
  Coverage   93.88%   93.89%           
  Files         170      170           
  Lines        7737     7744    +7     
  Branches     2227     2229    +2     
+ Hits         7264     7271    +7     
  Misses        218      218           
  Partials      255      255           
Flag Coverage Δ
#unittest 93.89% <100.00%> (+<0.01%) ⬆️
Impacted Files Coverage Δ
...s/eslint-plugin/src/rules/prefer-optional-chain.ts 95.23% <100.00%> (+0.14%) ⬆️
packages/eslint-plugin/src/rules/return-await.ts 95.94% <100.00%> (+0.23%) ⬆️
packages/eslint-plugin/src/rules/unbound-method.ts 95.23% <100.00%> (ø)

@bradzacher bradzacher added the bug Something isn't working label May 2, 2020
Copy link

@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.

LGTM - thanks for adding this.
As an FYI, I made the following changes (I wanted to merge this now so I made them instead of going through a request change cycle):

  • fixed schema
    • you had the wrong property name
    • you werne't using additionalProperties: false, so the validator didn't detect it.
  • use output: null instead of copy pasting the text
    • saves the duplication and does the same check

@bradzacher bradzacher added enhancement: plugin rule option New rule option for an existing eslint-plugin rule and removed bug Something isn't working labels May 4, 2020
@bradzacher bradzacher merged commit 2f0824b into typescript-eslint:master May 4, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
enhancement: plugin rule option New rule option for an existing eslint-plugin rule
None yet

Successfully merging this pull request may close these issues.

prefer-optional-chain autofix is not safe
2 participants