Skip to content

Commit

Permalink
Add config schema for .markdownlint-cli2.jsonc (from VS Code extensio…
Browse files Browse the repository at this point in the history
…n), include it and config schema for .markdownlint.jsonc in project/package, validate both against corresponding files in the project.
  • Loading branch information
DavidAnson committed Sep 9, 2023
1 parent 40216aa commit c74fe6b
Show file tree
Hide file tree
Showing 4 changed files with 1,279 additions and 3 deletions.
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
"scripts": {
"build-docker-image": "VERSION=$(node -e \"process.stdout.write(require('./package.json').version)\") && docker build -t davidanson/markdownlint-cli2:v$VERSION -f docker/Dockerfile --label org.opencontainers.image.version=v$VERSION .",
"build-docker-image-rules": "VERSION=$(node -e \"process.stdout.write(require('./package.json').version)\") && docker build -t davidanson/markdownlint-cli2-rules:v$VERSION -f docker/Dockerfile-rules --build-arg VERSION=v$VERSION --label org.opencontainers.image.version=v$VERSION .",
"ci": "npm-run-all --continue-on-error --parallel test-cover lint",
"ci": "npm-run-all --continue-on-error --parallel test-cover lint schema",
"docker-npm-install": "docker run --rm --tty --name npm-install --volume $PWD:/home/workdir --workdir /home/workdir --user node node:latest npm install",
"docker-npm-run-upgrade": "docker run --rm --tty --name npm-run-upgrade --volume $PWD:/home/workdir --workdir /home/workdir --user node node:latest npm run upgrade",
"lint": "eslint --max-warnings 0 --no-eslintrc --config .eslintrc.json .",
"lint-dockerfile": "docker run --rm -i hadolint/hadolint:latest-alpine < docker/Dockerfile",
"lint-watch": "git ls-files | entr npm run lint",
"publish-docker-image": "VERSION=$(node -e \"process.stdout.write(require('./package.json').version)\") && docker buildx build --platform linux/arm64,linux/amd64 -t davidanson/markdownlint-cli2:v$VERSION -t davidanson/markdownlint-cli2:latest -f docker/Dockerfile --push .",
"schema": "cpy ./node_modules/markdownlint/schema/markdownlint-config-schema.json ./schema --flat",
"test": "ava --timeout=1m test/append-to-array-test.js test/fs-mock-test.js test/markdownlint-cli2-test.js test/markdownlint-cli2-test-exec.js test/markdownlint-cli2-test-fs.js test/markdownlint-cli2-test-main.js test/merge-options-test.js test/resolve-and-require-test.js",
"test-cover": "c8 --100 npm test -- --concurrency=1",
"test-docker-hub-image": "VERSION=$(node -e \"process.stdout.write(require('./package.json').version)\") && docker image rm davidanson/markdownlint-cli2:v$VERSION davidanson/markdownlint-cli2:latest || true && docker run --rm -v $PWD:/workdir davidanson/markdownlint-cli2:v$VERSION \"*.md\" && docker run --rm -v $PWD:/workdir davidanson/markdownlint-cli2:latest \"*.md\"",
Expand Down Expand Up @@ -62,7 +63,9 @@
"markdownlint-cli2-fix.js",
"merge-options.js",
"README.md",
"resolve-and-require.js"
"resolve-and-require.js",
"schema/markdownlint-cli2-config-schema.json",
"schema/markdownlint-config-schema.json"
],
"dependencies": {
"globby": "13.2.2",
Expand All @@ -77,6 +80,7 @@
"ava": "5.3.1",
"c8": "8.0.1",
"cpy": "10.1.0",
"cpy-cli": "5.0.0",
"del": "7.1.0",
"eslint": "8.48.0",
"eslint-plugin-n": "16.0.2",
Expand All @@ -91,7 +95,8 @@
"markdownlint-cli2-formatter-sarif": "0.0.1",
"markdownlint-cli2-formatter-summarize": "0.0.6",
"markdownlint-rule-titlecase": "0.1.0",
"npm-run-all": "4.1.5"
"npm-run-all": "4.1.5",
"tv4": "1.3.0"
},
"keywords": [
"markdown",
Expand Down
109 changes: 109 additions & 0 deletions schema/markdownlint-cli2-config-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "markdownlint-cli2 configuration schema",
"type": "object",
"properties": {
"$schema": {
"description": "JSON Schema URI (used by some editors)",
"type": "string",
"default": "https://raw.githubusercontent.com/DavidAnson/markdownlint-cli2/main/schema/markdownlint-cli2-config-schema.json"
},
"config": {
"description": "markdownlint-cli2 configuration schema",
"$ref": "./markdownlint-config-schema.json",
"default": {}
},
"customRules": {
"description": "Module names or paths of custom rules to load and use when linting",
"type": "array",
"default": [],
"items": {
"description": "Module name or path of a custom rule",
"type": "string",
"minLength": 1
}
},
"fix": {
"description": "Whether to enable fixing of linting errors reported by rules that emit fix information",
"type": "boolean",
"default": false
},
"frontMatter": {
"description": "Regular expression used to match and ignore any front matter at the beginning of a document",
"type": "string",
"minLength": 1,
"default": ""
},
"globs": {
"description": "Glob expressions to include when linting (only valid at the root)",
"type": "array",
"default": [],
"items": {
"description": "Glob expression of files to lint",
"type": "string",
"minLength": 1
}
},
"ignores": {
"description": "Glob expressions to ignore when linting",
"type": "array",
"default": [],
"items": {
"description": "Glob expression of files to ignore",
"type": "string",
"minLength": 1
}
},
"markdownItPlugins": {
"description": "markdown-it plugins to load and use when linting",
"type": "array",
"default": [],
"items": {
"description": "Name or path of a markdown-it plugin followed by parameters",
"type": "array",
"items": [
{
"description": "Name or path of a markdown-it plugin",
"type": "string",
"minLength": 1
},
{
"description": "Parameter(s) to pass to the markdown-it plugin"
}
],
"minItems": 1
}
},
"noInlineConfig": {
"description": "Whether to disable support of HTML comments within Markdown content",
"type": "boolean",
"default": false
},
"noProgress": {
"description": "Whether to disable the display of progress on stdout (only valid at the root)",
"type": "boolean",
"default": false
},
"outputFormatters": {
"description": "Output formatters to load and use to customize markdownlint-cli2 output (only valid at the root)",
"type": "array",
"default": [],
"items": {
"description": "Name or path of an output formatter followed by parameters",
"type": "array",
"items": [
{
"description": "Name or path of an output formatter",
"type": "string",
"minLength": 1
},
{
"description": "Parameter(s) to pass to the output formatter"
}
],
"minItems": 1
}
}
},
"additionalProperties": false
}
Loading

0 comments on commit c74fe6b

Please sign in to comment.