remark-lint/doc/rules.md
2017-04-29 12:50:49 +02:00

12 KiB
Raw Blame History

Rules

This document describes how to configure rules and lists all available official rules. Each rule is a separate package. See their readmes for more information.

Table of Contents

Configuration

false turns rules off — the code no longer runs:

remark()
  .use(require('remark-lint-final-newline'), false)
  // ...

true turns a rule on again:

remark()
  .use(require('remark-lint-final-newline'), true)
  // ...

Rules can be configured with a severity too. The following is ignores all messages from the plugin:

remark()
  .use(require('remark-lint-final-newline'), [0])
  // ...

...and passing [1] explicitly sets the normal behaviour (warn for problems). To trigger an error instead of a warning, pass 2:

remark()
  .use(require('remark-lint-final-newline'), [2])
  // ...

Its also possible to pass both a severity and configuration:

remark()
  .use(require('remark-lint-maximum-line-length'), [2, 70])
  // ...

Lastly, strings can also be passed, instead of numbers: off instead of 0, warn or on instead of 1, and error instead of 2.

remark()
  .use(require('remark-lint-maximum-line-length'), ['error', 70])
  // ...

List of Rules

This lists contains all “official” rules, developed in this repository. For rules developed outside of this repo, view the List of External Rules.