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

fix(eslint-plugin): [prefer-includes] don't auto fix when test method's argument type doesn't have an 'includes' method #2391

Merged
merged 3 commits into from Aug 13, 2020

Conversation

sudalqueen
Copy link
Contributor

Fixes #2349

  • Related Rule: prefer-includes
  • add the code of checking argument type of test method.

Please let me know if there are any required changes.

Add test cases for RegExp in prefer-includes.test.ts
use `getConstrainedTypeAtLocation` method for check argument type of `test` method.
@typescript-eslint
Copy link
Contributor

Thanks for the PR, @sudalqueen!

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.

@codecov
Copy link

codecov bot commented Aug 13, 2020

Codecov Report

Merging #2391 into master will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #2391      +/-   ##
==========================================
+ Coverage   93.10%   93.16%   +0.05%     
==========================================
  Files         285      286       +1     
  Lines        9125     9161      +36     
  Branches     2504     2517      +13     
==========================================
+ Hits         8496     8535      +39     
+ Misses        302      301       -1     
+ Partials      327      325       -2     
Flag Coverage Δ
#unittest 93.16% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ackages/eslint-plugin/src/rules/prefer-includes.ts 100.00% <100.00%> (ø)
packages/scope-manager/src/lib/index.ts 100.00% <0.00%> (ø)
packages/scope-manager/src/lib/es2020.ts 100.00% <0.00%> (ø)
packages/visitor-keys/src/visitor-keys.ts 100.00% <0.00%> (ø)
...ckages/eslint-plugin/src/rules/no-throw-literal.ts 96.07% <0.00%> (ø)
...nt-plugin/src/rules/no-unused-vars-experimental.ts 91.48% <0.00%> (ø)
packages/scope-manager/src/lib/es2020.intl.ts 100.00% <0.00%> (ø)
packages/typescript-estree/src/convert.ts 98.36% <0.00%> (+0.01%) ⬆️
...slint-plugin/src/rules/no-unnecessary-condition.ts 96.93% <0.00%> (+0.01%) ⬆️
...ckages/scope-manager/src/referencer/TypeVisitor.ts 89.55% <0.00%> (+0.15%) ⬆️
... and 3 more

@bradzacher bradzacher added the bug Something isn't working label Aug 13, 2020
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.

nice and easy. thanks for your contribution!

@bradzacher bradzacher changed the title fix(eslint-plugin): Should not auto fix when test method's argument type hasn't 'includes' method fix(eslint-plugin): [prefer-includes] don't auto fix when test method's argument type doesn't have an 'includes' method Aug 13, 2020
@bradzacher bradzacher merged commit 71c4c72 into typescript-eslint:master Aug 13, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[prefer-includes] Should not auto fix simple Regex
2 participants