Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ on:
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: ['22', '24']
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
node-version: ${{ matrix.node-version }}
- name: install dependencies
run: yarn install --frozen-lockfile
- name: lint markdown
Expand Down
24 changes: 13 additions & 11 deletions bin/mdlint.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#!/usr/bin/env node
const commander = require('commander');
const markdownlint = require('markdownlint');
const files = process.argv.slice(2);

const files = commander.parse(process.argv).args;

// See rules at https://github.com/mivok/markdownlint/blob/master/docs/RULES.md
// See rules at https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
const config = {
MD004: false, // Unordered list style
MD007: false, // Unordered list indentation
Expand All @@ -13,11 +10,16 @@ const config = {
MD029: { style: 'ordered' }, // Ordered list item prefix
MD034: false, // Bare URL used
MD040: false, // Fenced code blocks should have a language specified
MD059: false, // Link text should be descriptive
};

const result = markdownlint.sync({ files, config });
const errors = result.toString();
if (errors) {
process.stderr.write(`${errors}\n`);
process.exit(1);
}
// markdownlint is ESM-only: importing it dynamically keeps this script
// CommonJS and runs on Node versions without require(esm).
(async () => {
const { lint } = await import('markdownlint/sync');
const errors = lint({ files, config }).toString();
if (errors) {
process.stderr.write(`${errors}\n`);
process.exit(1);
}
})();
19 changes: 14 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,21 @@
"url": "https://github.com/scality/Guidelines"
},
"dependencies": {
"commander": "11.1.0",
"markdownlint": "0.31.1"
"globals": "^14.0.0",
"markdownlint": "0.38.0"
},
"peerDependencies": {
"eslint": "^9",
"prettier": "^3"
},
"peerDependenciesMeta": {
"prettier": {
"optional": true
}
},
"devDependencies": {
"eslint": "^9.9.1",
"prettier": "^3.4.2"
"eslint": "^9.39.5",
"prettier": "^3.9.6"
},
"keywords": [
"eslint",
Expand All @@ -40,6 +49,6 @@
"license": "Apache-2.0",
"homepage": "https://github.com/scality/Guidelines",
"engines": {
"node": ">=20"
"node": ">=22"
}
}
Loading
Loading