Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c5d7531

Browse filesBrowse files
authored
Update config files to use plain JS instead of JSON (#149)
1 parent 6a47732 commit c5d7531
Copy full SHA for c5d7531

File tree

Expand file treeCollapse file tree

6 files changed

+27
-35
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+27
-35
lines changed

‎index.js

Copy file name to clipboardExpand all lines: index.js
+5-10Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
import { readFile } from "fs/promises";
21
import _ from "lodash-es";
32
import { githubMarkdownLint } from "./src/rules/index.js";
43

5-
const offByDefault = ["no-empty-alt-text"];
4+
import accessibilityRules from "./style/accessibility.js";
5+
import baseRules from "./style/base.js";
66

7-
export async function init(consumerConfig) {
8-
// left overwrites right
9-
const accessibilityRules = JSON.parse(
10-
await readFile(new URL("./style/accessibility.json", import.meta.url)),
11-
);
7+
const offByDefault = ["no-empty-alt-text"];
128

13-
const base = JSON.parse(
14-
await readFile(new URL("./style/base.json", import.meta.url)),
15-
);
9+
export function init(consumerConfig) {
10+
const base = { ...baseRules };
1611

1712
for (const rule of githubMarkdownLint) {
1813
const ruleName = rule.names[1];

‎style/accessibility.js

Copy file name to clipboard
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export default {
2+
"no-alt-text": true,
3+
"no-default-alt-text": true,
4+
"no-duplicate-heading": true,
5+
"no-emphasis-as-heading": true,
6+
"no-generic-link-text": true,
7+
"heading-increment": true,
8+
"no-space-in-links": false,
9+
"ol-prefix": "ordered",
10+
"single-h1": true,
11+
"ul-style": {
12+
style: "asterisk",
13+
},
14+
};

‎style/accessibility.json

Copy file name to clipboardExpand all lines: style/accessibility.json
-14Lines changed: 0 additions & 14 deletions
This file was deleted.

‎style/base.js

Copy file name to clipboard
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
default: true,
3+
"no-inline-html": false,
4+
"no-bare-urls": false,
5+
"no-blanks-blockquote": false,
6+
"fenced-code-language": true,
7+
};

‎style/base.json

Copy file name to clipboardExpand all lines: style/base.json
-7Lines changed: 0 additions & 7 deletions
This file was deleted.

‎test/accessibility-rules.test.js

Copy file name to clipboardExpand all lines: test/accessibility-rules.test.js
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
import { readFile } from "fs/promises";
21
import { lint } from "markdownlint/async";
32
import githubMarkdownLint from "../index.js";
3+
import accessibilityRules from "../style/accessibility.js";
44

55
const exampleFileName = "./test/example.md";
66

77
describe("when A11y rules applied", () => {
88
test("fails expected rules", async () => {
9-
const accessibilityRules = JSON.parse(
10-
await readFile(new URL("../style/accessibility.json", import.meta.url)),
11-
);
129
const options = {
1310
config: {
1411
default: false,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.