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

More strict import/order options #705

Closed
EdJoPaTo opened this issue Feb 25, 2023 · 1 comment
Closed

More strict import/order options #705

EdJoPaTo opened this issue Feb 25, 2023 · 1 comment

Comments

@EdJoPaTo
Copy link
Contributor

Currently import/order uses the default options. As xo is a strict config I think there could be some options enabled.

I suggest this config:

"import/order": [
  "error",
  {
    "newlines-between": "never",
    "alphabetize": {
      "order": "asc",
      "orderImportKind": "asc",
      "caseInsensitive": true
    }
  }
]

I think the groups option already has a good default so it doesnt need to be improved.

newlines-between should be either never or always in my opinion. Both seem fine and both are an improvement over ignore.

alphabetize with order asc and being caseInsensitive seem like a good idea. I am not so sure about the value of orderImportKind but I think some value should be set to be more strict.

@sindresorhus
Copy link
Member

newlines-between should be either never or always in my opinion. Both seem fine and both are an improvement over ignore.

👍 Added in fe6db72

alphabetize with order asc and being caseInsensitive seem like a good idea. I am not so sure about the value of orderImportKind but I think some value should be set to be more strict.

Alphabetizing may sound tempting, but I have tried it years ago and it's simply not worth it. It results in a lot of churn and failing lints, with little benefit. It's not something I plan to add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants