Skip to content

Commit 84aebbc

Browse files
committed
progress?...
1 parent 354ceaa commit 84aebbc

13 files changed

+65
-5188
lines changed

.markdownlint-cli2.mjs

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

3-
const options = init({
3+
const configOptions = await 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,
1010
});
11-
export const config = options;
12-
export const customRules = ["./index.js"];
11+
console.log(configOptions);
12+
const options = {
13+
config: configOptions,
14+
customRules: ["./index.js"],
15+
};
16+
export default options;

index.js

+18-13
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1+
import { readFile } from "fs/promises";
12
import _ from "lodash-es";
2-
3-
import accessibilityRules from "./style/accessibility.json";
4-
import base from "./style/base.json";
5-
import { githubMarkdownLint } from "./src/rules/index.js";
3+
// import githubMarkdownLint from "./src/rules/index.js";
64

75
const offByDefault = ["no-empty-alt-text"];
6+
// const foo = [altTextRule, noGenericLinkTextRule, noEmptyStringAltRule];
7+
// for (const rule of foo) {
8+
// const ruleName = rule.names[1];
9+
// base[ruleName] = offByDefault.includes(ruleName) ? false : true;
10+
// }
811

9-
for (const rule of githubMarkdownLint) {
10-
const ruleName = rule.names[1];
11-
base[ruleName] = offByDefault.includes(ruleName) ? false : true;
12-
}
13-
14-
export function init(consumerConfig) {
12+
export async function init(consumerConfig) {
1513
// left overwrites right
16-
const foo = _.defaultsDeep(consumerConfig, accessibilityRules, base);
17-
return foo;
14+
const accessibilityRules = JSON.parse(
15+
await readFile(new URL("./style/accessibility.json", import.meta.url))
16+
);
17+
18+
const base = JSON.parse(
19+
await readFile(new URL("./style/base.json", import.meta.url))
20+
);
21+
22+
return _.defaultsDeep(consumerConfig, accessibilityRules, base);
1823
}
1924

20-
// export default githubMarkdownLint;
25+
// export { default } from "./rules";

0 commit comments

Comments
 (0)