-
-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
275 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
coverage/ | ||
node_modules/ | ||
.DS_Store | ||
*.d.ts | ||
*.log | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,35 @@ | ||
import remarkMessageControl from 'remark-message-control' | ||
/** | ||
* @typedef {import('mdast').Root} Root | ||
* | ||
* @typedef Options | ||
* Configuration. | ||
* @property {string[]} [deny] | ||
* The `deny` field should be an array of rules or `undefined` (the default is | ||
* `undefined`). | ||
* When provided, *only* the rules specified are reported. | ||
* You cannot use both `allow` and `deny` at the same time. | ||
* @property {string[]} [allow] | ||
* The `allow` field should be an array of rules or `undefined` (the default | ||
* is `undefined`). | ||
* When provided, the rules specified are skipped and not reported. | ||
* You cannot use both `allow` and `deny` at the same time. | ||
*/ | ||
|
||
export function filter(options) { | ||
/* c8 ignore next */ | ||
const settings = options || {} | ||
import remarkMessageControl from 'remark-message-control' | ||
|
||
if (settings.allow && settings.deny) { | ||
/** @type {import('unified').Plugin<[Options?]|[], Root>} */ | ||
export function filter(options = {}) { | ||
if (options.allow && options.deny) { | ||
throw new Error( | ||
'Do not provide both allow and deny configuration parameters' | ||
) | ||
} | ||
|
||
return remarkMessageControl({ | ||
name: 'alex', | ||
reset: Boolean(settings.deny), | ||
enable: settings.deny, | ||
disable: settings.allow, | ||
reset: Boolean(options.deny), | ||
enable: options.deny, | ||
disable: options.allow, | ||
source: ['retext-equality', 'retext-profanities'] | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.