markdownlintremarkjs

How to ignore files for remark-lint?


remark-lint is a Markdown linter written in JS. If offers a nice set of rules. This tool is also used by Codacy to check uploaded repositories for warnings and errors.

My repository contains an Apache License in Markdown, but unfortunately, the writers of the license didn't consult and editor to check for typographic mistakes like "no dot after a headline" (because it's not a sentence!). Anyhow, remark-lint is now complaining, but if I change the document, it's not the Apache license anymore. (See discussions with licence detecting tools e.g. used by GitHub. They refuse the Markdown file to be identical.)

My question is: how to configure remark-lint to ignore files or better to ignore rules per file/directory.

I read about:

But it doesn't state how to disable rules either inline or per configuration per file as user linters can do.


Solution

  • Since remark-lint is a remark plugin it uses the same configuration files:

    remark-lint is a remark plugin and when used on the CLI supports configuration through its configuration files

    One of remark's configuration files is .remarkignore. I think a .remarkignore file containing something like

    path/to/license.md
    

    or

    path/to/license/directory/
    

    will do the trick.

    The format for ignore files is the same as .gitignore

    To configure specific rules per-directory, try putting a .remarkrc file in the directory whose rules you wish to change.


    Caveat: note the "when used on the CLI" bit in the first quote above. If you're using remark-lint via its JavaScript API this might not work.