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

Prettier formats lockfiles #4937

Closed
benmccann opened this issue May 16, 2022 · 0 comments · Fixed by #5009
Closed

Prettier formats lockfiles #4937

benmccann opened this issue May 16, 2022 · 0 comments · Fixed by #5009
Labels
bug Something isn't working pkg:create-svelte
Milestone

Comments

@benmccann
Copy link
Member

benmccann commented May 16, 2022

Describe the bug

From @delhanty in #4805 (comment):

So the Prettier issues were that package.json and pnpm-lock.yaml get formatted.

For package.json, I'd expect pnpm format to be a null op. That is the generated boilerplate code should all be passed by prettier --check when pnpm lint is run. (I add pnpm format:check to my package.json just to be able to run a prettier --check without ESLint.)

For pnpm-lock.yaml, the issue is that both Prettier and ESLint use .gitignore for their --ignore-path:

"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."

One of the first things I do is fix that by copying .gitignore to .prettierignore and .eslintignore so that I can edit my package.json to

"lint": "prettier --ignore-path .prettierignore --check --plugin-search-dir=. . && eslint --ignore-path .eslintignore .",
"format": "prettier --ignore-path .prettierignore --write --plugin-search-dir=. .",

.prettierignore and .eslintignore end up being close to the same, but have blocks like

# Ignore lockfiles for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock

which isn't dependent on the choice of PNPM, NPM or YARN.

Reproduction

I chose "SvelteKit demo app" and then

  1. Typescript
  2. ESLint: Yes
  3. Prettier: Yes
  4. Playwright: Yes

If it makes a difference, I develop with pnpm. (With pnpm v7, pnpm init svelte appears broken though.)

cd my-app
pnpm install
pnpm build
pnpm check

pnpm build is necessary to create .svelte-kit/tsconfig.json, which is extended by tsconfig.json.

Logs

No response

System Info

latest

Severity

annoyance

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg:create-svelte
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants