This repository has been archived by the owner on May 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added documentation for package-json-lint
- Loading branch information
Showing
11 changed files
with
191 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
32 changes: 32 additions & 0 deletions
32
...s/terra-toolkit-docs/src/terra-dev-site/tool/package-json-lint/About.1.tool.mdx
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,32 @@ | ||
import { Badge } from '@cerner/package-json-lint/package.json?dev-site-package'; | ||
|
||
<Badge /> | ||
|
||
# Package Json Lint | ||
The package provide lint rules that can be used to flag problems that are present in a package.json. | ||
|
||
|
||
## Installation | ||
|
||
To install the module: | ||
|
||
```shell | ||
npm install @cerner/package-json-lint --save-dev | ||
npm install @cerner/package-json-lint-config-terra --save-dev | ||
``` | ||
|
||
## Usage | ||
|
||
### package.json | ||
```js | ||
"package-json-lint": { | ||
"extends": "./packages/package-json-lint-config-terra/package-json-lint.config.js", | ||
"projectType": "devModule | module | application", | ||
}, | ||
``` | ||
|
||
### npm script | ||
|
||
```js | ||
"lint:package-json": "npm run terra -- package-json-lint", | ||
``` |
7 changes: 7 additions & 0 deletions
7
...rra-toolkit-docs/src/terra-dev-site/tool/package-json-lint/ChangeLog.3.tool.mdx
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,7 @@ | ||
import { Badge } from '@cerner/package-json-lint/package.json?dev-site-package'; | ||
|
||
import ChangeLog from '@cerner/package-json-lint/CHANGELOG.md'; | ||
|
||
<Badge /> | ||
|
||
<ChangeLog /> |
9 changes: 9 additions & 0 deletions
9
...s/terra-toolkit-docs/src/terra-dev-site/tool/package-json-lint/Rules.2.tool.mdx
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,9 @@ | ||
import { Badge } from '@cerner/package-json-lint/package.json?dev-site-package'; | ||
|
||
import RulesTable from './rules-table/_RulesTable.jsx'; | ||
|
||
<Badge /> | ||
|
||
# Package JSON Lint Rules | ||
|
||
<RulesTable /> |
28 changes: 28 additions & 0 deletions
28
...toolkit-docs/src/terra-dev-site/tool/package-json-lint/rules-table/RulesTable.module.scss
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,28 @@ | ||
@import '@cerner/terra-dev-site/lib/mdx/MarkdownTags.module'; | ||
// @import './clinical-lowlight-theme/PropsTable.module'; | ||
// @import './orion-fusion-theme/PropsTable.module'; | ||
|
||
:local { | ||
.required { | ||
color: #d53040; | ||
} | ||
|
||
.props-tr { | ||
vertical-align: top; | ||
} | ||
|
||
.props-td { | ||
overflow-wrap: break-word; | ||
white-space: normal; | ||
word-wrap: break-word; | ||
} | ||
|
||
.tr { | ||
background-color: var(--terra-dev-site-props-table-tr-background-color, #fff); | ||
border-top: 1px solid #c6cbd1; | ||
} | ||
|
||
.tr:nth-child(2n) { | ||
background-color: var(--terra-dev-site-props-table-tr-alt-background-color, #f6f8fa); | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
.../terra-toolkit-docs/src/terra-dev-site/tool/package-json-lint/rules-table/_RulesTable.jsx
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,76 @@ | ||
import React, { useContext } from 'react'; | ||
import classNames from 'classnames/bind'; | ||
import { ThemeContext } from '@cerner/terra-application/lib/theme'; | ||
import Table, { | ||
Header, | ||
HeaderCell, | ||
Body, | ||
Cell, | ||
Row, | ||
} from 'terra-html-table'; | ||
|
||
import styles from './RulesTable.module.scss'; | ||
|
||
// Rules | ||
const requireNoTerraBasePeerDependencyVersions = require('@cerner/package-json-lint/lib/rules/require-no-terra-base-peer-dependency-versions'); | ||
const requireNoHardCodedDependencyVersions = require('@cerner/package-json-lint/lib/rules/require-no-hard-coded-dependency-versions'); | ||
const requireThemeContextVersions = require('@cerner/package-json-lint/lib/rules/require-theme-context-versions'); | ||
|
||
const cx = classNames.bind(styles); | ||
|
||
const rows = [ | ||
requireNoHardCodedDependencyVersions.documentation, | ||
requireNoTerraBasePeerDependencyVersions.documentation, | ||
requireThemeContextVersions.documentation, | ||
]; | ||
|
||
const RulesTable = () => { | ||
const theme = useContext(ThemeContext); | ||
|
||
return ( | ||
<div> | ||
<Table className={cx('table', theme.className)}> | ||
<Header> | ||
<HeaderCell className={cx('th')}> | ||
Rule Name | ||
</HeaderCell> | ||
<HeaderCell className={cx('th')}> | ||
Severity Type | ||
</HeaderCell> | ||
<HeaderCell className={cx('th')}> | ||
Required | ||
</HeaderCell> | ||
<HeaderCell className={cx('th')}> | ||
Default | ||
</HeaderCell> | ||
<HeaderCell className={cx('th')}> | ||
Description | ||
</HeaderCell> | ||
</Header> | ||
<Body> | ||
{rows.map((row) => ( | ||
<Row className={cx('tr', 'props-tr')} key={row.ruleName}> | ||
<Cell className={cx(['td', 'strong', 'props-td'])}> | ||
{row.ruleName} | ||
</Cell> | ||
<Cell className={cx(['td', 'props-td'])}> | ||
{`[${row.severityType}]`} | ||
</Cell> | ||
<Cell className={cx(['td', 'props-td', row.required ? ['required'] : []])}> | ||
{row.required ? 'required' : 'optional'} | ||
</Cell> | ||
<Cell className={cx(['td', 'props-td'])}> | ||
{row.default} | ||
</Cell> | ||
<Cell className={cx(['td', 'props-td'])}> | ||
{row.description} | ||
</Cell> | ||
</Row> | ||
))} | ||
</Body> | ||
</Table> | ||
</div> | ||
); | ||
}; | ||
|
||
export default RulesTable; |