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
Improve errors location tracking #14130
Merged
nicolo-ribaudo
merged 6 commits into
babel:main
from
tolmasky:fix-some-errors-still-ignore-start-line-option-14123
Jan 18, 2022
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
57d6e98
Have raise() take a Position instead of an integer index so that we c…
tolmasky 65b7aae
Update test results to reflect that Errors.ElementAfterRest is now re…
tolmasky 2d355b4
Fix linter error by changing return type to boolean.
tolmasky 42ebf70
Corresponding change in typescript's checkCommaAfterRest.
tolmasky 3014752
Make checkExpressionErrors return whether it has errors again, but we…
tolmasky 22d3112
Use a WeakMap to associate indexes to Positions until we decide wheth…
tolmasky File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
144 changes: 72 additions & 72 deletions
144
eslint/babel-eslint-plugin-development-internal/test/rules/dry-error-messages.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid having to always specify a new object when calling
.raise
, maybe we could divide it in two separate functions:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually originally had this, but decided against it for a couple reasons:
{ at: length: }
for ranges (or{ start, end }
or however you want to do that), and I think it would also eventually be nice to be able to supply context info (we currently have this info but it gets stringified for example, but can be very useful to the user to be able to do error.enumName vs. parsing message for enumName). As such, I wanted to put in the scaffolding for something that could carry additional info that could be easily read in the future.raiseWithData
to take(missingPlugin?: Array<string>, code?: string)
instead of{ missingPlugin?: Array<string>, code?: string, }
(since this objectdata
object gets thrown away immediately when yet another object is created on the corresponding call to_raise
), and this change would basically affect all error raises "for free" transparently since it's an internal function call inraise
. However, I also don't think this is a performance issue.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, sounds good 👍