Skip to content

Latest commit

 

History

History
155 lines (127 loc) · 13.3 KB

rules.md

File metadata and controls

155 lines (127 loc) · 13.3 KB

Rules

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

Contents

Configuration

false turns rules off — the code no longer runs:

import remarkLintFinalNewline from 'remark-lint-final-newline'

remark()
  .use(remarkLintFinalNewline, false)
  // …

true turns a rule on again:

import remarkLintFinalNewline from 'remark-lint-final-newline'

remark()
  .use(remarkLintFinalNewline, true)
  // …

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

import remarkLintFinalNewline from 'remark-lint-final-newline'

remark()
  .use(remarkLintFinalNewline, [0])
  // …

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

import remarkLintFinalNewline from 'remark-lint-final-newline'

remark()
  .use(remarkLintFinalNewline, [2])
  // …

It’s also possible to pass both a severity and configuration:

import remarkLintMaximumLineLength from 'remark-lint-maximum-line-length'

remark()
  .use(remarkLintMaximumLineLength, [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.

import remarkLintMaximumLineLength from 'remark-lint-maximum-line-length'

remark()
  .use(remarkLintMaximumLineLength, ['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.