Skip to content

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

Merged
merged 6 commits into from
Dec 22, 2024

Conversation

headlessNode
Copy link
Member

Description

What is the purpose of this pull request?

This pull request:

  • add the fixer function to eslint/rules/require-order

Related Issues

Does this pull request have any related issues?

No.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Dec 4, 2024
Comment on lines 203 to 211
for ( i = 0; i < requireDeclarations.length; i++ ) {
txt = requireDeclarations[ i ].text;
if ( !txt.startsWith( 'var' ) ) {
txt = 'var '+txt;
}
if ( !txt.endsWith( ';' ) ) {
txt += ';';
}
replacingText += txt;
Copy link
Member Author

@headlessNode headlessNode Dec 4, 2024

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

Copy link
Member

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.

@headlessNode headlessNode added the Feature Issue or pull request for adding a new feature. label Dec 4, 2024
@kgryte kgryte added the Tools Issue or pull request related to project tooling. label Dec 4, 2024
@Planeshifter Planeshifter requested a review from Copilot December 8, 2024 00:32
Copy link

@Copilot Copilot AI left a 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.

@Planeshifter Planeshifter self-requested a review December 8, 2024 00:33
@kgryte kgryte added the Needs Changes Pull request which needs changes before being merged. label Dec 13, 2024
headlessNode and others added 5 commits December 15, 2024 19:46
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>
Copy link
Member

@kgryte kgryte left a 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!

@kgryte kgryte removed Needs Changes Pull request which needs changes before being merged. Needs Review A pull request which needs code review. labels Dec 22, 2024
@kgryte kgryte changed the title feat: add the fixer function to eslint/rules/require-order feat: add a fixer function to eslint/rules/require-order Dec 22, 2024
@kgryte kgryte merged commit d99b2b1 into stdlib-js:develop Dec 22, 2024
12 checks passed
@headlessNode headlessNode deleted the lint-require-order branch December 22, 2024 17:04
ShabiShett07 pushed a commit to ShabiShett07/stdlib that referenced this pull request Feb 26, 2025
PR-URL: stdlib-js#3323
Co-authored-by: Athan Reines <kgryte@gmail.com>
Reviewed-by: Athan Reines <kgryte@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Issue or pull request for adding a new feature. Tools Issue or pull request related to project tooling.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants