Skip to content

Commit c046a2b

Browse files
tyler36azu
andauthored
Update to alex@11 (#25)
* bump alex * use dynamic imports * workflow uses supported node versions * update alex version * add textlint-scripts * add textlint-scripts to workflow * Update .github/workflows/test.yml Co-authored-by: azu <[email protected]> * Update `yarn.lock` * fix: use resolution --------- Co-authored-by: tyler36 <[email protected]> Co-authored-by: azu <[email protected]> Co-authored-by: azu <[email protected]>
1 parent 5ab886e commit c046a2b

File tree

4 files changed

+3276
-2953
lines changed

4 files changed

+3276
-2953
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
runs-on: ubuntu-latest
77
strategy:
88
matrix:
9-
node-version: [12, 14]
9+
node-version: [18, 20]
1010
steps:
1111
- name: checkout
1212
uses: actions/checkout@v3

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@
3232
"alex"
3333
],
3434
"devDependencies": {
35-
"textlint-scripts": "^12.1.1"
35+
"textlint-scripts": "^13.4.0"
3636
},
3737
"dependencies": {
38-
"alex": "^9.1.1",
38+
"alex": "^11.0.1",
3939
"textlint-rule-helper": "^2.3.0"
40+
},
41+
"resolutions": {
42+
"wrap-ansi": "^7.0.0"
4043
}
4144
}

src/textlint-rule-alex.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// LICENSE : MIT
22
"use strict";
33
import {RuleHelper} from "textlint-rule-helper";
4-
import alex from "alex";
4+
55
const defaultOptions = {
66
allow: undefined,
77
deny: undefined,
@@ -33,7 +33,9 @@ export default function textlintRuleAlex(context, options = {}) {
3333
report(node, ruleError);
3434
};
3535
return {
36-
[Syntax.Str](node){
36+
async [Syntax.Str](node){
37+
const alex = await import("alex").then(mod => mod.markdown); // markdown equals to default export https://github.com/get-alex/alex/blob/1b4c1be7991b30502cd56fb1d4769708df6853a5/index.js#L56
38+
3739
if (helper.isChildNode(node, [Syntax.Link, Syntax.Image, Syntax.BlockQuote, Syntax.Emphasis])) {
3840
return;
3941
}
@@ -44,4 +46,4 @@ export default function textlintRuleAlex(context, options = {}) {
4446
});
4547
}
4648
}
47-
}
49+
}

0 commit comments

Comments
 (0)