update(alex): v9 changes (#46989)

- MDX support added
- cleaner type imports
- tests amended
- version bump

https://github.com/get-alex/alex/compare/8.2.0...9.0.1

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz) 2020-08-27 05:47:14 +02:00 committed by GitHub
parent 7e4cb54a7d
commit 03f3cf9673
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 7 deletions

View File

@ -1,3 +1,5 @@
import alex = require('alex');
// configs
const exemption = ['word', 'noun'];
const deny = ['deny', 'word'];
@ -18,15 +20,22 @@ alex('Weve confirmed his identity.'); // $ExpectType VFile
alex('Weve confirmed his identity.', exemption); // $ExpectType VFile
alex('Weve confirmed his identity.', config); // $ExpectType VFile
alex('Weve confirmed his identity.', denyConfig); // $ExpectType VFile
alex.markdown('### Weve confirmed his **identity**.'); // $ExpectType VFile
alex.markdown('### Weve confirmed his **identity**.', exemption); // $ExpectType VFile
alex.markdown('### Weve confirmed his **identity**.', config); // $ExpectType VFile
alex.markdown('### Weve confirmed his **identity**.', denyConfig); // $ExpectType VFile
alex.html('<p class="black">He walked to class.</p>'); // $ExpectType VFile
alex.html('<p class="black">He walked to class.</p>', exemption); // $ExpectType VFile
alex.html('<p class="black">He walked to class.</p>', config); // $ExpectType VFile
alex.html('<p class="black">He walked to class.</p>', denyConfig); // $ExpectType VFile
alex.text('The `boogeyman`.'); // $ExpectType VFile
alex.text('The `boogeyman`.', exemption); // $ExpectType VFile
alex.text('The `boogeyman`.', config); // $ExpectType VFile
alex.text('The `boogeyman`.', denyConfig); // $ExpectType VFile
alex.mdx('The `boogeyman`.', denyConfig); // $ExpectType VFile
alex.mdx('<Component>He walked to class.</Component>'); // $ExpectType VFile
alex.mdx('<Component>He walked to class.</Component>', config); // $ExpectType VFile

20
types/alex/index.d.ts vendored
View File

@ -1,14 +1,14 @@
// Type definitions for alex 8.2
// Type definitions for alex 9.0
// Project: https://alexjs.com
// Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as vfile from 'vfile';
import { VFile } from 'vfile';
/**
* finds gender favoring, polarizing, race related, religion inconsiderate, or other unequal phrasing in text.
*/
declare function alex(value: vfile.VFile | string, config?: alex.Config): vfile.VFile;
declare function alex(value: VFile | string, config?: alex.Config): VFile;
declare namespace alex {
/**
@ -38,13 +38,21 @@ declare namespace alex {
}
/** Check Markdown (ignoring syntax). */
function markdown(value: vfile.VFile | string, config?: Config): vfile.VFile;
function markdown(value: VFile | string, config?: Config): VFile;
/** Check HTML (ignoring syntax). */
function html(value: vfile.VFile | string, config?: Config): vfile.VFile;
function html(value: VFile | string, config?: Config): VFile;
/** Check plain text (as in, syntax is checked). */
function text(value: vfile.VFile | string, config?: Config): vfile.VFile;
function text(value: VFile | string, config?: Config): VFile;
/**
* Check [MDX][] (ignoring syntax).
*
* Note: the syntax for [MDX@2][mdx-next], while currently in beta, is used in
* alex
*/
function mdx(value: VFile | string, config?: Config): VFile;
}
export as namespace alex;

View File

@ -1,6 +1,6 @@
{
"private": true,
"dependencies": {
"vfile": "^4.0.2"
"vfile": "^4.2.0"
}
}