What can formatting tell you about a code change?
Prettier reads supported files and prints them in a consistent style. It can flag inconsistent spaces or wrapping. If a shopping total is wrong, you need a test or code review to find out why.
Use a linter for the code patterns you want to check, and avoid having both tools enforce conflicting formatting rules.
How can you see what needs formatting without overwriting it?
Use the project’s check-only command on the intended files. Prettier’s check mode reports files with formatting differences. Its write mode replaces files in place. Check which files are selected before writing.
Keep a large formatting pass separate from a behavior change when possible. That gives the reviewer a smaller set of changes to inspect for app logic.
How do you get the same formatting in the editor and build checks?
Save the configuration and the installed version with the project. Check which files are ignored. Prettier is MIT-licensed. Running the project’s checks on a hosted build service may use that service’s allowance.
If you replace the formatter, try the new settings on a small copy and inspect the difference before changing the shared project.
Can you tell a formatting change from a behavior change?
Draw two versions of a fictional settings file. Do not run a formatter or open a real project.
- Change only the layoutPut the same setting and value on a line with different spacing. Expect a style check to notice the layout if it differs from the configured style.
- Change what the app receivesChange the value from 2 to 3 without altering spacing. Expect the same style check to have no reason to flag the new value.
- Name the other checkWrite the value you actually want. Read the changed line or use a separate app test to verify it.