-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(rule-tester): fixes on the same line are not fixed properly #8252
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1022,7 +1022,7 @@ ruleTester.run('space-infix-ops', rule, { | |
type Test=|string|(((() => void)))|string; | ||
`, | ||
output: ` | ||
type Test = |string | (((() => void))) | string; | ||
type Test = | string | (((() => void))) | string; | ||
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. This should be the real fix. See this playground. The test currently fails because it's being fixed to: type Test = | string | (((() => void))) | string; (notice there are 2 spaces after the Not sure how to approach this. I have 2 options in mind:
WDYT? |
||
`, | ||
errors: [ | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ export function applyFixes( | |
const end = fix.range[1]; | ||
|
||
// Remain it as a problem if it's overlapped or it's a negative range | ||
if (lastPos >= start || start > end) { | ||
if (lastPos > start || start > end) { | ||
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. The actual fix that causes all of this mess 😅 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. As per the comment at the top of the file - this code is directly forked from eslint core. If it's broken here then this only changes tests run using our rule tester. Code run through eslint will have the old logic. So either you've found a bug upstream or tests are running correctly, but correctly, but differently to how you expect. If it's the former - the fix needs to land upstream before we land it here. |
||
remainingMessages.push(problem); | ||
return false; | ||
} | ||
|
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.
This was a bug in the tests. See other tests above.