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

feat(fix): preserve original formatting #195

Open
nlwillia opened this issue Jan 23, 2024 · 1 comment
Open

feat(fix): preserve original formatting #195

nlwillia opened this issue Jan 23, 2024 · 1 comment

Comments

@nlwillia
Copy link

Description

Given:

{
  "name": "syncpack-format",
  "version": "1.0.0",
  "scripts": {
    "lint": "syncpack lint",
    "fix": "syncpack fix-mismatches"
  },
  "keywords": ["test"],
  "devDependencies": {
    "syncpack": "^12.3.0"
  },
  "syncpack": {
    "lintFormatting": false
  }
}

Running npm run fix will rewrite the keywords property with unnecessary newlines even with lintFormatting indicated as false.

  "keywords": [
    "test"
  ],

Suggested Solution

I imagine it's a headache to consider whitespace when reconstituting files, but it would be preferable for keys that aren't changed to be emitted the same as how they're read if formatting is turned off.

@JamieMason
Copy link
Owner

Thanks @nlwillia, yeah tricky one as this is being done basically by JSON.stringify.

@JamieMason JamieMason changed the title fix-mismatches rewrites simple array properties even when lintFormatting is false feat(fix): preserve original formatting May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants