diff --git a/doc/create-a-custom-rule.md b/doc/create-a-custom-rule.md index feac908d..5d4d0f38 100644 --- a/doc/create-a-custom-rule.md +++ b/doc/create-a-custom-rule.md @@ -131,21 +131,25 @@ We then export the result of calling `rule` by providing the *namespace and rule ```js // rules/no-gif-allowed.js +import {lintRule} from 'unified-lint-rule' -var rule = require('unified-lint-rule') -function noGifAllowed(tree, file, options) { - // Rule implementation -} -module.exports = rule('remark-lint:no-gif-allowed', noGifAllowed) +const remarkLintNoGifAllowed = lintRule( + 'remark-lint:no-gif-allowed', + (tree, file, options) => { + // Rule implementation + } +) + +export default remarkLintNoGifAllowed ``` Let’s say you want all your custom rules to be defined as part of your project namespace. If your project was named `my-project`, then you can export your rule as: ```js -module.exports = rule('my-project-name:no-gif-allowed', noGifAllowed) +const remarkLintNoGifAllowed = lintRule('my-project-name:no-gif-allowed', () => {}) // Or: -module.exports = rule('my-npm-published-package:no-gif-allowed', noGifAllowed) +const remarkLintNoGifAllowed = lintRule('my-npm-published-package:no-gif-allowed', () => {}) ``` This can help you when wanting to create a group of rules under the same *namespace*. @@ -157,7 +161,7 @@ This can help you when wanting to create a group of rules under the same *namesp Your rule function will receive three arguments: ```js -function noGifAllowed(tree, file, options) {} +(tree, file, options) => {} ``` * `tree` (*required*): [mdast](https://github.com/syntax-tree/mdast) @@ -173,9 +177,9 @@ Because we will be inspecting [mdast](https://github.com/syntax-tree/mdast), whi For this example, we will use [`unist-util-visit`](https://github.com/syntax-tree/unist-util-visit) to recursively inspect all the image nodes, and [`unist-util-generated`](https://github.com/syntax-tree/unist-util-generated) to ensure we are not inspecting nodes that we have generated ourselves and do not belong to the `doc.md`. ```js -const rule = require('unified-lint-rule') -const visit = require('unist-visit-util') -const generated = require('unist-util-generated') +import {lintRule} from 'unified-lint-rule' +import {visit} from 'unist-visit-util' +import {generated} from 'unist-util-generated' function isValidNode(node) { // Here we check whether the given node violates our rule. @@ -185,27 +189,32 @@ function isValidNode(node) { return !node.url.endsWith('.gif') } } -function noGifAllowed(tree, file, options) { - visit(tree, 'image', visitor) - function visitor(node) { - if (!generated(node)) { - // This is an extremely simplified example of how to structure - // the logic to check whether a node violates your rule. - // You have complete freedom over how to visit/inspect the tree, - // and on how to implement the validation logic for your node. - const isValid = isValidNode(node) - if (!isValid) { - // Remember to provide the node as second argument to the message, - // in order to obtain the position and column where the violation occurred. - file.message( - 'Invalid image file extentions. Please do not use gifs', - node - ) + +const remarkLintNoGifAllowed = lintRule( + 'remark-lint:no-gif-allowed', + (tree, file, options) => { + visit(tree, 'image', (node) => { + if (!generated(node)) { + // This is an extremely simplified example of how to structure + // the logic to check whether a node violates your rule. + // You have complete freedom over how to visit/inspect the tree, + // and on how to implement the validation logic for your node. + const isValid = isValidNode(node) + + if (!isValid) { + // Remember to provide the node as second argument to the message, + // in order to obtain the position and column where the violation occurred. + file.message( + 'Invalid image file extentions. Please do not use gifs', + node + ) + } } - } + }) } -} -module.exports = rule('remark-lint:no-gif-allowed', noGifAllowed) +) + +export default remarkLintNoGifAllowed ``` [Back to Top](#contents) @@ -218,11 +227,15 @@ You can do that by importing your rule and adding it in `plugins` array: ```js // .remarkrc.js -const noGifAllowed = require('./rules/no-gif-allowed.js') +import remarkLintNoGifAllowed from './rules/no-gif-allowed.js' -module.exports = { - plugins: [noGifAllowed] +const plugins = { + plugins: [remarkLintNoGifAllowed] } + +const preset = {plugins} + +export default preset ``` [Back to Top](#contents) diff --git a/doc/rules.md b/doc/rules.md index 4852a3b3..1da98dbf 100644 --- a/doc/rules.md +++ b/doc/rules.md @@ -14,16 +14,20 @@ information. `false` turns rules off — the code no longer runs: ```js +import remarkLintFinalNewline from 'remark-lint-final-newline' + remark() - .use(require('remark-lint-final-newline'), false) + .use(remarkLintFinalNewline, false) // … ``` `true` turns a rule on again: ```js +import remarkLintFinalNewline from 'remark-lint-final-newline' + remark() - .use(require('remark-lint-final-newline'), true) + .use(remarkLintFinalNewline, true) // … ``` @@ -31,8 +35,10 @@ Rules can be configured with a severity too. The following ignores all messages from the plugin: ```js +import remarkLintFinalNewline from 'remark-lint-final-newline' + remark() - .use(require('remark-lint-final-newline'), [0]) + .use(remarkLintFinalNewline, [0]) // … ``` @@ -40,16 +46,20 @@ remark() To trigger an error instead of a warning, pass `2`: ```js +import remarkLintFinalNewline from 'remark-lint-final-newline' + remark() - .use(require('remark-lint-final-newline'), [2]) + .use(remarkLintFinalNewline, [2]) // … ``` It’s also possible to pass both a severity and configuration: ```js +import remarkLintMaximumLineLength from 'remark-lint-maximum-line-length' + remark() - .use(require('remark-lint-maximum-line-length'), [2, 70]) + .use(remarkLintMaximumLineLength, [2, 70]) // … ``` @@ -58,8 +68,10 @@ Lastly, strings can also be passed, instead of numbers: `error` instead of `2`. ```js +import remarkLintMaximumLineLength from 'remark-lint-maximum-line-length' + remark() - .use(require('remark-lint-maximum-line-length'), ['error', 70]) + .use(remarkLintMaximumLineLength, ['error', 70]) // … ``` diff --git a/packages/remark-lint-blockquote-indentation/readme.md b/packages/remark-lint-blockquote-indentation/readme.md index c3e6f218..d6d80d29 100644 --- a/packages/remark-lint-blockquote-indentation/readme.md +++ b/packages/remark-lint-blockquote-indentation/readme.md @@ -121,14 +121,17 @@ remark -u lint -u lint-blockquote-indentation readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintBlockquoteIndentation from 'remark-lint-blockquote-indentation' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-blockquote-indentation')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintBlockquoteIndentation) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-checkbox-character-style/readme.md b/packages/remark-lint-checkbox-character-style/readme.md index 23bfffae..6e807ef1 100644 --- a/packages/remark-lint-checkbox-character-style/readme.md +++ b/packages/remark-lint-checkbox-character-style/readme.md @@ -192,14 +192,17 @@ remark -u lint -u lint-checkbox-character-style readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintCheckboxCharacterStyle from 'remark-lint-checkbox-character-style' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-checkbox-character-style')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintCheckboxCharacterStyle) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-checkbox-content-indent/readme.md b/packages/remark-lint-checkbox-content-indent/readme.md index b8d74303..108bd1fa 100644 --- a/packages/remark-lint-checkbox-content-indent/readme.md +++ b/packages/remark-lint-checkbox-content-indent/readme.md @@ -90,14 +90,17 @@ remark -u lint -u lint-checkbox-content-indent readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintCheckboxContentIndent from 'remark-lint-checkbox-content-indent' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-checkbox-content-indent')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintCheckboxContentIndent) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-code-block-style/readme.md b/packages/remark-lint-code-block-style/readme.md index f2cc4f5e..3a655d4e 100644 --- a/packages/remark-lint-code-block-style/readme.md +++ b/packages/remark-lint-code-block-style/readme.md @@ -190,14 +190,17 @@ remark -u lint -u lint-code-block-style readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintCodeBlockStyle from 'remark-lint-code-block-style' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-code-block-style')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintCodeBlockStyle) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-definition-case/readme.md b/packages/remark-lint-definition-case/readme.md index 731f6ac9..27528f19 100644 --- a/packages/remark-lint-definition-case/readme.md +++ b/packages/remark-lint-definition-case/readme.md @@ -82,14 +82,17 @@ remark -u lint -u lint-definition-case readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintDefinitionCase from 'remark-lint-definition-case' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-definition-case')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintDefinitionCase) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-definition-spacing/readme.md b/packages/remark-lint-definition-spacing/readme.md index 173b0d4b..81bad1b0 100644 --- a/packages/remark-lint-definition-spacing/readme.md +++ b/packages/remark-lint-definition-spacing/readme.md @@ -84,14 +84,17 @@ remark -u lint -u lint-definition-spacing readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintDefinitionSpacing from 'remark-lint-definition-spacing' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-definition-spacing')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintDefinitionSpacing) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-emphasis-marker/readme.md b/packages/remark-lint-emphasis-marker/readme.md index 54540c38..61200639 100644 --- a/packages/remark-lint-emphasis-marker/readme.md +++ b/packages/remark-lint-emphasis-marker/readme.md @@ -158,14 +158,17 @@ remark -u lint -u lint-emphasis-marker readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintEmphasisMarker from 'remark-lint-emphasis-marker' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-emphasis-marker')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintEmphasisMarker) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-fenced-code-flag/readme.md b/packages/remark-lint-fenced-code-flag/readme.md index c1f90b19..092c6a2b 100644 --- a/packages/remark-lint-fenced-code-flag/readme.md +++ b/packages/remark-lint-fenced-code-flag/readme.md @@ -163,14 +163,17 @@ remark -u lint -u lint-fenced-code-flag readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintFencedCodeFlag from 'remark-lint-fenced-code-flag' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-fenced-code-flag')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintFencedCodeFlag) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-fenced-code-marker/readme.md b/packages/remark-lint-fenced-code-marker/readme.md index 530fe651..013063dc 100644 --- a/packages/remark-lint-fenced-code-marker/readme.md +++ b/packages/remark-lint-fenced-code-marker/readme.md @@ -177,14 +177,17 @@ remark -u lint -u lint-fenced-code-marker readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintFencedCodeMarker from 'remark-lint-fenced-code-marker' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-fenced-code-marker')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintFencedCodeMarker) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-file-extension/readme.md b/packages/remark-lint-file-extension/readme.md index ac4c474d..8ea1979d 100644 --- a/packages/remark-lint-file-extension/readme.md +++ b/packages/remark-lint-file-extension/readme.md @@ -89,14 +89,17 @@ remark -u lint -u lint-file-extension readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintFileExtension from 'remark-lint-file-extension' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-file-extension')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintFileExtension) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-final-definition/readme.md b/packages/remark-lint-final-definition/readme.md index 82acb369..ac637efa 100644 --- a/packages/remark-lint-final-definition/readme.md +++ b/packages/remark-lint-final-definition/readme.md @@ -107,14 +107,17 @@ remark -u lint -u lint-final-definition readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintFinalDefinition from 'remark-lint-final-definition' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-final-definition')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintFinalDefinition) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-final-newline/readme.md b/packages/remark-lint-final-newline/readme.md index a846e996..198cf452 100644 --- a/packages/remark-lint-final-newline/readme.md +++ b/packages/remark-lint-final-newline/readme.md @@ -97,14 +97,17 @@ remark -u lint -u lint-final-newline readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintFinalNewline from 'remark-lint-final-newline' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-final-newline')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintFinalNewline) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-first-heading-level/readme.md b/packages/remark-lint-first-heading-level/readme.md index 58aa5ba3..95d0653a 100644 --- a/packages/remark-lint-first-heading-level/readme.md +++ b/packages/remark-lint-first-heading-level/readme.md @@ -194,14 +194,17 @@ remark -u lint -u lint-first-heading-level readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintFirstHeadingLevel from 'remark-lint-first-heading-level' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-first-heading-level')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintFirstHeadingLevel) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-hard-break-spaces/readme.md b/packages/remark-lint-hard-break-spaces/readme.md index 11888a42..49de9e79 100644 --- a/packages/remark-lint-hard-break-spaces/readme.md +++ b/packages/remark-lint-hard-break-spaces/readme.md @@ -89,14 +89,17 @@ remark -u lint -u lint-hard-break-spaces readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintHardBreakSpaces from 'remark-lint-hard-break-spaces' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-hard-break-spaces')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintHardBreakSpaces) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-heading-increment/readme.md b/packages/remark-lint-heading-increment/readme.md index 8e98a5f5..99352ce1 100644 --- a/packages/remark-lint-heading-increment/readme.md +++ b/packages/remark-lint-heading-increment/readme.md @@ -86,14 +86,17 @@ remark -u lint -u lint-heading-increment readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintHeadingIncrement from 'remark-lint-heading-increment' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-heading-increment')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintHeadingIncrement) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-heading-style/readme.md b/packages/remark-lint-heading-style/readme.md index 7df577fe..538a8f56 100644 --- a/packages/remark-lint-heading-style/readme.md +++ b/packages/remark-lint-heading-style/readme.md @@ -152,14 +152,17 @@ remark -u lint -u lint-heading-style readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintHeadingStyle from 'remark-lint-heading-style' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-heading-style')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintHeadingStyle) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-linebreak-style/readme.md b/packages/remark-lint-linebreak-style/readme.md index f75fd549..7d88ce80 100644 --- a/packages/remark-lint-linebreak-style/readme.md +++ b/packages/remark-lint-linebreak-style/readme.md @@ -130,14 +130,17 @@ remark -u lint -u lint-linebreak-style readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintLinebreakStyle from 'remark-lint-linebreak-style' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-linebreak-style')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintLinebreakStyle) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-link-title-style/readme.md b/packages/remark-lint-link-title-style/readme.md index 18bf8bbf..a0652f68 100644 --- a/packages/remark-lint-link-title-style/readme.md +++ b/packages/remark-lint-link-title-style/readme.md @@ -202,14 +202,17 @@ remark -u lint -u lint-link-title-style readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintLinkTitleStyle from 'remark-lint-link-title-style' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-link-title-style')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintLinkTitleStyle) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-list-item-bullet-indent/readme.md b/packages/remark-lint-list-item-bullet-indent/readme.md index ffdaf22f..cb1d893f 100644 --- a/packages/remark-lint-list-item-bullet-indent/readme.md +++ b/packages/remark-lint-list-item-bullet-indent/readme.md @@ -99,14 +99,17 @@ remark -u lint -u lint-list-item-bullet-indent readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintListItemBulletIndent from 'remark-lint-list-item-bullet-indent' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-list-item-bullet-indent')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintListItemBulletIndent) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-list-item-content-indent/readme.md b/packages/remark-lint-list-item-content-indent/readme.md index 061cff40..7c8899bc 100644 --- a/packages/remark-lint-list-item-content-indent/readme.md +++ b/packages/remark-lint-list-item-content-indent/readme.md @@ -93,14 +93,17 @@ remark -u lint -u lint-list-item-content-indent readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintListItemContentIndent from 'remark-lint-list-item-content-indent' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-list-item-content-indent')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintListItemContentIndent) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-list-item-indent/readme.md b/packages/remark-lint-list-item-indent/readme.md index 94fc9b42..5a5b059c 100644 --- a/packages/remark-lint-list-item-indent/readme.md +++ b/packages/remark-lint-list-item-indent/readme.md @@ -223,14 +223,17 @@ remark -u lint -u lint-list-item-indent readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintListItemIndent from 'remark-lint-list-item-indent' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-list-item-indent')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintListItemIndent) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-list-item-spacing/readme.md b/packages/remark-lint-list-item-spacing/readme.md index 4442c527..09066421 100644 --- a/packages/remark-lint-list-item-spacing/readme.md +++ b/packages/remark-lint-list-item-spacing/readme.md @@ -188,14 +188,17 @@ remark -u lint -u lint-list-item-spacing readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintListItemSpacing from 'remark-lint-list-item-spacing' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-list-item-spacing')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintListItemSpacing) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-maximum-heading-length/readme.md b/packages/remark-lint-maximum-heading-length/readme.md index 3221f98c..d13f01ae 100644 --- a/packages/remark-lint-maximum-heading-length/readme.md +++ b/packages/remark-lint-maximum-heading-length/readme.md @@ -90,14 +90,17 @@ remark -u lint -u lint-maximum-heading-length readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintMaximumHeadingLength from 'remark-lint-maximum-heading-length' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-maximum-heading-length')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintMaximumHeadingLength) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-maximum-line-length/readme.md b/packages/remark-lint-maximum-line-length/readme.md index a325b58d..3aa61882 100644 --- a/packages/remark-lint-maximum-line-length/readme.md +++ b/packages/remark-lint-maximum-line-length/readme.md @@ -183,14 +183,17 @@ remark -u lint -u lint-maximum-line-length readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintMaximumLineLength from 'remark-lint-maximum-line-length' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-maximum-line-length')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintMaximumLineLength) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-auto-link-without-protocol/readme.md b/packages/remark-lint-no-auto-link-without-protocol/readme.md index 204e82ad..55d9ed4d 100644 --- a/packages/remark-lint-no-auto-link-without-protocol/readme.md +++ b/packages/remark-lint-no-auto-link-without-protocol/readme.md @@ -97,14 +97,17 @@ remark -u lint -u lint-no-auto-link-without-protocol readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoAutoLinkWithoutProtocol from 'remark-lint-no-auto-link-without-protocol' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-auto-link-without-protocol')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoAutoLinkWithoutProtocol) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-blockquote-without-marker/readme.md b/packages/remark-lint-no-blockquote-without-marker/readme.md index d5a9f236..08fe4350 100644 --- a/packages/remark-lint-no-blockquote-without-marker/readme.md +++ b/packages/remark-lint-no-blockquote-without-marker/readme.md @@ -131,14 +131,17 @@ remark -u lint -u lint-no-blockquote-without-marker readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoBlockquoteWithoutMarker from 'remark-lint-no-blockquote-without-marker' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-blockquote-without-marker')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoBlockquoteWithoutMarker) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-consecutive-blank-lines/readme.md b/packages/remark-lint-no-consecutive-blank-lines/readme.md index fa46f671..fc84c359 100644 --- a/packages/remark-lint-no-consecutive-blank-lines/readme.md +++ b/packages/remark-lint-no-consecutive-blank-lines/readme.md @@ -111,14 +111,17 @@ remark -u lint -u lint-no-consecutive-blank-lines readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoConsecutiveBlankLines from 'remark-lint-no-consecutive-blank-lines' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-consecutive-blank-lines')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoConsecutiveBlankLines) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-duplicate-defined-urls/readme.md b/packages/remark-lint-no-duplicate-defined-urls/readme.md index a4a28228..36dc1d1d 100644 --- a/packages/remark-lint-no-duplicate-defined-urls/readme.md +++ b/packages/remark-lint-no-duplicate-defined-urls/readme.md @@ -80,14 +80,17 @@ remark -u lint -u lint-no-duplicate-defined-urls readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoDuplicateDefinedUrls from 'remark-lint-no-duplicate-defined-urls' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-duplicate-defined-urls')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoDuplicateDefinedUrls) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-duplicate-definitions/readme.md b/packages/remark-lint-no-duplicate-definitions/readme.md index 00aeda8f..f33cc67b 100644 --- a/packages/remark-lint-no-duplicate-definitions/readme.md +++ b/packages/remark-lint-no-duplicate-definitions/readme.md @@ -84,14 +84,17 @@ remark -u lint -u lint-no-duplicate-definitions readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoDuplicateDefinitions from 'remark-lint-no-duplicate-definitions' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-duplicate-definitions')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoDuplicateDefinitions) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-duplicate-headings-in-section/readme.md b/packages/remark-lint-no-duplicate-headings-in-section/readme.md index d616b17d..a8af562c 100644 --- a/packages/remark-lint-no-duplicate-headings-in-section/readme.md +++ b/packages/remark-lint-no-duplicate-headings-in-section/readme.md @@ -119,14 +119,17 @@ remark -u lint -u lint-no-duplicate-headings-in-section readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoDuplicateHeadingsInSection from 'remark-lint-no-duplicate-headings-in-section' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-duplicate-headings-in-section')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoDuplicateHeadingsInSection) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-duplicate-headings/readme.md b/packages/remark-lint-no-duplicate-headings/readme.md index c99a148e..27587619 100644 --- a/packages/remark-lint-no-duplicate-headings/readme.md +++ b/packages/remark-lint-no-duplicate-headings/readme.md @@ -89,14 +89,17 @@ remark -u lint -u lint-no-duplicate-headings readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoDuplicateHeadings from 'remark-lint-no-duplicate-headings' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-duplicate-headings')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoDuplicateHeadings) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-emphasis-as-heading/readme.md b/packages/remark-lint-no-emphasis-as-heading/readme.md index e7d531cf..46f4c52f 100644 --- a/packages/remark-lint-no-emphasis-as-heading/readme.md +++ b/packages/remark-lint-no-emphasis-as-heading/readme.md @@ -92,14 +92,17 @@ remark -u lint -u lint-no-emphasis-as-heading readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoEmphasisAsHeading from 'remark-lint-no-emphasis-as-heading' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-emphasis-as-heading')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoEmphasisAsHeading) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-empty-url/readme.md b/packages/remark-lint-no-empty-url/readme.md index 8881c8dd..6eee767a 100644 --- a/packages/remark-lint-no-empty-url/readme.md +++ b/packages/remark-lint-no-empty-url/readme.md @@ -83,14 +83,17 @@ remark -u lint -u lint-no-empty-url readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoEmptyUrl from 'remark-lint-no-empty-url' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-empty-url')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoEmptyUrl) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-file-name-articles/readme.md b/packages/remark-lint-no-file-name-articles/readme.md index a04a339f..f0945e19 100644 --- a/packages/remark-lint-no-file-name-articles/readme.md +++ b/packages/remark-lint-no-file-name-articles/readme.md @@ -94,14 +94,17 @@ remark -u lint -u lint-no-file-name-articles readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoFileNameArticles from 'remark-lint-no-file-name-articles' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-file-name-articles')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoFileNameArticles) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-file-name-consecutive-dashes/readme.md b/packages/remark-lint-no-file-name-consecutive-dashes/readme.md index 84acb998..fa2277dc 100644 --- a/packages/remark-lint-no-file-name-consecutive-dashes/readme.md +++ b/packages/remark-lint-no-file-name-consecutive-dashes/readme.md @@ -70,14 +70,17 @@ remark -u lint -u lint-no-file-name-consecutive-dashes readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoFileNameConsecutiveDashes from 'remark-lint-no-file-name-consecutive-dashes' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-file-name-consecutive-dashes')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoFileNameConsecutiveDashes) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-file-name-irregular-characters/readme.md b/packages/remark-lint-no-file-name-irregular-characters/readme.md index a427ac54..704505c8 100644 --- a/packages/remark-lint-no-file-name-irregular-characters/readme.md +++ b/packages/remark-lint-no-file-name-irregular-characters/readme.md @@ -103,14 +103,17 @@ remark -u lint -u lint-no-file-name-irregular-characters readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoFileNameIrregularCharacters from 'remark-lint-no-file-name-irregular-characters' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-file-name-irregular-characters')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoFileNameIrregularCharacters) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-file-name-mixed-case/readme.md b/packages/remark-lint-no-file-name-mixed-case/readme.md index a86fdbac..66114921 100644 --- a/packages/remark-lint-no-file-name-mixed-case/readme.md +++ b/packages/remark-lint-no-file-name-mixed-case/readme.md @@ -76,14 +76,17 @@ remark -u lint -u lint-no-file-name-mixed-case readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoFileNameMixedCase from 'remark-lint-no-file-name-mixed-case' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-file-name-mixed-case')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoFileNameMixedCase) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-file-name-outer-dashes/readme.md b/packages/remark-lint-no-file-name-outer-dashes/readme.md index 2803ae03..532b68cc 100644 --- a/packages/remark-lint-no-file-name-outer-dashes/readme.md +++ b/packages/remark-lint-no-file-name-outer-dashes/readme.md @@ -78,14 +78,17 @@ remark -u lint -u lint-no-file-name-outer-dashes readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoFileNameOuterDashes from 'remark-lint-no-file-name-outer-dashes' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-file-name-outer-dashes')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoFileNameOuterDashes) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-heading-content-indent/readme.md b/packages/remark-lint-no-heading-content-indent/readme.md index 9629180f..c4803c4b 100644 --- a/packages/remark-lint-no-heading-content-indent/readme.md +++ b/packages/remark-lint-no-heading-content-indent/readme.md @@ -123,14 +123,17 @@ remark -u lint -u lint-no-heading-content-indent readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoHeadingContentIndent from 'remark-lint-no-heading-content-indent' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-heading-content-indent')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoHeadingContentIndent) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-heading-indent/readme.md b/packages/remark-lint-no-heading-indent/readme.md index 8c804850..b345f173 100644 --- a/packages/remark-lint-no-heading-indent/readme.md +++ b/packages/remark-lint-no-heading-indent/readme.md @@ -109,14 +109,17 @@ remark -u lint -u lint-no-heading-indent readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoHeadingIndent from 'remark-lint-no-heading-indent' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-heading-indent')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoHeadingIndent) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-heading-like-paragraph/readme.md b/packages/remark-lint-no-heading-like-paragraph/readme.md index 78976773..ad66e130 100644 --- a/packages/remark-lint-no-heading-like-paragraph/readme.md +++ b/packages/remark-lint-no-heading-like-paragraph/readme.md @@ -82,14 +82,17 @@ remark -u lint -u lint-no-heading-like-paragraph readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoHeadingLikeParagraph from 'remark-lint-no-heading-like-paragraph' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-heading-like-paragraph')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoHeadingLikeParagraph) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-heading-punctuation/readme.md b/packages/remark-lint-no-heading-punctuation/readme.md index 399a3bcd..b7bbe47d 100644 --- a/packages/remark-lint-no-heading-punctuation/readme.md +++ b/packages/remark-lint-no-heading-punctuation/readme.md @@ -113,14 +113,17 @@ remark -u lint -u lint-no-heading-punctuation readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoHeadingPunctuation from 'remark-lint-no-heading-punctuation' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-heading-punctuation')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoHeadingPunctuation) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-html/readme.md b/packages/remark-lint-no-html/readme.md index f09c1cec..e6d293ab 100644 --- a/packages/remark-lint-no-html/readme.md +++ b/packages/remark-lint-no-html/readme.md @@ -83,14 +83,17 @@ remark -u lint -u lint-no-html readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoHtml from 'remark-lint-no-html' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-html')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoHtml) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-inline-padding/readme.md b/packages/remark-lint-no-inline-padding/readme.md index b2620feb..585a0851 100644 --- a/packages/remark-lint-no-inline-padding/readme.md +++ b/packages/remark-lint-no-inline-padding/readme.md @@ -86,14 +86,17 @@ remark -u lint -u lint-no-inline-padding readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoInlinePadding from 'remark-lint-no-inline-padding' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-inline-padding')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoInlinePadding) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-literal-urls/readme.md b/packages/remark-lint-no-literal-urls/readme.md index 574a86a6..9b8595a9 100644 --- a/packages/remark-lint-no-literal-urls/readme.md +++ b/packages/remark-lint-no-literal-urls/readme.md @@ -97,14 +97,17 @@ remark -u lint -u lint-no-literal-urls readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoLiteralUrls from 'remark-lint-no-literal-urls' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-literal-urls')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoLiteralUrls) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-missing-blank-lines/readme.md b/packages/remark-lint-no-missing-blank-lines/readme.md index 8db0f426..d21d389b 100644 --- a/packages/remark-lint-no-missing-blank-lines/readme.md +++ b/packages/remark-lint-no-missing-blank-lines/readme.md @@ -130,14 +130,17 @@ remark -u lint -u lint-no-missing-blank-lines readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoMissingBlankLines from 'remark-lint-no-missing-blank-lines' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-missing-blank-lines')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoMissingBlankLines) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-multiple-toplevel-headings/readme.md b/packages/remark-lint-no-multiple-toplevel-headings/readme.md index 877398af..fe5ae55f 100644 --- a/packages/remark-lint-no-multiple-toplevel-headings/readme.md +++ b/packages/remark-lint-no-multiple-toplevel-headings/readme.md @@ -92,14 +92,17 @@ remark -u lint -u lint-no-multiple-toplevel-headings readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoMultipleToplevelHeadings from 'remark-lint-no-multiple-toplevel-headings' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-multiple-toplevel-headings')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoMultipleToplevelHeadings) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-paragraph-content-indent/readme.md b/packages/remark-lint-no-paragraph-content-indent/readme.md index 9aa133ae..51815ec9 100644 --- a/packages/remark-lint-no-paragraph-content-indent/readme.md +++ b/packages/remark-lint-no-paragraph-content-indent/readme.md @@ -132,14 +132,17 @@ remark -u lint -u lint-no-paragraph-content-indent readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoParagraphContentIndent from 'remark-lint-no-paragraph-content-indent' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-paragraph-content-indent')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoParagraphContentIndent) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-reference-like-url/readme.md b/packages/remark-lint-no-reference-like-url/readme.md index 373b5ee5..571d67bc 100644 --- a/packages/remark-lint-no-reference-like-url/readme.md +++ b/packages/remark-lint-no-reference-like-url/readme.md @@ -82,14 +82,17 @@ remark -u lint -u lint-no-reference-like-url readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoReferenceLikeUrl from 'remark-lint-no-reference-like-url' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-reference-like-url')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoReferenceLikeUrl) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-shell-dollars/readme.md b/packages/remark-lint-no-shell-dollars/readme.md index d6acbea9..abc69ea6 100644 --- a/packages/remark-lint-no-shell-dollars/readme.md +++ b/packages/remark-lint-no-shell-dollars/readme.md @@ -116,14 +116,17 @@ remark -u lint -u lint-no-shell-dollars readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoShellDollars from 'remark-lint-no-shell-dollars' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-shell-dollars')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoShellDollars) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-shortcut-reference-image/readme.md b/packages/remark-lint-no-shortcut-reference-image/readme.md index e89d6012..2927ec85 100644 --- a/packages/remark-lint-no-shortcut-reference-image/readme.md +++ b/packages/remark-lint-no-shortcut-reference-image/readme.md @@ -93,14 +93,17 @@ remark -u lint -u lint-no-shortcut-reference-image readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoShortcutReferenceImage from 'remark-lint-no-shortcut-reference-image' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-shortcut-reference-image')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoShortcutReferenceImage) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-shortcut-reference-link/readme.md b/packages/remark-lint-no-shortcut-reference-link/readme.md index 3d9e8199..b6afc94d 100644 --- a/packages/remark-lint-no-shortcut-reference-link/readme.md +++ b/packages/remark-lint-no-shortcut-reference-link/readme.md @@ -93,14 +93,17 @@ remark -u lint -u lint-no-shortcut-reference-link readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoShortcutReferenceLink from 'remark-lint-no-shortcut-reference-link' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-shortcut-reference-link')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoShortcutReferenceLink) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-table-indentation/readme.md b/packages/remark-lint-no-table-indentation/readme.md index dfec1ba6..88537e7a 100644 --- a/packages/remark-lint-no-table-indentation/readme.md +++ b/packages/remark-lint-no-table-indentation/readme.md @@ -146,14 +146,17 @@ remark -u lint -u lint-no-table-indentation readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoTableIndentation from 'remark-lint-no-table-indentation' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-table-indentation')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoTableIndentation) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-tabs/readme.md b/packages/remark-lint-no-tabs/readme.md index 726f11f4..13170e37 100644 --- a/packages/remark-lint-no-tabs/readme.md +++ b/packages/remark-lint-no-tabs/readme.md @@ -113,14 +113,17 @@ remark -u lint -u lint-no-tabs readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoTabs from 'remark-lint-no-tabs' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-tabs')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoTabs) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-undefined-references/readme.md b/packages/remark-lint-no-undefined-references/readme.md index a9c5554c..e181cb11 100644 --- a/packages/remark-lint-no-undefined-references/readme.md +++ b/packages/remark-lint-no-undefined-references/readme.md @@ -135,14 +135,17 @@ remark -u lint -u lint-no-undefined-references readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoUndefinedReferences from 'remark-lint-no-undefined-references' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-undefined-references')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoUndefinedReferences) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-unneeded-full-reference-image/readme.md b/packages/remark-lint-no-unneeded-full-reference-image/readme.md index f9ccb2de..bd810cab 100644 --- a/packages/remark-lint-no-unneeded-full-reference-image/readme.md +++ b/packages/remark-lint-no-unneeded-full-reference-image/readme.md @@ -96,14 +96,17 @@ remark -u lint -u lint-no-unneeded-full-reference-image readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoUnneededFullReferenceImage from 'remark-lint-no-unneeded-full-reference-image' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-unneeded-full-reference-image')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoUnneededFullReferenceImage) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-unneeded-full-reference-link/readme.md b/packages/remark-lint-no-unneeded-full-reference-link/readme.md index 161fc810..e888f1e7 100644 --- a/packages/remark-lint-no-unneeded-full-reference-link/readme.md +++ b/packages/remark-lint-no-unneeded-full-reference-link/readme.md @@ -102,14 +102,17 @@ remark -u lint -u lint-no-unneeded-full-reference-link readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoUnneededFullReferenceLink from 'remark-lint-no-unneeded-full-reference-link' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-unneeded-full-reference-link')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoUnneededFullReferenceLink) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-no-unused-definitions/readme.md b/packages/remark-lint-no-unused-definitions/readme.md index 19b293a8..5b5f9a8c 100644 --- a/packages/remark-lint-no-unused-definitions/readme.md +++ b/packages/remark-lint-no-unused-definitions/readme.md @@ -84,14 +84,17 @@ remark -u lint -u lint-no-unused-definitions readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintNoUnusedDefinitions from 'remark-lint-no-unused-definitions' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-no-unused-definitions')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintNoUnusedDefinitions) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-ordered-list-marker-style/readme.md b/packages/remark-lint-ordered-list-marker-style/readme.md index f2e8445f..355c7281 100644 --- a/packages/remark-lint-ordered-list-marker-style/readme.md +++ b/packages/remark-lint-ordered-list-marker-style/readme.md @@ -140,14 +140,17 @@ remark -u lint -u lint-ordered-list-marker-style readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintOrderedListMarkerStyle from 'remark-lint-ordered-list-marker-style' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-ordered-list-marker-style')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintOrderedListMarkerStyle) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-ordered-list-marker-value/readme.md b/packages/remark-lint-ordered-list-marker-value/readme.md index c0762925..d76e03f5 100644 --- a/packages/remark-lint-ordered-list-marker-value/readme.md +++ b/packages/remark-lint-ordered-list-marker-value/readme.md @@ -243,14 +243,17 @@ remark -u lint -u lint-ordered-list-marker-value readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintOrderedListMarkerValue from 'remark-lint-ordered-list-marker-value' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-ordered-list-marker-value')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintOrderedListMarkerValue) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-rule-style/readme.md b/packages/remark-lint-rule-style/readme.md index f7603845..43a37599 100644 --- a/packages/remark-lint-rule-style/readme.md +++ b/packages/remark-lint-rule-style/readme.md @@ -137,14 +137,17 @@ remark -u lint -u lint-rule-style readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintRuleStyle from 'remark-lint-rule-style' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-rule-style')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintRuleStyle) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-strikethrough-marker/readme.md b/packages/remark-lint-strikethrough-marker/readme.md index eb2bca57..ea2aa9a4 100644 --- a/packages/remark-lint-strikethrough-marker/readme.md +++ b/packages/remark-lint-strikethrough-marker/readme.md @@ -157,14 +157,17 @@ remark -u lint -u lint-strikethrough-marker readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintStrikethroughMarker from 'remark-lint-strikethrough-marker' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-strikethrough-marker')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintStrikethroughMarker) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-strong-marker/readme.md b/packages/remark-lint-strong-marker/readme.md index 8b2143f7..52abcbb4 100644 --- a/packages/remark-lint-strong-marker/readme.md +++ b/packages/remark-lint-strong-marker/readme.md @@ -149,14 +149,17 @@ remark -u lint -u lint-strong-marker readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintStrongMarker from 'remark-lint-strong-marker' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-strong-marker')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintStrongMarker) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-table-cell-padding/readme.md b/packages/remark-lint-table-cell-padding/readme.md index d4bea4bd..af3d3c0d 100644 --- a/packages/remark-lint-table-cell-padding/readme.md +++ b/packages/remark-lint-table-cell-padding/readme.md @@ -320,14 +320,17 @@ remark -u lint -u lint-table-cell-padding readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintTableCellPadding from 'remark-lint-table-cell-padding' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-table-cell-padding')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintTableCellPadding) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-table-pipe-alignment/readme.md b/packages/remark-lint-table-pipe-alignment/readme.md index 61ac9220..08b9764b 100644 --- a/packages/remark-lint-table-pipe-alignment/readme.md +++ b/packages/remark-lint-table-pipe-alignment/readme.md @@ -110,14 +110,17 @@ remark -u lint -u lint-table-pipe-alignment readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintTablePipeAlignment from 'remark-lint-table-pipe-alignment' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-table-pipe-alignment')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintTablePipeAlignment) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-table-pipes/readme.md b/packages/remark-lint-table-pipes/readme.md index 41adc98f..6eb1e8f6 100644 --- a/packages/remark-lint-table-pipes/readme.md +++ b/packages/remark-lint-table-pipes/readme.md @@ -104,14 +104,17 @@ remark -u lint -u lint-table-pipes readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintTablePipes from 'remark-lint-table-pipes' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-table-pipes')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintTablePipes) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint-unordered-list-marker-style/readme.md b/packages/remark-lint-unordered-list-marker-style/readme.md index 4cacf7e7..92cd0c6b 100644 --- a/packages/remark-lint-unordered-list-marker-style/readme.md +++ b/packages/remark-lint-unordered-list-marker-style/readme.md @@ -165,14 +165,17 @@ remark -u lint -u lint-unordered-list-marker-style readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remark-lint' + import remarkLintUnorderedListMarkerStyle from 'remark-lint-unordered-list-marker-style' remark() - .use(require('remark-lint')) -+ .use(require('remark-lint-unordered-list-marker-style')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) + .use(remarkLint) ++ .use(remarkLintUnorderedListMarkerStyle) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-lint/readme.md b/packages/remark-lint/readme.md index 2792e010..6f98519d 100644 --- a/packages/remark-lint/readme.md +++ b/packages/remark-lint/readme.md @@ -20,6 +20,9 @@ If you’re using just plugins, you have to include `remark-lint` explicitly. ## Install +This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c): +Node 12+ is needed to use it and it must be `import`ed instead of `require`d. + [npm][]: ```sh @@ -51,14 +54,16 @@ remark -u lint readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkLint from 'remarkLint' remark() -+ .use(require('remark-lint')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) - }); ++ .use(remarkLint) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) + }) ``` ## Contribute diff --git a/packages/remark-preset-lint-consistent/readme.md b/packages/remark-preset-lint-consistent/readme.md index e9f0f7a3..ca844d90 100644 --- a/packages/remark-preset-lint-consistent/readme.md +++ b/packages/remark-preset-lint-consistent/readme.md @@ -61,13 +61,15 @@ remark -u preset-lint-consistent readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkPresetLintConsistent from 'remark-preset-lint-consistent' remark() -+ .use(require('remark-preset-lint-consistent')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) ++ .use(remarkPresetLintConsistent) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-preset-lint-markdown-style-guide/readme.md b/packages/remark-preset-lint-markdown-style-guide/readme.md index fe8f41f5..d9ebe6da 100644 --- a/packages/remark-preset-lint-markdown-style-guide/readme.md +++ b/packages/remark-preset-lint-markdown-style-guide/readme.md @@ -185,13 +185,15 @@ remark -u preset-lint-markdown-style-guide readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkPresetLintMarkdownStyleGuide from 'remark-preset-lint-markdown-style-guide' remark() -+ .use(require('remark-preset-lint-markdown-style-guide')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) ++ .use(remarkPresetLintMarkdownStyleGuide) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/remark-preset-lint-recommended/readme.md b/packages/remark-preset-lint-recommended/readme.md index 2911839d..2e76c0ff 100644 --- a/packages/remark-preset-lint-recommended/readme.md +++ b/packages/remark-preset-lint-recommended/readme.md @@ -64,13 +64,15 @@ remark -u preset-lint-recommended readme.md Or use this on the API: ```diff - var remark = require('remark') - var report = require('vfile-reporter') + import {remark} from 'remark' + import {reporter} from 'vfile-reporter' + import remarkPresetLintRecommended from 'remark-preset-lint-recommended' remark() -+ .use(require('remark-preset-lint-recommended')) - .process('_Emphasis_ and **importance**', function (err, file) { - console.error(report(err || file)) ++ .use(remarkPresetLintRecommended) + .process('_Emphasis_ and **importance**') + .then((file) => { + console.error(reporter(file)) }) ``` diff --git a/packages/unified-lint-rule/readme.md b/packages/unified-lint-rule/readme.md index f662af8b..9d02ed06 100644 --- a/packages/unified-lint-rule/readme.md +++ b/packages/unified-lint-rule/readme.md @@ -14,6 +14,9 @@ Each rule in [`remark-lint`][lint] uses this project, so see that for examples! ## Install +This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c): +Node 12+ is needed to use it and it must be `import`ed instead of `require`d. + [npm][]: ```sh @@ -23,20 +26,21 @@ npm install unified-lint-rule ## Use ```js -import unifiedLintRule from 'unified-lint-rule' - -const remarkLintFileExtension = lintRule('remark-lint:file-extension', fileExtension) - -export default remarkLintFileExtension +import {lintRule} from 'unified-lint-rule' -function fileExtension(tree, file, option) { - var ext = file.extname - var preferred = typeof option === 'string' ? option : 'md' +const remarkLintFileExtension = lintRule( + 'remark-lint:file-extension', + (tree, file, option) => { + var ext = file.extname + var preferred = typeof option === 'string' ? option : 'md' - if (ext && ext.slice(1) !== preferred) { - file.message('Incorrect extension: use `' + preferred + '`') + if (ext && ext.slice(1) !== preferred) { + file.message('Incorrect extension: use `' + preferred + '`') + } } -} +) + +export default remarkLintFileExtension ``` ## Contribute diff --git a/readme.md b/readme.md index 22056602..9870ec93 100644 --- a/readme.md +++ b/readme.md @@ -38,6 +38,9 @@ powered by [plugins][remark-plugins] (such as these). ## Install +This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c): +Node 12+ is needed to use it and it must be `import`ed instead of `require`d. + [npm][]: ```sh @@ -100,13 +103,15 @@ npm install remark remark-preset-lint-markdown-style-guide Let’s say `example.js` looks as follows: ```js -var report = require('vfile-reporter') -var remark = require('remark') -var styleGuide = require('remark-preset-lint-markdown-style-guide') +import {remark} from 'remark' +import {reporter} from 'vfile-reporter' +import remarkPresetLintMarkdownStyleGuide from 'remark-preset-lint-markdown-style-guide' -var file = remark().use(styleGuide).processSync('_Hello world_') +const file = remark() + .use(remarkPresetLintMarkdownStyleGuide) + .processSync('_Hello world_') -console.log(report(file)) +console.log(reporter(file)) ``` Now, running `node example.js` yields: @@ -196,28 +201,29 @@ It ensures a single style is used: list items use one type of bullet (`*`, `-`, ###### Example -If you `require('remark')`, [`remark-stringify`][remark-stringify] is included +If you `import('remark')`, [`remark-stringify`][remark-stringify] is included unless an output format other than markdown (such as HTML) is defined. Say we have the following file, `example.js`, showing how formatting rules can be used: ```js -var report = require('vfile-reporter') -var remark = require('remark') -var emphasisMarker = require('remark-lint-emphasis-marker') -var strongMarker = require('remark-lint-strong-marker') +import {reporter} from 'vfile-reporter' +import {remark} from 'remark' +import remarkLintEmphasisMarker from 'remark-lint-emphasis-marker' +import remarkLintStrongMarker from 'remark-lint-strong-marker' remark() - .use(emphasisMarker, '*') - .use(strongMarker, '*') + .use(remarkLintEmphasisMarker, '*') + .use(remarkLintStrongMarker, '*') // ^ two `remark-lint` rules. .use({ settings: {emphasis: '*', strong: '*'} // ^ `remark-stringify` settings. }) - .process('_Hello_, __world__!', function (err, file) { - console.error(report(err || file)) + .process('_Hello_, __world__!') + .then((file) => { + console.error(reporter(file)) console.log(String(file)) }) ``` @@ -238,22 +244,23 @@ If you’re using [`remark-stringify`][remark-stringify] explicitly, you can pas options like any other plugin, like so: ```js -var report = require('vfile-reporter') -var unified = require('unified') -var parse = require('remark-parse') -var stringify = require('remark-stringify') -var emphasisMarker = require('remark-lint-emphasis-marker') -var strongMarker = require('remark-lint-strong-marker') +import {reporter} from 'vfile-reporter' +import {unified} from 'unified' +import remarkParse from 'remark-parse' +import remarkStringify from 'remark-stringify' +import remarkLintEmphasisMarker from 'remark-lint-emphasis-marker' +import remarkLintStrongMarker from 'remark-lint-strong-marker' unified() - .use(parse) - .use(emphasisMarker, '*') - .use(strongMarker, '*') + .use(remarkParse) + .use(remarkLintEmphasisMarker, '*') + .use(remarkLintStrongMarker, '*') // ^ two `remark-lint` rules. - .use(stringify, {emphasis: '*', strong: '*'}) + .use(remarkStringify, {emphasis: '*', strong: '*'}) // ^ `remark-stringify` with settings. - .process('_Hello_, __world__!', function (err, file) { - console.error(report(err || file)) + .process('_Hello_, __world__!') + .then((file) => { + console.error(reporter(file)) console.log(String(file)) }) ``` diff --git a/script/build-presets.js b/script/build-presets.js index 56e121eb..5be05667 100644 --- a/script/build-presets.js +++ b/script/build-presets.js @@ -27,6 +27,7 @@ presetObjects.forEach(function ({name, packages}) { var rows = [] var children var short = name.replace(/^remark-/, '') + var camelcased = name.replace(/-(\w)/g, (_, $1) => $1.toUpperCase()) var org = remote.split('/').slice(0, -1).join('/') var main = remote + '/blob/main' var health = org + '/.github' @@ -143,13 +144,15 @@ presetObjects.forEach(function ({name, packages}) { 'code', {lang: 'diff'}, [ - " var remark = require('remark')", - " var report = require('vfile-reporter')", + " import {remark} from 'remark'", + " import {reporter} from 'vfile-reporter'", + ' import ' + camelcased + " from '" + name + "'", '', ' remark()', - "+ .use(require('" + name + "'))", - " .process('_Emphasis_ and **importance**', function (err, file) {", - ' console.error(report(err || file))', + '+ .use(' + camelcased + ')', + " .process('_Emphasis_ and **importance**')", + ' .then((file) => {', + ' console.error(reporter(file))', ' })' ].join('\n') ), diff --git a/script/build-rules.js b/script/build-rules.js index e16e60cd..131d2112 100644 --- a/script/build-rules.js +++ b/script/build-rules.js @@ -23,6 +23,7 @@ rules(root).forEach(function (basename) { var tests = info.tests var author = parseAuthor(pack.author) var short = basename.replace(/^remark-/, '') + var camelcased = basename.replace(/-(\w)/g, (_, $1) => $1.toUpperCase()) var org = remote.split('/').slice(0, -1).join('/') var main = remote + '/blob/main' var health = org + '/.github' @@ -223,14 +224,17 @@ rules(root).forEach(function (basename) { 'code', {lang: 'diff'}, [ - " var remark = require('remark')", - " var report = require('vfile-reporter')", + " import {remark} from 'remark'", + " import {reporter} from 'vfile-reporter'", + " import remarkLint from 'remark-lint'", + ' import ' + camelcased + " from '" + basename + "'", '', ' remark()', - " .use(require('remark-lint'))", - "+ .use(require('" + basename + "'))", - " .process('_Emphasis_ and **importance**', function (err, file) {", - ' console.error(report(err || file))', + ' .use(remarkLint)', + '+ .use(' + camelcased + ')', + " .process('_Emphasis_ and **importance**')", + ' .then((file) => {', + ' console.error(reporter(file))', ' })' ].join('\n') ),