From e1f3de00d3be84eb83dd58ca1c9f7b724332ca0e Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 20 Oct 2021 15:49:29 +0200 Subject: [PATCH] Update dependencies --- cli.js | 53 +++++++++++++++++++++++++++------------------------- index.js | 8 +++++--- package.json | 37 ++++++++++++++++++------------------ readme.md | 10 +++++----- 4 files changed, 57 insertions(+), 51 deletions(-) diff --git a/cli.js b/cli.js index 101cad0..f0fe845 100755 --- a/cli.js +++ b/cli.js @@ -3,19 +3,20 @@ import fs from 'fs' import notifier from 'update-notifier' import supportsColor from 'supports-color' import meow from 'meow' -import engine from 'unified-engine' -import unified from 'unified' -import markdown from 'remark-parse' -import html from 'rehype-parse' -import frontmatter from 'remark-frontmatter' -import mdx from 'remark-mdx' -import english from 'retext-english' -import remark2retext from 'remark-retext' -import rehype2retext from 'rehype-retext' -import defaultReporter from 'vfile-reporter' -import equality from 'retext-equality' -import profanities from 'retext-profanities' -import diff from 'unified-diff' +import {engine} from 'unified-engine' +import {unified} from 'unified' +import rehypeParse from 'rehype-parse' +import remarkParse from 'remark-parse' +import remarkFrontmatter from 'remark-frontmatter' +import remarkGfm from 'remark-gfm' +import remarkMdx from 'remark-mdx' +import retextEnglish from 'retext-english' +import remarkRetext from 'remark-retext' +import rehypeRetext from 'rehype-retext' +import vfileReporter from 'vfile-reporter' +import retextEquality from 'retext-equality' +import retextProfanities from 'retext-profanities' +import unifiedDiff from 'unified-diff' import {filter} from './filter.js' const pack = JSON.parse( @@ -63,6 +64,7 @@ var cli = meow( ' $ alex' ].join('\n'), { + importMeta: import.meta, flags: { version: {type: 'boolean', alias: 'v'}, help: {type: 'boolean', alias: 'h'}, @@ -110,7 +112,7 @@ engine( rcName: '.alexrc', packageField: 'alex', color: supportsColor.stderr, - reporter: cli.flags.reporter || defaultReporter, + reporter: cli.flags.reporter || vfileReporter, reporterOptions: { verbose: cli.flags.why }, @@ -129,24 +131,25 @@ engine( function transform(options) { var settings = options || {} var plugins = [ - english, - [profanities, {sureness: settings.profanitySureness}], - [equality, {noBinary: settings.noBinary}] + retextEnglish, + [retextProfanities, {sureness: settings.profanitySureness}], + [retextEquality, {noBinary: settings.noBinary}] ] if (cli.flags.html) { - plugins = [html, [rehype2retext, unified().use({plugins: plugins})]] + plugins = [rehypeParse, [rehypeRetext, unified().use({plugins: plugins})]] } else if (cli.flags.mdx) { plugins = [ - markdown, - mdx, - [remark2retext, unified().use({plugins: plugins})] + remarkParse, + remarkMdx, + [remarkRetext, unified().use({plugins: plugins})] ] } else if (!cli.flags.text) { plugins = [ - markdown, - [frontmatter, ['yaml', 'toml']], - [remark2retext, unified().use({plugins: plugins})] + remarkParse, + remarkGfm, + [remarkFrontmatter, ['yaml', 'toml']], + [remarkRetext, unified().use({plugins: plugins})] ] } @@ -155,7 +158,7 @@ function transform(options) { // Hard to check. /* c8 ignore next 3 */ if (cli.flags.diff) { - plugins.push(diff) + plugins.push(unifiedDiff) } return {plugins: plugins} diff --git a/index.js b/index.js index a3b5a82..db7f4d8 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ -import VFile from 'vfile' -import unified from 'unified' +import {VFile} from 'vfile' +import {unified} from 'unified' import remarkParse from 'remark-parse' +import remarkGfm from 'remark-gfm' import remarkFrontmatter from 'remark-frontmatter' import remarkMdx from 'remark-mdx' import rehypeParse from 'rehype-parse' @@ -9,7 +10,7 @@ import retextEquality from 'retext-equality' import retextProfanities from 'retext-profanities' import remarkRetext from 'remark-retext' import rehypeRetext from 'rehype-retext' -import sort from 'vfile-sort' +import {sort} from 'vfile-sort' import {filter} from './filter.js' function makeText(config) { @@ -54,6 +55,7 @@ export function markdown(value, config) { config, unified() .use(remarkParse) + .use(remarkGfm) .use(remarkFrontmatter, ['yaml', 'toml']) .use(remarkRetext, makeText(config)) ) diff --git a/package.json b/package.json index 26fa91a..fbc3461 100644 --- a/package.json +++ b/package.json @@ -64,24 +64,25 @@ "cli.js" ], "dependencies": { - "meow": "^7.0.0", - "rehype-parse": "^7.0.0", - "rehype-retext": "^2.0.1", - "remark-frontmatter": "^2.0.0", - "remark-mdx": "2.0.0-next.7", - "remark-message-control": "^6.0.0", - "remark-parse": "^8.0.0", - "remark-retext": "^4.0.0", - "retext-english": "^3.0.0", - "retext-equality": "~5.5.0", - "retext-profanities": "~6.1.0", - "unified": "^9.0.0", - "unified-diff": "^3.0.0", - "unified-engine": "^8.0.0", - "update-notifier": "^4.0.0", - "vfile": "^4.0.0", - "vfile-reporter": "^6.0.0", - "vfile-sort": "^2.0.0" + "meow": "^10.0.0", + "rehype-parse": "^8.0.0", + "rehype-retext": "^3.0.0", + "remark-frontmatter": "^4.0.0", + "remark-gfm": "^3.0.0", + "remark-mdx": "2.0.0-rc.1", + "remark-message-control": "^7.0.0", + "remark-parse": "^10.0.0", + "remark-retext": "^5.0.0", + "retext-english": "^4.0.0", + "retext-equality": "~6.3.0", + "retext-profanities": "~7.1.0", + "unified": "^10.0.0", + "unified-diff": "^4.0.0", + "unified-engine": "^9.0.0", + "update-notifier": "^5.0.0", + "vfile": "^5.0.0", + "vfile-reporter": "^7.0.0", + "vfile-sort": "^3.0.0" }, "devDependencies": { "c8": "^7.10.0", diff --git a/readme.md b/readme.md index b9cd7e9..f2012ee 100644 --- a/readme.md +++ b/readme.md @@ -264,11 +264,11 @@ We use [`cuss`][cuss], which has a dictionary of words that have a rating between 0 and 2 of how likely it is that a word or phrase is a profanity (not how “bad” it is): -| Rating | Use as a profanity | Use in clean text | Example | -| ------ | ------------------ | ----------------- | ------- | -| 2 | likely | unlikely | asshat | -| 1 | maybe | maybe | addict | -| 0 | unlikely | likely | beaver | +| Rating | Use as a profanity | Use in clean text | Example | +| ------ | ------------------ | ----------------- | -------- | +| 2 | likely | unlikely | `asshat` | +| 1 | maybe | maybe | `addict` | +| 0 | unlikely | likely | `beaver` | The `profanitySureness` field is the minimum rating (including) that you want to check for.