Skip to content

Commit

Permalink
Use npm to manage Prettier tool dependency
Browse files Browse the repository at this point in the history
The project uses the Prettier tool to format various file types. Previously, the version of the tool used was not
controlled. This was problematic because:

- A different version of the tool may be used on the contributor's machine than on the CI runner, resulting in confusing
  failures.
- The project is immediately subject to disruption or breakage resulting from a release of the tool.

The new approach is to specify the version of the tools via the standard npm metadata files (package.json +
package-lock.json), providing the following benefits:

- Enables automated updates via Dependabot PRs
- Enables automated vulnerability alerts
  • Loading branch information
per1234 committed Oct 11, 2024
1 parent 5702d93 commit 95276ca
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ indexes/testdata/package_index.json

# Generated files
/.licenses/
node_modules/
2 changes: 2 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ tasks:
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-prettier-formatting-task/Taskfile.yml
general:format-prettier:
desc: Format all supported files with Prettier
deps:
- task: npm:install-deps
cmds:
- npx prettier --write .

Expand Down
18 changes: 17 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"devDependencies": {
"markdown-link-check": "^3.12.1",
"markdownlint-cli": "^0.37.0"
"markdownlint-cli": "^0.37.0",
"prettier": "^3.3.3"
}
}

0 comments on commit 95276ca

Please sign in to comment.