-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tools: update Markdown linter to be cross-platform #31239
tools: update Markdown linter to be cross-platform #31239
Conversation
A little more information might be useful. This PR uses the original way of bundling with only slight modifications to its code. |
Relevant failure on Travis: /home/travis/build/nodejs/node/tools/node-lint-md-cli-rollup/rollup.config.js
1:1 error Parsing error: 'import' and 'export' may appear only with 'sourceType: "module"'
> 1 | import resolve from '@rollup/plugin-node-resolve';
| ^
2 | import commonjs from '@rollup/plugin-commonjs';
3 | import json from '@rollup/plugin-json';
4 |
✖ 1 problem (1 error, 0 warnings) |
ESLint is still failing (run
|
The Travis markdown linting is failing because |
/to @Trott
Sorry about that! I forgot that build products were being committed. I've tested this to be working on:
Verify on Linux
Note: these steps should also work on macOS, although I haven't tested. Verify on Windows Note: there is no
|
Perhaps all that's necessary to have this passing again on Travis would be to add the |
/to @Trott
It seems to have passed all the CI checks once I re-committed the bundled build product. It now says "All checks have passed 5 successful checks." Is there another check that I should be looking at? P.S. I could not get |
@Trott, after looking at this again, it seems like you may have been interested in avoiding the build product being committed. I have never been a fan of committing build products as the alternative is much cleaner. The CI (and others who use the linter) would then be expected to build the bundle themselves. There are actually three different options (and a bonus) that I can see at this point:
My preference is option 3 with the only drawback being that it may take a bit longer to get the linter to be operational. Bonus (CI only): use Travis Workspaces (Beta) to use a previous build's artifact of the bundle avoiding the need to rebuild it each time. This can even be the minified bundle if that saves transfer time. Please let me know what you decide! |
My suggestion was to add the build step to Travis rather than commit the build product, although committing the build product would be continuing what we currently do and I wouldn't oppose it.
This is what I meant when I wrote:
In other words, add the necessary build step to the Travis config file.
Same!
The build step takes seconds on my laptop and I can't imagine it would be much slower in CI. I'm still all for option 3! |
(Also, this needs a rebase because we updated remark-preset-lint-node recently. Sorry/thanks!) |
@Trott, all checks have passed. I did not include any additional documentation recommending to run |
@Trott, I've tied up all loose ends on this PR. What follows are the results of all remaining inquiries.
I was able to confirm that these all work flawlessly:
The command to build the linter on Windows doesn't currently exist:
(I'm not sure this is necessary.)
Currently, no documentation is instructing people to build the Markdown linter from the source. However, this is OK because the committed bundle works out of the box all majors OSes. I've tested this to be true for:
As you can see, all CI checks have passed which means that it concurs. With my most recent fixup, I've ensured hat the linter is able to be built from source on all three of these OSes too.
I took care of this as well. It might be nice to drive this one home soon enough to be included in #31368 (along with #30216) to ensure that the Markdown linter is fully buildable and operational on all platforms. |
Prior to this commit, the dependencies were not matching the build procedure. This has been corrected and it has the added benefit of being able to be built on Windows as well. * continue using `rollup` rather than `ncc` * do not require `fs-event`s for non-macOS * use `npx` and `shx` for cross-platform building * ensure `lint-md-rollup` runs before `lint-md`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove tools/lint-md.js before landing since the Maekfile will build it in the course of a normal test-doc build?
Or else can we get rid of |
You're right about that. I think the best option would be to stop running the command to build it during installation since the committed bundle works cross-platform anyway. Does that sound good to you? I think the only functionality that would require this to be re-built on another platform would be if someone is doing file watching (fsevents macOS problem). I don't think this ever takes place during the entire linting process. |
Yes. Then it will be a lot easier to figure out if |
/to @Trott
If this were to happen, we'd need to include a build task for |
Yeah, I think the thing to do is stop running the md-lint-build step as part of linting and just keep lint-md.js in the repository. |
@Trott, the PR currently reflects the behavior you describe — the linter is only built on-demand and is not part of any other tasks. I'm not sure why my fixup! commit isn't showing in the changed files, but I did take care of it there. |
Landed in a751389 |
Prior to this commit, the dependencies were not matching the build procedure. This has been corrected and it has the added benefit of being able to be built on Windows as well. * continue using `rollup` rather than `ncc` * do not require `fs-event`s for non-macOS * use `npx` and `shx` for cross-platform building * ensure `lint-md-rollup` runs before `lint-md` PR-URL: #31239 Reviewed-By: Rich Trott <rtrott@gmail.com>
Prior to this commit, the dependencies were not matching the build procedure. This has been corrected and it has the added benefit of being able to be built on Windows as well. * continue using `rollup` rather than `ncc` * do not require `fs-event`s for non-macOS * use `npx` and `shx` for cross-platform building * ensure `lint-md-rollup` runs before `lint-md` PR-URL: #31239 Reviewed-By: Rich Trott <rtrott@gmail.com>
Prior to this commit, the dependencies were not matching the build procedure. This has been corrected and it has the added benefit of being able to be built on Windows as well. * continue using `rollup` rather than `ncc` * do not require `fs-event`s for non-macOS * use `npx` and `shx` for cross-platform building * ensure `lint-md-rollup` runs before `lint-md` PR-URL: #31239 Reviewed-By: Rich Trott <rtrott@gmail.com>
Prior to this commit, the dependencies were not matching the build procedure. This has been corrected and it has the added benefit of being able to be built on Windows as well. * continue using `rollup` rather than `ncc` * do not require `fs-event`s for non-macOS * use `npx` and `shx` for cross-platform building * ensure `lint-md-rollup` runs before `lint-md` PR-URL: #31239 Reviewed-By: Rich Trott <rtrott@gmail.com>
Prior to this commit, the dependencies were not matching the build procedure. This has been corrected and it has the added benefit of being able to be built on Windows as well. * continue using `rollup` rather than `ncc` * do not require `fs-event`s for non-macOS * use `npx` and `shx` for cross-platform building * ensure `lint-md-rollup` runs before `lint-md` PR-URL: #31239 Reviewed-By: Rich Trott <rtrott@gmail.com>
Prior to this commit, the dependencies were not
matching the build procedure. This has been
corrected and it has the added benefit of being
able to be built on Windows as well.
rollup
rather thanncc
fs-event
s for non-macOSnpx
andshx
for cross-platform buildinglint-md-rollup
runs beforelint-md
/cc @Trott
Checklist