Skip to content

Commit cc27969

Browse files
authored
Merge pull request #1055 from bertdeblock/vanilla-prettier-setup-in-blueprints
2 parents 198b7d3 + cc2de57 commit cc27969

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
stage: accepted
3+
start-date: 2024-12-03T00:00:00.000Z
4+
release-date:
5+
release-versions:
6+
teams:
7+
- cli
8+
prs:
9+
accepted: https://github.com/emberjs/rfcs/pull/1055
10+
project-link:
11+
suite:
12+
---
13+
14+
# Vanilla Prettier Setup in Blueprints
15+
16+
## Summary
17+
18+
This RFC proposes to migrate to a vanilla Prettier setup in the blueprints, instead of running Prettier via ESLint and Stylelint.
19+
20+
## Motivation
21+
22+
1. Because we run Prettier via ESLint and Stylelint, we only run the files these linters support through Prettier - Using a vanilla Prettier setup, would format all files Prettier supports, ensuring even more consistency in projects
23+
2. Less dependencies in the blueprints - `eslint-plugin-prettier` and `stylelint-prettier` would not be needed anymore
24+
3. The Prettier team recommends running Prettier directly, and not via linters:
25+
- Running Prettier directly is faster than running Prettier via ESLint and Stylelint
26+
- ESLint and Stylelint show red squiggly lines in editors (when using the corresponding extensions), while the idea behind Prettier is to make developers forget about formatting
27+
28+
`3.` is mostly taken from [Integrating with Linters > Notes](https://prettier.io/docs/en/integrating-with-linters.html#notes)
29+
30+
## Detailed Design
31+
32+
We would add the following scripts to the `package.json` file in the `app` blueprint:
33+
34+
```diff
35+
+ "format": "prettier . --cache --write",
36+
+ "lint:format": "prettier . --cache --check",
37+
```
38+
39+
- `lint:format` would check the formatting of _all_ files Prettier supports
40+
- `lint:format` would also run when running the `lint` script
41+
- `format` would format _all_ files Prettier supports
42+
- `format` would also run when running the `lint:fix` script
43+
44+
> NOTE: We use `format` instead of `lint:format:fix`, because we don't want to run Prettier parallel to ESLint and Stylelint when fixing lint errors. The `lint:fix` script will be updated to always run `format` last.
45+
46+
We would remove the following dependencies from the `package.json` file in the `app` blueprint:
47+
48+
```diff
49+
- "eslint-plugin-prettier": "*",
50+
- "stylelint-prettier": "*",
51+
```
52+
53+
As these would not be needed anymore.
54+
55+
> NOTE: We will keep `eslint-config-prettier` installed, as we need this package to turn off the stylistic ESLint rules that might conflict with Prettier.
56+
57+
We would update the `.prettierignore` file in the `app` blueprint:
58+
59+
```diff
60+
+ /pnpm-lock.yaml
61+
```
62+
63+
To make sure Prettier does not format pnpm's lockfile.
64+
65+
We would also need to make sure that every file generated by the `app` blueprint is formatted correctly.
66+
67+
## How We Teach This
68+
69+
N/A
70+
71+
## Drawbacks
72+
73+
- Some developers or teams prefer running Prettier via ESLint and Stylelint
74+
75+
## Alternatives
76+
77+
N/A
78+
79+
## Unresolved Questions
80+
81+
N/A

0 commit comments

Comments
 (0)