Skip to content

Improve editorConfigToPrettier #17512

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

fisker
Copy link
Member

@fisker fisker commented May 24, 2025

Description

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Copy link

pkg-pr-new bot commented May 24, 2025

Open in StackBlitz

yarn add https://pkg.pr.new/[email protected]

commit: e4581cc

Copy link

netlify bot commented May 24, 2025

Deploy Preview for prettier ready!

Name Link
🔨 Latest commit e4581cc
🔍 Latest deploy log https://app.netlify.com/projects/prettier/deploys/68322ce0752e790008268f68
😎 Deploy Preview https://deploy-preview-17512--prettier.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 project configuration.

@fisker fisker marked this pull request as draft May 24, 2025 19:48
Comment on lines -66 to -68
).toStrictEqual({
tabWidth: 0,
});
Copy link
Member Author

Choose a reason for hiding this comment

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

The value 0 is invalid, discussed in josephfrazier/editorconfig-to-prettier#1 and decided to keep it, but tabWidth=0 crashes, I think better to ignore instead.

if (result.useTabs === false && isPositiveInteger(indent_size)) {
result.tabWidth = indent_size;
} else if (isPositiveInteger(tab_width)) {
result.tabWidth = tab_width;
Copy link
Member Author

Choose a reason for hiding this comment

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

According to https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties tab_width should only used when indent_size === "tab" and fallback to indent_size, should we follow?

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

Successfully merging this pull request may close these issues.

1 participant