Skip to content
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: introduce make mdlint command and tools #12756

Closed
wants to merge 6 commits into from

Conversation

watilde
Copy link
Contributor

@watilde watilde commented Apr 30, 2017

Summary

I'm trying to put this PR as a replacement for #11610 and #8551.

cc @ChALkeR @thefourtheye

Checklist

  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Affected core subsystem(s)

tools, doc

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. tools Issues and PRs related to the tools directory. labels Apr 30, 2017
@watilde watilde added the doc Issues and PRs related to the documentations. label Apr 30, 2017
Copy link

@wooorm wooorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Just one question and one suggestion!

'sources': [
'test/cctest/test_env.cc',
...
],
```
The test can be executed by running the `cctest` target:
```
```text
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t this be sh or bash or something instead of text?

Copy link
Member

@ChALkeR ChALkeR Apr 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console is the correct language for those that start with a $.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated it to console. It's handy :)

doc/api/v8.md Outdated
@@ -1,6 +1,6 @@
# V8
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use references and definitions in this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, why not! I've updated it.

@ChALkeR
Copy link
Member

ChALkeR commented Apr 30, 2017

@watilde Thanks so much for doing this, I will take a look =).

@ChALkeR ChALkeR self-assigned this Apr 30, 2017
doc/api/v8.md Outdated
[`vm.Script`]: vm.html#vm_new_vm_script_code_options
[here]: https://github.com/thlorenz/v8-flags/blob/master/flags-0.11.md
[`GetHeapSpaceStatistics`]: https://v8docs.nodesource.com/node-5.0/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for inlining those?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there wasn't. I've updated it!

@thefourtheye thefourtheye mentioned this pull request Apr 30, 2017
2 tasks
Makefile Outdated
@@ -960,6 +966,7 @@ endif
lint \
lint-ci \
list-gtests \
mdlint \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Extra indentation.

@@ -853,6 +853,11 @@ bench: bench-net bench-http bench-fs bench-tls

bench-ci: bench

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably edit the $(TARBALL) target as well, to exclude the tools/remark*

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right! I added it on L717.

@ChALkeR
Copy link
Member

ChALkeR commented Apr 30, 2017

This currently fails CI at the linter stage.

@refack
Copy link
Contributor

refack commented Apr 30, 2017

Before I dive in, one question, what are the benefits over #12563? Answered.
👍

@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt commented Apr 30, 2017

@refack If I get it right, eslint-plugin-markdown checks js code in md files, while this PR aims to check markdown syntax itself, so they do not intersect.

@refack
Copy link
Contributor

refack commented Apr 30, 2017

We need the switch in vcbuild.bat as well🤷, sorry...

Also for the reasons I mention in https://github.com/nodejs/node/pull/12744/files#diff-6a3371457528722a734f3c51d9238c13R54 Could you split this into two PRs:

  1. adding the tools
  2. activating the tool, and fixing.

Since I want to review, and I usually use the webUI for that, and 2181 files kills my browser :(

P.S. does anyone have a better review tool?

@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt commented Apr 30, 2017

Linter errors:

  1. doc\api\fs.md:
    226:7 error Parsing error: Unexpected token {

    The js tag was removed to conform with eslint-plugin-markdown. Maybe you can use console or add an ESlint disabling comment.

  2. doc\guides\writing-tests.md:
    323:10 error Parsing error: Unexpected token :

  3. tools\remark-preset-lint-node\index.js:
    31:1 error Line 31 exceeds the maximum line length of 80 max-len
    39:2 error Missing semicolon semi

@addaleax
Copy link
Member

Could you split this into two PRs:

There should be no need for separate PRs. But yeah, it would be nice to have the changes that only add dependencies in their own commit.

@watilde watilde force-pushed the feature/make-mdlint branch 2 times, most recently from 248a8bb to 3d6a5c0 Compare April 30, 2017 19:20
@watilde
Copy link
Contributor Author

watilde commented Apr 30, 2017

Thanks all for your review comments! I just divided the commit into several commits for the review, and coped with the review comments.

For the vcbuild.bat, unfortunately I cannot run vcbuild.bat on my environment. I'd like to pass the implementation to another contributor who has the execution environment after this patch gets merge if it's fine to you all.

@watilde
Copy link
Contributor Author

watilde commented Apr 30, 2017

ci: https://ci.nodejs.org/job/node-test-pull-request/7763/

@ChALkeR
Copy link
Member

ChALkeR commented May 1, 2017

.eslintignore should include tools/remark-cli — we don't want that to be checked. It currently passes, but nevertheless.

remark-preset-lint-node should not be ignored, though (it currently isn't, mentioning just in case).

Makefile Outdated
mdlint:
@echo "Running Markdown linter..."
$(NODE) tools/remark-cli/cli.js -q \
doc/api doc/api_assets doc/guides src lib benchmark tools/doc/ tools/icu/
Copy link
Member

@ChALkeR ChALkeR May 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why are other stuff from doc is ignored (e.g. onboarding.md and changelogs)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changelogs should be excluded since they have commit messages that make some lint errors and shouldn't be changed. The other docs can be included, then I will update it with --ignore-path=doc/changelogs.

Copy link
Member

@ChALkeR ChALkeR May 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. There are two lint errors in the whole doc dir currently:

doc/changelogs/CHANGELOG_V6.md
  1325:95-1325:107  warning  Don’t pad `emphasis` with inner spaces  no-inline-padding  remark-lint

doc/releases.md
       298:1-302:4  warning  Missing code-language flag              fenced-code-flag   remark-lint

I don't agree that the commit messages in the changelog should not be touched — those could be actual errors that made changelog look bad. E.g. if a changelog includes __proto__, we don't want it to render as «proto», we want to render it as «__proto__» or «__proto__» — so amending the changelog to escape those things sounds reasonable to me, and I would want the linter to catch those errors. See commit a58b48bc3bc, for example.

So I would prefer if this just replaced handle__ with either `handle__` or handle\_\_ in the changelogs (and similarly for handle_).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this comment, I thought that anyone should not touch the commit message in the changelog anyway, but it's fine if we've polished it in the past because it's absolutely better for users who read the rendered docs. Will update it :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that was about typos, which is pretty much the actual content — it makes sense not to change that.

And the fact that commit messages (initially in text) are converted to changelogs (which are Markdown) without proper escaping is mostly a tooling issue here (which is likely not worth fixing, though — those are very rare and the linter would catch that).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that whatever generates the changelogs should have escaped some symbols like `_*~\, prefixing those with \. But for the cases that are already there and that require manual fixing, perhaps using inline code blocks makes more sense where appropriate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may also include the root directory as well to check them(e.g. README.md, CONTRIBUTING.md).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased with your suggestion🐱

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChALkeR remark is pretty good at escaping and generating markdown btw ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wooorm, I filed an issue to nodejs/changelog-maker#47.

@watilde
Copy link
Contributor Author

watilde commented May 1, 2017

ci: https://ci.nodejs.org/job/node-test-pull-request/7771/
(I didn't add the tool sources into .eslintignore)

new ci: https://ci.nodejs.org/job/node-test-pull-request/7772/

@watilde watilde force-pushed the feature/make-mdlint branch from 7498d01 to fd939da Compare May 1, 2017 11:36
@watilde
Copy link
Contributor Author

watilde commented May 2, 2017

The failed test on FreeBSD seems unrelated: https://ci.nodejs.org/job/node-test-commit-freebsd/nodes=freebsd10-64/8681/console

@watilde
Copy link
Contributor Author

watilde commented May 2, 2017

I'm thinking it would be easier to manage the rule set if I add the preset plugin as just a directory with a package.json which has private: true prop.

@lpinca
Copy link
Member

lpinca commented May 2, 2017

It's a bit impractical to review the first 2 commits. Last 3 LGTM.

@ChALkeR
Copy link
Member

ChALkeR commented May 2, 2017

The remark-preset-lint-node package that contains the remark settings for Node.js documentation and that was created for this purpose (introduced in the second commit here) has upstream location in https://github.com/watilde/remark-preset-lint-node and is copyright by @watilde.

I personally don't have anything against that (so no action required atm), but just to be sure: @nodejs/ctc — is that something that we better want in the foundation or not?

Edit: /ping @nodejs/tsc

gibfahn pushed a commit that referenced this pull request Oct 30, 2017
PR-URL: #12756
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
gibfahn pushed a commit that referenced this pull request Oct 31, 2017
PR-URL: #12756
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
gibfahn pushed a commit that referenced this pull request Oct 31, 2017
PR-URL: #12756
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
gibfahn pushed a commit that referenced this pull request Oct 31, 2017
PR-URL: #12756
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
gibfahn pushed a commit that referenced this pull request Oct 31, 2017
PR-URL: #12756
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
gibfahn pushed a commit that referenced this pull request Oct 31, 2017
PR-URL: #12756
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
gibfahn pushed a commit that referenced this pull request Oct 31, 2017
PR-URL: #12756
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
@gibfahn gibfahn mentioned this pull request Oct 31, 2017
@MylesBorins
Copy link
Contributor

when this landed it should have come with a license update, without it we would be in violation of the remark-cli MIT license. I've opened #16637 to fix this.

@gibfahn
Copy link
Member

gibfahn commented Oct 31, 2017

Should land with #16637 if it lands on v6.x.

@MylesBorins
Copy link
Contributor

I'd like to figure out what the story is with dependencies before landing this.

I think it is safe to add tools in semver-patch, but I don't want to break testing the tarballs

addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
CONTRIBUTING.md
  + L857: Unused definition
  + L861: Unused definition
  + L863: Unused definition

doc/api/assert.md
  + L719: Unused definition

doc/api/async_hooks.md
  + L460: Missing code-language flag

doc/api/child_process.md
  + L1362: Unused definition

doc/api/dns.md
  + L674: Unused definition

doc/api/esm.md
  + L178: Missing code-language flag

doc/api/http.md
  + L1868: Unused definition
  + L1887: Unused definition
  + L1888: Unused definition
  + L1889: Unused definition
  + L1916: Unused definition
  + L1917: Unused definition

doc/api/https.md
  + L260: Unused definition

doc/api/os.md
  + L1226: Unused definition

doc/api/process.md
  + L1888: Unused definition

doc/api/stream.md
  + L2227: Definitions with the same identifier

doc/guides/writing-and-running-benchmarks.md
  + L1: Missing newline character at end of file

Refs: nodejs/node#12756
PR-URL: nodejs/node#16385
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
PR-URL: nodejs/node#12756
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
PR-URL: nodejs/node#12756
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
PR-URL: nodejs/node#12756
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
PR-URL: nodejs/node#12756
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
PR-URL: nodejs/node#12756
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
PR-URL: nodejs/node#12756
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
@MylesBorins MylesBorins added the baking-for-lts PRs that need to wait before landing in a LTS release. label Dec 20, 2017
gabrielschulhof pushed a commit to gabrielschulhof/node that referenced this pull request Apr 10, 2018
PR-URL: nodejs#14707
Refs: nodejs#12756
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
MylesBorins pushed a commit that referenced this pull request Apr 16, 2018
Backport-PR-URL: #19447
PR-URL: #14707
Refs: #12756
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
@MylesBorins MylesBorins removed the baking-for-lts PRs that need to wait before landing in a LTS release. label Aug 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. doc Issues and PRs related to the documentations. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.