-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Progress converting from CommonJS -> ESM
- Loading branch information
Showing
21 changed files
with
132 additions
and
167 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"root": true, | ||
"parserOptions": { | ||
"ecmaVersion": 2020 | ||
}, | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"jest": true | ||
}, | ||
"plugins": ["github"], | ||
"extends": ["plugin:github/recommended"], | ||
"rules": { | ||
"import/no-commonjs": "off", | ||
"filenames/match-regex": "off", | ||
"i18n-text/no-en": "off" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// import init from "./index.js"; | ||
|
||
const options = { | ||
default: false, | ||
"heading-increment": true, | ||
"no-alt-text": true, | ||
"single-h1": true, | ||
"no-emphasis-as-heading": true, | ||
"first-line-heading": true, | ||
}; | ||
export const config = options; | ||
export const customRules = ["./index.js"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
14 | ||
18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
const _ = require("lodash"); | ||
import _ from "lodash-es"; | ||
|
||
const accessibilityRules = require("./style/accessibility.json"); | ||
const base = require("./style/base.json"); | ||
const gitHubCustomRules = require("./src/rules/index").rules; | ||
|
||
module.exports = [...gitHubCustomRules]; | ||
import * as accessibilityRules from "./style/accessibility.json"; | ||
import * as base from "./style/base.json"; | ||
import { githubMarkdownLint } from "./src/rules/index.js"; | ||
|
||
const offByDefault = ["no-empty-alt-text"]; | ||
const foo = base; | ||
|
||
for (const rule of gitHubCustomRules) { | ||
const ruleName = rule.names[1]; | ||
base[ruleName] = offByDefault.includes(ruleName) ? false : true; | ||
} | ||
// for (const rule of githubMarkdownLint) { | ||
// const ruleName = rule.names[1]; | ||
// foo[ruleName] = offByDefault.includes(ruleName) ? false : true; | ||
// } | ||
|
||
module.exports.init = function init(consumerConfig) { | ||
export function init(consumerConfig) { | ||
// left overwrites right | ||
return _.defaultsDeep(consumerConfig, accessibilityRules, base); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"transform": { | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
/* Downcase and strip extra whitespaces and punctuation */ | ||
function stripAndDowncaseText(text) { | ||
export function stripAndDowncaseText(text) { | ||
return text | ||
.toLowerCase() | ||
.replace(/[.,/#!$%^&*;:{}=\-_`~()]/g, "") | ||
.replace(/\s+/g, " ") | ||
.trim(); | ||
} | ||
|
||
module.exports = { stripAndDowncaseText }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
module.exports = { | ||
rules: [ | ||
require("./no-default-alt-text"), | ||
require("./no-generic-link-text"), | ||
require("./no-empty-alt-text"), | ||
], | ||
}; | ||
import { noEmptyStringAltRule } from "./no-empty-alt-text.js"; | ||
import { noGenericLinkTextRule } from "./no-generic-link-text.js"; | ||
import { altTextRule } from "./no-default-alt-text.js"; | ||
|
||
export const githubMarkdownLint = [ | ||
altTextRule, | ||
noGenericLinkTextRule, | ||
noEmptyStringAltRule, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.