Skip to content

Commit

Permalink
Update docs, fix #92
Browse files Browse the repository at this point in the history
  • Loading branch information
xcatliu committed Aug 30, 2019
1 parent 548b5ad commit 2317ebe
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/index.html
@@ -1 +1 @@
<html><head><meta charset="utf-8"><meta http-equiv="x-ua-compatible" content="ie=edge"><title>AlloyTeam ESLint 规则</title><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="shortcut icon" type="image/png" href="alloy.f4abfc6f.png"><link rel="stylesheet" href="site.ed04ca62.css"></head><body> <div id="app"></div> <script src="site.70352b90.js"></script> </body></html>
<html><head><meta charset="utf-8"><meta http-equiv="x-ua-compatible" content="ie=edge"><title>AlloyTeam ESLint 规则</title><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="shortcut icon" type="image/png" href="alloy.f4abfc6f.png"><link rel="stylesheet" href="site.127e0b37.css"></head><body> <div id="app"></div> <script src="site.08fcf7bc.js"></script> </body></html>
4 changes: 2 additions & 2 deletions docs/site.70352b90.js → docs/site.08fcf7bc.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/site.08fcf7bc.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/site.ed04ca62.css → docs/site.127e0b37.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/site.127e0b37.css.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/site.70352b90.js.map

This file was deleted.

1 change: 0 additions & 1 deletion docs/site.ed04ca62.css.map

This file was deleted.

17 changes: 16 additions & 1 deletion site/components/RuleTable.tsx
Expand Up @@ -21,6 +21,21 @@ const configMap: {
typescript: require('../config/typescript.json')
};

const docsUrlMap: { [key in RuleNamespaces]: (rule: string) => string } = {
index: (rule) => `https://eslint.org/docs/rules/${rule}`,
react: (rule) =>
`https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/${rule.replace(
/.*\//,
''
)}.md`,
vue: (rule) => `https://eslint.vuejs.org/rules/${rule.replace(/.*\//, '')}.html`,
typescript: (rule) =>
`https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/${rule.replace(
/.*\//,
''
)}.md`
};

export const RuleTable: React.SFC<RuleTableProps> = ({ namespace, shouldHideOff }) => {
const currentConfig = configMap[namespace];
return (
Expand Down Expand Up @@ -50,7 +65,7 @@ export const RuleTable: React.SFC<RuleTableProps> = ({ namespace, shouldHideOff
}
>
<div className="unit-1-3 unit-1-on-mobile site-desc">
<a href={`https://eslint.org/docs/rules/${name}/`}>{name}</a>
<a href={docsUrlMap[namespace](name)}>{name}</a>
<p
className="top-gap-0"
dangerouslySetInnerHTML={{
Expand Down

0 comments on commit 2317ebe

Please sign in to comment.