Skip to content
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

docs: Clarify the description of sort-imports options #18198

Merged
merged 9 commits into from Mar 22, 2024

Conversation

gwBear1
Copy link
Contributor

@gwBear1 gwBear1 commented Mar 13, 2024

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

  • Documentation update

What changes did you make? (Give an overview)

스크린샷 2024-03-13 오전 10 51 55

Made 4 test cases of the below. It could be more straightforward.

incorrect with default option ignore false
correct   with default option ignore false
correct   with ignore true
incorrect with ignore true
  • ignoreCase
  • ignoreDeclarationSort
  • ignoreMemberSort

Is there anything you'd like reviewers to focus on?

  • Should be checked whether test cases are correct.

@gwBear1 gwBear1 requested a review from a team as a code owner March 13, 2024 01:51
@eslint-github-bot
Copy link

Hi @gwBear1!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

Copy link

linux-foundation-easycla bot commented Mar 13, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

netlify bot commented Mar 13, 2024

Deploy Preview for docs-eslint ready!

Name Link
🔨 Latest commit d287318
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/65fbfeb9fa95430008037bb4
😎 Deploy Preview https://deploy-preview-18198--docs-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added the documentation Relates to ESLint's documentation label Mar 13, 2024
@eslint-github-bot
Copy link

Hi @gwBear1!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

@gwBear1 gwBear1 changed the title Fixed incorrect doc description of "ignoreCase". docs: Fixed incorrect doc description of "ignoreCase". Mar 13, 2024
@Tanujkanti4441
Copy link
Contributor

Hi @gwBear1, thanks for the PR, but the docs are correct because it shows both incorrect and correct examples when
{ "ignoreCase": true } as you can see the examples written under the incorrect section by opening them in playground.

@Tanujkanti4441
Copy link
Contributor

Tanujkanti4441 commented Mar 13, 2024

sorry for closing too early.
after looking around a bit i found

/*eslint sort-imports: "error"*/

import A from 'foo.js';
import b from 'bar.js';

by default rule doesn't report this arrangement of import names.

/*eslint sort-imports: "error"*/

import a from 'foo.js';
import B from 'bar.js';

but report this

@mdjermanovic is it intended?

if yes then we need to show this in docs too

@gwBear1
Copy link
Contributor Author

gwBear1 commented Mar 13, 2024

@Tanujkanti4441 Yeah I was confused too. You right, fixing test case would be better choice. I'll rewrite test cases.

@gwBear1
Copy link
Contributor Author

gwBear1 commented Mar 13, 2024

I added test cases more straightforward. Each options has 3 test cases

  • incorrect with default option ignore false
  • correct with default option ignore false
  • correct with ignore true

"+" updated PR description

@gwBear1 gwBear1 changed the title docs: Fixed incorrect doc description of "ignoreCase". docs: Fixed incorrect doc description of "sort-imports". Mar 13, 2024
@gwBear1 gwBear1 changed the title docs: Fixed incorrect doc description of "sort-imports". docs: Fixed confusing doc description of "sort-imports". Mar 13, 2024
@gwBear1 gwBear1 changed the title docs: Fixed confusing doc description of "sort-imports". docs: Fixed incorrect doc description of "sort-imports". Mar 13, 2024
docs/src/rules/sort-imports.md Outdated Show resolved Hide resolved
docs/src/rules/sort-imports.md Outdated Show resolved Hide resolved
docs/src/rules/sort-imports.md Show resolved Hide resolved
@Tanujkanti4441 Tanujkanti4441 added the evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion label Mar 13, 2024
@gwBear1
Copy link
Contributor Author

gwBear1 commented Mar 18, 2024

@Tanujkanti4441 Can you check my PR again?

docs/src/rules/sort-imports.md Outdated Show resolved Hide resolved
@Tanujkanti4441 Tanujkanti4441 added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Mar 18, 2024
Co-authored-by: Tanuj Kanti <86398394+Tanujkanti4441@users.noreply.github.com>
@mdjermanovic
Copy link
Member

/*eslint sort-imports: "error"*/

import A from 'foo.js';
import b from 'bar.js';

by default rule doesn't report this arrangement of import names.

/*eslint sort-imports: "error"*/

import a from 'foo.js';
import B from 'bar.js';

but report this
@mdjermanovic is it intended?

This is intended because: any uppercase letter < any lowercase letter. A < b, B < a.

@mdjermanovic
Copy link
Member

I'm confused by the PR title. "Fixed incorrect doc description" sounds like the docs were incorrect, but it looks like the docs were correct and we just want to add more examples to further clarify options?

@@ -194,33 +194,59 @@ import {b, a, c} from 'foo.js'

When `true` the rule ignores the case-sensitivity of the imports local name.

Examples of **incorrect** code for this rule with the `{ "ignoreCase": true }` option:
Uppercase letters of the alphabet must always precede lowercase letters with default settings.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to describe both, I think the default behavior should be first.

When `false` (default), uppercase letters of the alphabet must always precede lowercase letters.

When `true`, the rule ignores the case-sensitivity of the imports local name.

gwBear1

This comment was marked as off-topic.

@gwBear1 gwBear1 changed the title docs: Fixed incorrect doc description of "sort-imports". docs: Clarify the description of "sort-imports" Mar 21, 2024
@gwBear1
Copy link
Contributor Author

gwBear1 commented Mar 21, 2024

I'm confused by the PR title. "Fixed incorrect doc description" sounds like the docs were incorrect, but it looks like the docs were correct and we just want to add more examples to further clarify options?

I changed the PR title and description

@gwBear1
Copy link
Contributor Author

gwBear1 commented Mar 21, 2024

@Tanujkanti4441 @mdjermanovic Followed your comments. Could you check this PR again?

Copy link
Contributor

@Tanujkanti4441 Tanujkanti4441 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything looks good just a last thing.

docs/src/rules/sort-imports.md Outdated Show resolved Hide resolved
docs/src/rules/sort-imports.md Outdated Show resolved Hide resolved
docs/src/rules/sort-imports.md Outdated Show resolved Hide resolved
docs/src/rules/sort-imports.md Outdated Show resolved Hide resolved
docs/src/rules/sort-imports.md Outdated Show resolved Hide resolved
docs/src/rules/sort-imports.md Outdated Show resolved Hide resolved
Co-authored-by: Tanuj Kanti <86398394+Tanujkanti4441@users.noreply.github.com>
@gwBear1
Copy link
Contributor Author

gwBear1 commented Mar 22, 2024

@Tanujkanti4441 I hope this would be the last request 😅 Thanks for reviewing be thorough

Copy link
Contributor

@Tanujkanti4441 Tanujkanti4441 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! thanks.

@mdjermanovic mdjermanovic changed the title docs: Clarify the description of "sort-imports" docs: Clarify the description of sort-imports options Mar 22, 2024
Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@mdjermanovic mdjermanovic merged commit 239a7e2 into eslint:main Mar 22, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion documentation Relates to ESLint's documentation
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

None yet

3 participants