feat: using node version of markdown-lint, no custom rule
Some checks failed
CI / Check PR Title (pull_request) Successful in 46s
CI / Makefile Lint (pull_request) Failing after 1m23s
CI / Markdown Lint (pull_request) Failing after 49s
CI / Go Lint (pull_request) Successful in 1m33s
CI / Unit Tests (pull_request) Successful in 55s
CI / Fuzz Tests (pull_request) Successful in 1m52s
CI / Mutation Tests (pull_request) Successful in 1m31s
Some checks failed
CI / Check PR Title (pull_request) Successful in 46s
CI / Makefile Lint (pull_request) Failing after 1m23s
CI / Markdown Lint (pull_request) Failing after 49s
CI / Go Lint (pull_request) Successful in 1m33s
CI / Unit Tests (pull_request) Successful in 55s
CI / Fuzz Tests (pull_request) Successful in 1m52s
CI / Mutation Tests (pull_request) Successful in 1m31s
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -24,3 +24,6 @@ go.work.sum
|
||||
|
||||
# env file
|
||||
.env
|
||||
|
||||
# Node dev tooling (markdownlint)
|
||||
node_modules/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"customRules": [".markdownlint-rules/one-sentence-per-line.mjs"],
|
||||
"customRules": ["markdownlint-rule-max-one-sentence-per-line"],
|
||||
"gitignore": true,
|
||||
"config": {
|
||||
"default": true,
|
||||
"heading-style": { "style": "atx" },
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
// @ts-check
|
||||
|
||||
/**
|
||||
* @typedef {object} ErrorInfo
|
||||
* @property {number} lineNumber
|
||||
* @property {string} [context]
|
||||
* @property {string} [detail]
|
||||
* @property {[number, number]} [range]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} Params
|
||||
* @property {string[]} lines
|
||||
*/
|
||||
|
||||
/** @typedef {(error: ErrorInfo) => void} OnError */
|
||||
|
||||
/**
|
||||
* @typedef {object} Rule
|
||||
* @property {string[]} names
|
||||
* @property {string} description
|
||||
* @property {string[]} tags
|
||||
* @property {(params: Params, onError: OnError) => void} function
|
||||
*/
|
||||
|
||||
/** @type {Rule} */
|
||||
export default {
|
||||
names: ["one-sentence-per-line"],
|
||||
description: "Each sentence must be on its own line",
|
||||
tags: ["sentences"],
|
||||
function: function (params, onError) {
|
||||
let inFence = false;
|
||||
params.lines.forEach((line, index) => {
|
||||
if (/^```/.test(line)) {
|
||||
inFence = !inFence;
|
||||
return;
|
||||
}
|
||||
if (inFence) return;
|
||||
// Skip headings, blank lines, HTML, table rows
|
||||
if (/^(#|\s*[|<]|>|\s*$)/.test(line)) return;
|
||||
// Strip list marker before checking
|
||||
const text = line.replace(/^\s*(?:[-*+]|\d+\.)\s+/, "");
|
||||
if (/[.!?]\s+[A-Z]/.test(text)) {
|
||||
onError({ lineNumber: index + 1, context: text.trim() });
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
3
Makefile
3
Makefile
@@ -4,6 +4,7 @@ help: ## Show this help
|
||||
@grep -E '^[a-zA-Z_-]+:.*##' $(MAKEFILE_LIST) | awk -F ':.*## ' '{printf " %-15s %s\n", $$1, $$2}'
|
||||
|
||||
install: ## Install dev tools
|
||||
npm install
|
||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||
go install github.com/checkmake/checkmake/cmd/checkmake@latest
|
||||
go install github.com/go-gremlins/gremlins/cmd/gremlins@latest
|
||||
@@ -33,7 +34,7 @@ lint-makefile: ## Lint the Makefile
|
||||
checkmake Makefile
|
||||
|
||||
lint-markdown: ## Lint Markdown files
|
||||
docker run --rm -v $(CURDIR):/workdir davidanson/markdownlint-cli2 "**/*.md"
|
||||
npx markdownlint-cli2 "**/*.md"
|
||||
|
||||
lint: lint-go lint-makefile lint-markdown ## Lint all code
|
||||
|
||||
|
||||
1358
package-lock.json
generated
Normal file
1358
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
7
package.json
Normal file
7
package.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"markdownlint-cli2": "^0.22.1",
|
||||
"markdownlint-rule-max-one-sentence-per-line": "^0.0.2"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user