mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Stop using module.createRequire (problematic under webpack), incorporate and export resolveModule helper from markdownlint-cli2.
This commit is contained in:
parent
a1da464618
commit
53ff5c43f1
16 changed files with 327 additions and 25 deletions
14
test/rules/node_modules/markdownlint-rule-sample-commonjs/package.json
generated
vendored
Normal file
14
test/rules/node_modules/markdownlint-rule-sample-commonjs/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "markdownlint-rule-sample-commonjs",
|
||||
"version": "0.0.1",
|
||||
"description": "Package for markdownlint custom rule sample (commonjs)",
|
||||
"main": "sample-rule.cjs",
|
||||
"type": "commonjs",
|
||||
"author": "David Anson (https://dlaa.me/)",
|
||||
"homepage": "https://github.com/DavidAnson/markdownlint",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"markdownlint-rule"
|
||||
],
|
||||
"private": true
|
||||
}
|
||||
18
test/rules/node_modules/markdownlint-rule-sample-commonjs/sample-rule.cjs
generated
vendored
Normal file
18
test/rules/node_modules/markdownlint-rule-sample-commonjs/sample-rule.cjs
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// @ts-check
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"names": [ "sample-rule-commonjs" ],
|
||||
"description": "Sample rule (commonjs)",
|
||||
"tags": [ "sample" ],
|
||||
"function": (params, onError) => {
|
||||
const hrTokens = params.tokens.filter((token) => token.type === "hr");
|
||||
for (const token of hrTokens) {
|
||||
onError({
|
||||
"lineNumber": token.lineNumber,
|
||||
"detail": "Sample error for hr"
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
14
test/rules/node_modules/markdownlint-rule-sample-module/package.json
generated
vendored
Normal file
14
test/rules/node_modules/markdownlint-rule-sample-module/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "markdownlint-rule-sample-module",
|
||||
"version": "0.0.1",
|
||||
"description": "Package for markdownlint custom rule sample (module)",
|
||||
"main": "sample-rule.mjs",
|
||||
"type": "module",
|
||||
"author": "David Anson (https://dlaa.me/)",
|
||||
"homepage": "https://github.com/DavidAnson/markdownlint",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"markdownlint-rule"
|
||||
],
|
||||
"private": true
|
||||
}
|
||||
18
test/rules/node_modules/markdownlint-rule-sample-module/sample-rule.mjs
generated
vendored
Normal file
18
test/rules/node_modules/markdownlint-rule-sample-module/sample-rule.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// @ts-check
|
||||
|
||||
const rule = {
|
||||
"names": [ "sample-rule-module" ],
|
||||
"description": "Sample rule (module)",
|
||||
"tags": [ "sample" ],
|
||||
"function": (params, onError) => {
|
||||
const hrTokens = params.tokens.filter((token) => token.type === "hr");
|
||||
for (const token of hrTokens) {
|
||||
onError({
|
||||
"lineNumber": token.lineNumber,
|
||||
"detail": "Sample error for hr"
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default rule;
|
||||
Loading…
Add table
Add a link
Reference in a new issue