-
-
Notifications
You must be signed in to change notification settings - Fork 867
feat: add a fixer
function to eslint/rules/require-order
#3323
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
Conversation
for ( i = 0; i < requireDeclarations.length; i++ ) { | ||
txt = requireDeclarations[ i ].text; | ||
if ( !txt.startsWith( 'var' ) ) { | ||
txt = 'var '+txt; | ||
} | ||
if ( !txt.endsWith( ';' ) ) { | ||
txt += ';'; | ||
} | ||
replacingText += txt; |
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.
@kgryte @Planeshifter The var
starting and ;
ending code here is because of how ESLint AST Node differs in case of chained calls and IIFE's.
In those cases, the source.getText
function misses the var
keyword and the ending semi-colon
. See: https://github.com/stdlib-js/stdlib/pull/3323/files#diff-e79d1dfb379d74e202651a48d6e3b925d041ece9221da5ce5fef6dce0f9f49e1R128
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.
Makes sense. Thanks for explaining @headlessNode.
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.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no suggestions.
lib/node_modules/@stdlib/_tools/eslint/rules/require-order/lib/main.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/_tools/eslint/rules/require-order/lib/main.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/_tools/eslint/rules/require-order/lib/main.js
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/_tools/eslint/rules/require-order/lib/main.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
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's go ahead and get this in, and we can address any issues in follow-up PRs. Thanks, @headlessNode!
fixer
function to eslint/rules/require-order
fixer
function to eslint/rules/require-order
PR-URL: stdlib-js#3323 Co-authored-by: Athan Reines <kgryte@gmail.com> Reviewed-by: Athan Reines <kgryte@gmail.com>
Description
This pull request:
fixer
function toeslint/rules/require-order
Related Issues
No.
Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers