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): add prefer-regexp-exec rule #305

Merged
merged 25 commits into from May 10, 2019
Merged

feat(eslint-plugin): add prefer-regexp-exec rule #305

merged 25 commits into from May 10, 2019

Conversation

ldrick
Copy link
Contributor

@ldrick ldrick commented Feb 21, 2019

Fixes: #283

This PR adds a new rule: @typescript-eslint/prefer-regexp-exec.
I ended up with copying many things from #289, due to nearly the same problem is solved there already. Probably its useful to move getTypeName(type: ts.Type): string to utils - please let me know.

@ldrick ldrick changed the title Prefer regexp exec feat(eslint-plugin): add prefer-regexp-exec rule (fixes #283) Feb 21, 2019
@codecov
Copy link

codecov bot commented Feb 21, 2019

Codecov Report

Merging #305 into master will increase coverage by 0.02%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #305      +/-   ##
==========================================
+ Coverage    95.5%   95.52%   +0.02%     
==========================================
  Files          88       89       +1     
  Lines        4093     4112      +19     
  Branches     1150     1153       +3     
==========================================
+ Hits         3909     3928      +19     
  Misses         82       82              
  Partials      102      102
Impacted Files Coverage Δ
...plugin/src/rules/prefer-string-starts-ends-with.ts 100% <100%> (ø) ⬆️
...ages/eslint-plugin/src/rules/prefer-regexp-exec.ts 100% <100%> (ø)
packages/eslint-plugin/src/util/types.ts 83.33% <100%> (+10%) ⬆️

packages/eslint-plugin/docs/rules/prefer-regexp-exec.md Outdated Show resolved Hide resolved
packages/eslint-plugin/docs/rules/prefer-regexp-exec.md Outdated Show resolved Hide resolved
packages/eslint-plugin/README.md Outdated Show resolved Hide resolved
packages/eslint-plugin/docs/rules/prefer-regexp-exec.md Outdated Show resolved Hide resolved
packages/eslint-plugin/docs/rules/prefer-regexp-exec.md Outdated Show resolved Hide resolved
packages/eslint-plugin/src/rules/prefer-regexp-exec.ts Outdated Show resolved Hide resolved
packages/eslint-plugin/src/rules/prefer-regexp-exec.ts Outdated Show resolved Hide resolved
Copy link
Member

@JamesHenry JamesHenry left a comment

Choose a reason for hiding this comment

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

Nice, thanks @ldrick!

I think we'll merge @mysticatea's work first, and then we can see what is shared, so just putting a block on for now, but LGTM

@JamesHenry JamesHenry added the blocked by another PR PRs which are ready to go but waiting on another PR label Feb 23, 2019
@bradzacher
Copy link
Member

Hi @ldrick - #289 has been merged, so if you update this PR, we can merge it un

@bradzacher bradzacher added awaiting response Issues waiting for a reply from the OP or another party enhancement New feature or request enhancement: new plugin rule New rule request for eslint-plugin and removed blocked by another PR PRs which are ready to go but waiting on another PR enhancement New feature or request labels Apr 19, 2019
@bradzacher bradzacher changed the title feat(eslint-plugin): add prefer-regexp-exec rule (fixes #283) feat(eslint-plugin): add prefer-regexp-exec rule Apr 23, 2019
@ldrick
Copy link
Contributor Author

ldrick commented Apr 24, 2019

Hi @bradzacher , I am back from vacation and will change common used things. In the meanwhile, I have trouble with pulling master, due to 86 errors in linting. Did something change and how can this be fixed - because all of the linting issues refer not to this rule?

@bradzacher
Copy link
Member

Try doing a yarn install followed by a build.

@ldrick
Copy link
Contributor Author

ldrick commented Apr 24, 2019

Try doing a yarn install followed by a build.

I tried locally, but linting fails, with exactly the same as azure pipelines in this PR. 😭
Might it be an issue with fresh install? I checked out everything on a new notebook and ran yarn; yarn build so it should install everything from yarn.lock. Thank you

@bradzacher
Copy link
Member

Ahh, I see what's happening.
For some reason you committed your config all.json branch into this branch (b6d7590).

Which is why there are so many extra files.
It also looks like an old version of the branch, because there are changes to recommended.json (which are no longer present in #313).

You'll have to go through and remove the changes to fix up the changeset in this branch.
I just checked out your branch and tested; if you remove the recommended.json changes, there are no lint errors.

@ldrick
Copy link
Contributor Author

ldrick commented Apr 24, 2019

@bradzacher Wow, thank you many times, I literally screwed up my master and with it everything else. I'm going to round up this PR tomorrow and continue using only one notebook with my (kn)own configuration. 🙇

@ldrick
Copy link
Contributor Author

ldrick commented Apr 26, 2019

I did everything, I wanted to do. Please check, if moving getTypeName is what everyone would have expected and the way it should be. Thanks 👍

@bradzacher bradzacher removed the awaiting response Issues waiting for a reply from the OP or another party label Apr 26, 2019
bradzacher
bradzacher previously approved these changes Apr 27, 2019
@bradzacher bradzacher added the 1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready label Apr 27, 2019
@ldrick
Copy link
Contributor Author

ldrick commented May 10, 2019

Hi, it would be nice to merge this one, to save me from merging masters 😸 and it was already approved. Thanks

@bradzacher
Copy link
Member

@ldrick - We try to leave PRs open for around 2-3 weeks after getting an approval because we like to have 2 review approvals per feature PR.
We do 2-3 weeks because not all the core maintainers are available to spend a few hours every week.

Don't worry about checking back and merging master regularly. We'll coordinate that when it comes time to merge it.

That being said, it's probably time to merge this one in once these checks finish!

@bradzacher bradzacher merged commit f61d421 into typescript-eslint:master May 10, 2019
@ldrick ldrick deleted the prefer-regexp-exec branch May 13, 2019 18:39
@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
1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready enhancement: new plugin rule New rule request for eslint-plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule proposal: Prefer RegExp#exec() over String#match()
5 participants