mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Add simple/concrete example of custom rule package for publishing (fixes #133).
This commit is contained in:
parent
183d9c5cb1
commit
23d5be6015
4 changed files with 49 additions and 9 deletions
|
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"name": "markdownlint-rules-test",
|
||||
"name": "markdownlint-rule-sample",
|
||||
"version": "0.0.1",
|
||||
"description": "Package of markdownlint custom rules used for testing",
|
||||
"main": "rules.js",
|
||||
"description": "Package for markdownlint custom rule sample",
|
||||
"main": "sample-rule.js",
|
||||
"author": "David Anson (https://dlaa.me/)",
|
||||
"homepage": "https://github.com/DavidAnson/markdownlint",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"markdownlint-rules"
|
||||
"markdownlint-rule"
|
||||
],
|
||||
"private": true
|
||||
}
|
||||
19
test/rules/npm/sample-rule.js
Normal file
19
test/rules/npm/sample-rule.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// @ts-check
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"names": [ "sample-rule" ],
|
||||
"description": "Sample rule",
|
||||
"tags": [ "sample" ],
|
||||
"function": function rule(params, onError) {
|
||||
params.tokens.forEach((token) => {
|
||||
if (token.type === "hr") {
|
||||
onError({
|
||||
"lineNumber": token.lineNumber,
|
||||
"detail": "Sample error for hr"
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue