-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Add prefer-negative-index
rule
#417
Add prefer-negative-index
rule
#417
Conversation
prefer-negative-index
ruleprefer-negative-index
rule
…-plugin-unicorn into rule/prefer-negative-index
prefer-negative-index
ruleprefer-negative-index
rule
Co-Authored-By: Sindre Sorhus <[email protected]>
Co-Authored-By: Sindre Sorhus <[email protected]>
rules/prefer-negative-index.js
Outdated
let after = sourceCode.getTokenAfter(node); | ||
|
||
let start = node.range[0]; | ||
let end = node.range[1]; |
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.
let end = node.range[1]; | |
let [start, end] = node.range; |
Same with the below.
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 forgot why I seperate them... maybe mistake
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.
assign can't do this, different ranges
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.
let [start, end] = [1, 2];
console.log(start, end);
//=> 1 2
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 know this, already did
before = sourceCode.getTokenBefore(before); | ||
after = sourceCode.getTokenAfter(after); | ||
start = before.range[1]; | ||
end = after.range[0]; |
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 mean these two line cant combine
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.
It was not clear that you were referring to this as you commented on the other code.
Nice 👌 |
Fixes: #415