Skip to content

Commit a18dbdf

Browse files
committed
progress
1 parent 62e3669 commit a18dbdf

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

.markdownlint-cli2.mjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
// import init from "./index.js";
1+
import { init } from "./index.js";
22

3-
const options = {
3+
const options = init({
44
default: false,
55
"heading-increment": true,
66
"no-alt-text": true,
77
"single-h1": true,
88
"no-emphasis-as-heading": true,
99
"first-line-heading": true,
10-
};
10+
});
1111
export const config = options;
1212
export const customRules = ["./index.js"];

index.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
import _ from "lodash-es";
22

3-
import * as accessibilityRules from "./style/accessibility.json";
4-
import * as base from "./style/base.json";
3+
import accessibilityRules from "./style/accessibility.json";
4+
import base from "./style/base.json";
55
import { githubMarkdownLint } from "./src/rules/index.js";
66

77
const offByDefault = ["no-empty-alt-text"];
8-
const foo = base;
98

10-
// for (const rule of githubMarkdownLint) {
11-
// const ruleName = rule.names[1];
12-
// foo[ruleName] = offByDefault.includes(ruleName) ? false : true;
13-
// }
9+
for (const rule of githubMarkdownLint) {
10+
const ruleName = rule.names[1];
11+
base[ruleName] = offByDefault.includes(ruleName) ? false : true;
12+
}
1413

1514
export function init(consumerConfig) {
1615
// left overwrites right
17-
return _.defaultsDeep(consumerConfig, accessibilityRules, base);
16+
const foo = _.defaultsDeep(consumerConfig, accessibilityRules, base);
17+
return foo;
1818
}
19+
20+
// export default githubMarkdownLint;

test/accessibility-rules.test.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { lint } from "markdownlint/async";
22
import * as accessibilityRulesConfig from "../style/accessibility.json";
3-
import * as accessibilityRules from "..";
3+
import { githubMarkdownLint } from "../src/rules/index.js";
44

55
const exampleFileName = "./test/example.md";
66
const options = {
@@ -9,9 +9,11 @@ const options = {
99
...accessibilityRulesConfig,
1010
},
1111
files: [exampleFileName],
12-
customRules: accessibilityRules,
12+
customRules: githubMarkdownLint,
1313
};
1414

15+
console.log(options);
16+
1517
describe("when A11y rules applied", () => {
1618
test("fails expected rules", async () => {
1719
const result = await new Promise((resolve, reject) => {
@@ -26,6 +28,7 @@ describe("when A11y rules applied", () => {
2628
.map((failure) => failure.ruleNames)
2729
.flat();
2830

31+
// Currently failing, finding 6 failures not 3
2932
expect(failuresForExampleFile).toHaveLength(3);
3033
expect(failureNames).toContain("no-default-alt-text");
3134
});

0 commit comments

Comments
 (0)