-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Most appropriate sub-area of p5.js?
- Accessibility (Web Accessibility)
- Build tools and processes
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Friendly error system
- Image
- IO (Input/Output)
- Localization
- Math
- Unit Testing
- Typography
- Utilities
- WebGL
- Other (specify if possible)
-> Developer tools / environment
Details about the bug:
- p5.js version: 1.1.9
- Web browser and version: N/A
- Operating System: Windows, MacOS
- Steps to reproduce this:
- Install dependencies with
npm ci - Open project directory in Visual Studio Code
- Install recommended extensions as prompted by
.vscode/extensions.json - Run command
Format Documentin VS Code
The plugin "Prettier Formatter for Visual Studio Code" will display the following error/warning:
Your project is configured to use an outdated version of prettier that cannot be used by this extension. Upgrade to the latest version of prettier.
The tricky thing is that Prettier 2.0 has come out in the meantime. They've introduced a few breaking changes to the formatting, such as using trailing commas and inserting a space before the parentheses in function () {}. These changes require a bunch of small formatting changes to nearly all of the modules in the project.
Unfortunately, despite the error message, the VS Code Format Document command proceeds to format anyways, but it uses a recent version of Prettier rather than the local project version. Since the linting step uses the local version (1.10.2), this means running Format Document can introduce a bunch of formatting problems and cause npm run grunt to fail. (NOTE: This might just be due to how I have VS Code set up personally, falling back to my global settings or something? Can anyone else confirm if this is universal?)
If someone can confirm that this isn't just my system, I think it's worth updating Prettier to save new contributors the potential frustration of formatting errors that are caused by their formatting tools. Thoughts?
References:
https://github.com/processing/p5.js/blob/main/.vscode/extensions.json#L8
https://github.com/processing/p5.js/blob/main/package.json#L81
prettier/prettier#3845