Skip to content

Commit

Permalink
fixup! tools: notify user if format-md needs to be run
Browse files Browse the repository at this point in the history
  • Loading branch information
Trott committed Oct 29, 2021
1 parent ddb62b6 commit 4c0d31d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/lint-md/lint-md.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29332,6 +29332,10 @@ const linter = unified()

paths.forEach(async (path) => {
const file = await read(path);
// We need to calculate `fileContents` before running `linter.process(files)`
// because `linter.process(files)` mutates `file` and returns it as `result`.
// So we won't be able to use `file` after that to see if its contents have
// changed as they will have been altered to the changed version.
const fileContents = file.toString();
const result = await linter.process(file);
if (format) {
Expand Down
4 changes: 4 additions & 0 deletions tools/lint-md/lint-md.src.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ const linter = unified()

paths.forEach(async (path) => {
const file = await read(path);
// We need to calculate `fileContents` before running `linter.process(files)`
// because `linter.process(files)` mutates `file` and returns it as `result`.
// So we won't be able to use `file` after that to see if its contents have
// changed as they will have been altered to the changed version.
const fileContents = file.toString();
const result = await linter.process(file);
if (format) {
Expand Down

0 comments on commit 4c0d31d

Please sign in to comment.