-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
chore: enable prefer-ast-types-enum
internal rule
#1514
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
Merged
bradzacher
merged 12 commits into
typescript-eslint:master
from
G-Rath:enable-prefer-ast-types-internal-rule
Jan 25, 2020
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0a926b8
feat(eslint-plugin-internal): create `prefer-ast-types-constant` rule
G-Rath bbe0138
fix(eslint-plugin-internal): check if literal is enum member
G-Rath cd9dfa4
chore(eslint-plugin-internal): rename rule to `prefer-ast-types-enum`
G-Rath e60c63a
fix(eslint-plugin-internal): export `prefer-ast-types-enum` rule
G-Rath 9fa1750
chore(eslint-plugin-internal): use `hasOwnProperty` instead of `in`
G-Rath 66da63a
chore(eslint-plugin-internal): add another test
G-Rath 7b42c64
chore: enable `prefer-ast-types-enum` internal rule
G-Rath b16531d
chore: run `yarn lint --fix`
G-Rath 1aefbc3
chore: revert `prefer-ast-types-enum` false positives
G-Rath 4ce9b3a
chore(eslint-plugin-internal): use `createRule` utility
G-Rath de9ca75
chore: add missing AST enum imports
G-Rath 95fc985
Merge branch 'master' into enable-prefer-ast-types-internal-rule
bradzacher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import { | ||
AST_NODE_TYPES, | ||
AST_TOKEN_TYPES, | ||
} from '@typescript-eslint/experimental-utils'; | ||
import rule from '../../src/rules/prefer-ast-types-enum'; | ||
import { RuleTester, batchedSingleLineTests } from '../RuleTester'; | ||
|
||
|
@@ -36,12 +40,12 @@ node.type === AST_TOKEN_TYPES.Keyword | |
`, | ||
errors: [ | ||
{ | ||
data: { enumName: 'AST_NODE_TYPES', literal: 'Literal' }, | ||
data: { enumName: 'AST_NODE_TYPES', literal: AST_NODE_TYPES.Literal }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah haha hoisted by my own petard! |
||
messageId: 'preferEnum', | ||
line: 2, | ||
}, | ||
{ | ||
data: { enumName: 'AST_TOKEN_TYPES', literal: 'Keyword' }, | ||
data: { enumName: 'AST_TOKEN_TYPES', literal: AST_TOKEN_TYPES.Keyword }, | ||
messageId: 'preferEnum', | ||
line: 3, | ||
}, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.