|
| 1 | +import { readFile } from "fs/promises"; |
1 | 2 | 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"; |
6 | 4 |
|
7 | 5 | 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 | +// } |
8 | 11 |
|
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) { |
15 | 13 | // 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); |
18 | 23 | } |
19 | 24 |
|
20 | | -// export default githubMarkdownLint; |
| 25 | +// export { default } from "./rules"; |
0 commit comments