-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update alex version #17
Comments
I found a same issue in this repo. That issue was closed by ESM..? |
get-alex/alex#319 textlint does not support Pure ESM rule yet. Two options:
1's blocker is interop issue between CJS and ESM. 2 is just using Dynamic Import for alex@10. Node.js disallow to import ESM from CJS using import {RuleHelper} from "textlint-rule-helper";
- import alex from "alex";
const defaultOptions = {
allow: undefined,
deny: undefined,
noBinary: false,
profanitySureness: 0
};
export default function textlintRuleAlex(context, options = {}) {
const {Syntax, RuleError, report, getSource} = context;
const helper = new RuleHelper(context);
const opts = {...defaultOptions, ...options};
/*
{ [1:5-1:14: `boogeyman` may be insensitive, use `boogey` instead]
message: '`boogeyman` may be insensitive, use `boogey` instead',
name: '1:5-1:14',
file: '',
reason: '`boogeyman` may be insensitive, use `boogey` instead',
line: 1,
column: 5,
location: Position { start: [Object], end: [Object] },
fatal: false,
ruleId: 'boogeyman-boogeywoman',
source: 'retext-equality' }
*/
const reportError = (node, result) => {
const ruleError = new RuleError(`[${result.ruleId}] ${result.message}`, {
line: result.line - 1,
column: result.column - 1
});
report(node, ruleError);
};
return {
- [Syntax.Str](node){
+ async [Syntax.Str](node){
+ 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
if (helper.isChildNode(node, [Syntax.Link, Syntax.Image, Syntax.BlockQuote, Syntax.Emphasis])) {
return;
}
const text = getSource(node);
const messages = alex(text, opts).messages;
messages.forEach((result) => {
reportError(node, result);
});
}
}
} 2 is just workaround until textlint ESM support. |
Thank you for your explanation. ok, I'll wait until textlint ESM support. |
Any progress on this? |
Can you create a PR? |
I created a PR #25 but it has issues. |
【issue】
While using this repository, I received a security notice from Dependabot regarding vulnerable version of trim.
The security notice is here.
【solution】
I think updating alex version to
10.0.0
will solve this issue because latest version of alex depends on latest version of remark-parseThank you.
The text was updated successfully, but these errors were encountered: