You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+77-5Lines changed: 77 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,14 +99,86 @@ For format on save, add to `.vscode/settings.json`:
99
99
}
100
100
```
101
101
102
-
## Choosing Between Prettier and `@stylistic`
102
+
## Using with ESLint and Stylelint
103
103
104
-
The HTML Academy Codeguide is implemented in two parallel ways:
104
+
Prettier handles formatting; ESLint and Stylelint find bugs and enforce conventions. They can — and should — work together in one project, as long as you stop the linters from fighting Prettier over the same whitespace.
105
105
106
-
-**Prettier** (this package) — one formatter for every supported language, format on save, no per-rule reports.
107
-
-**`@stylistic`** inside [`eslint-config-htmlacademy`](https://github.com/htmlacademy/eslint-config-htmlacademy) and [`stylelint-config-htmlacademy`](https://github.com/htmlacademy/stylelint-config-htmlacademy) — formatting rules reported alongside other linter rules, fixable with `eslint --fix` and `stylelint --fix`.
106
+
**Install all three:**
108
107
109
-
Pick one. Running both at the same time will cause both to fight over the same files.
[`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) is the official package that turns off ESLint rules that conflict with Prettier.
116
+
117
+
**`prettier.config.js`:**
118
+
119
+
```js
120
+
importpresetfrom'prettier-config-htmlacademy';
121
+
exportdefaultpreset;
122
+
```
123
+
124
+
**`eslint.config.js`** — `eslint-config-prettier/flat` must come last so it overrides formatting rules from the HTML Academy preset:
| ESLint | JavaScript and TypeScript correctness — unused variables, unsafe patterns, modern syntax, file naming |
177
+
| Stylelint | CSS correctness — BEM class names, property ordering, modern color functions, max nesting, vendor prefixes |
178
+
179
+
### Alternative: linters only, without Prettier
180
+
181
+
If you would rather not add a third tool, skip this package and use `eslint-config-htmlacademy` and `stylelint-config-htmlacademy` on their own. Their built-in `@stylistic` rules cover the same formatting, with `eslint --fix` and `stylelint --fix` as your formatter.
0 commit comments