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-internal): add prefer-ast-types-enum #1508

Merged
merged 6 commits into from Jan 25, 2020
Merged

feat(eslint-plugin-internal): add prefer-ast-types-enum #1508

merged 6 commits into from Jan 25, 2020

Conversation

G-Rath
Copy link
Contributor

@G-Rath G-Rath commented Jan 24, 2020

closes #1503

I assume it has to be published before it can be used?

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @G-Rath!

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 Jan 24, 2020

Codecov Report

Merging #1508 into master will decrease coverage by 0.03%.
The diff coverage is 85%.

@@            Coverage Diff             @@
##           master    #1508      +/-   ##
==========================================
- Coverage    95.6%   95.57%   -0.04%     
==========================================
  Files         148      149       +1     
  Lines        6664     6684      +20     
  Branches     1909     1915       +6     
==========================================
+ Hits         6371     6388      +17     
- Misses        111      112       +1     
- Partials      182      184       +2
Impacted Files Coverage Δ
packages/eslint-plugin-internal/src/rules/index.ts 0% <0%> (ø) ⬆️
...plugin-internal/src/rules/prefer-ast-types-enum.ts 89.47% <89.47%> (ø)

@armano2
Copy link
Member

armano2 commented Jan 24, 2020

I assume it has to be published before it can be used?

it should work without publishing (in development we are using local packages for linting)

you forgot to add it to packages/eslint-plugin-internal/src/rules/index.ts

@armano2 armano2 added the tests anything to do with testing label Jan 24, 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.

lgtm

one nit on the implementation, just for this repo.
armano is right; add it to the index and do a build, then you'll be able to config it and run it.

you're a legend, thanks for doing this!

@G-Rath
Copy link
Contributor Author

G-Rath commented Jan 24, 2020

@bradzacher

We've gotten most of the cases, but it'd be good to guard against this explicitly in the codebase.

✖ 298 problems (298 errors, 0 warnings)
298 errors and 0 warnings potentially fixable with the --fix option.

😂

But on a serious note, I'm going to open a new PR based off this one for the fixes - the primary interesting one is constructor: since that exists, these are being flagged:

options: [{ default: ['signature', 'field', 'constructor', 'method'] }],

I personally don't have a major problem with it, but you might feel differently :)

@G-Rath
Copy link
Contributor Author

G-Rath commented Jan 24, 2020

Also, I've renamed the rule to prefer-ast-types-enum, as that's more sensible.

@G-Rath G-Rath changed the title feat(eslint-plugin-internal): create prefer-ast-types-constant rule feat(eslint-plugin-internal): create prefer-ast-types-enum rule Jan 24, 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.

thanks for this!

@bradzacher bradzacher changed the title feat(eslint-plugin-internal): create prefer-ast-types-enum rule feat(eslint-plugin-internal): add prefer-ast-types-enum Jan 25, 2020
@bradzacher bradzacher merged commit c3d0a3a into typescript-eslint:master Jan 25, 2020
@G-Rath G-Rath deleted the create-prefer-ast-types-internal-rule branch January 26, 2020 20:37
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tests anything to do with testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add internal lint rule to guard against raw strings instead of AST_NODE_TYPES
3 participants