Skip to content

Commit

Permalink
Lint markdown files to enforce consistent writing and reading experience
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkudrna committed Jul 9, 2020
1 parent d6a1f42 commit 6be2dcb
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 18 deletions.
3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,3 @@ indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
8 changes: 8 additions & 0 deletions .markdownlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"comment": "All rules, see https://github.com/DavidAnson/markdownlint#rules--aliases",

"default": true,
"MD013": {
"line_length": 100
}
}
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MIT License
# MIT License

Copyright (c) 2019 @react-ui-org

Expand Down
40 changes: 27 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,45 @@ To use React UI in your app:
2. Install `react-ui` with `$ npm install --save @react-ui-org/react-ui`.
3. First import the **theme layer** to the topmost level of your React app.
Either use the bundled theme as is:

```js
// app.jsx
import '@react-ui-org/react-ui/src/lib/theme.scss';
```

or use it as a foundation to create your custom theme (see Theming for more):

```js
// app.jsx
import './my-custom-theme.scss';
```
⚠️ As of now, you will need **working SASS pipeline** for this to work.
This is to be changed to ready-to-use CSS in the future.

ℹ️ Technically it is possible to import the theme layer anywhere later in the app.
But it's a nice habit to declare variables before using them and that's what we are doing here.
⚠️ As of now, you will need **working SASS pipeline** for this to work. This is to be changed
to ready-to-use CSS in the future.

ℹ️ Technically it is possible to import the theme layer anywhere later in the app. But it's a
nice habit to declare variables before using them and that's what we are doing here.

4. Add React UI **foundation styles**, the ground-zero CSS for React UI components:

```js
// app.jsx
import '@react-ui-org/react-ui/src/lib/theme.scss';
import '@react-ui-org/react-ui/src/lib/foundation.scss';
```

5. Optionally add the **helper and utility classes** bundles:

```js
// app.jsx
import '@react-ui-org/react-ui/src/lib/theme.scss';
import '@react-ui-org/react-ui/src/lib/foundation.scss';
import '@react-ui-org/react-ui/src/lib/helpers.scss';
import '@react-ui-org/react-ui/src/lib/utilities.scss';
```

6. Finally, use React UI **components** just like you are used to:

```js
// MyDashboardScreen.jsx
import React from 'react';
Expand All @@ -74,13 +84,15 @@ See the [default theme](src/lib/theme.scss) for the full list of available setti
[cannot be used within media queries](https://www.w3.org/TR/css-variables-1/#using-variables)
(because media query is not a CSS property).

ℹ️ Please note that CSS custom properties are only supported by modern browsers.
Refer to [caniuse.com](https://caniuse.com/#feat=css-variables) for compatibility overview.
ℹ️ Please note that CSS custom properties are only supported by modern browsers. Refer to
[caniuse.com](https://caniuse.com/#feat=css-variables) for compatibility overview.

### Theming Options

With output size in mind, we recommend to choose from these theming options:

- use the default theme and override just selected settings in your app — useful for tiny adjustments
- use the default theme and override just selected settings in your app — useful for tiny
adjustments
- copy the default theme to your app and change whatever is needed — useful for major visual changes

## Extending
Expand All @@ -93,8 +105,8 @@ that require icons allow to them to be passed in via props.

## Translations

Structure of translations can be found in file `src/lib/translation/TranslationContext.jsx`.
You can use `TranslationProvider` component and pass translated structure from this file into
Structure of translations can be found in file `src/lib/translation/TranslationContext.jsx`. You
can use `TranslationProvider` component and pass translated structure from this file into
`TranslationProvider` as `translations` props to overwrite default translations.

Second option is to overwrite translations locally using `translations` props of specific component.
Expand All @@ -121,15 +133,17 @@ To publish the new version:

### Package linking

The best option for development of React UI is to link `react-ui` into your application with `npm link`.
The best option for development of React UI is to link `react-ui` into your application with
`npm link`.

1. In React UI repository run `npm link`
1. In React UI repository run `npm link`
2. In your application run `npm link @react-ui-org/react-ui`

To prevent [Invalid Hook Call Warning](https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react)
To prevent
[Invalid Hook Call Warning](https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react)
when React UI is linked, add following code to Webpack configuration of your client:

```
```js
const path = require('path');

resolve: {
Expand Down
168 changes: 168 additions & 0 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"eslint-plugin-react-hooks": "^4.0.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^26.0.1",
"markdownlint-cli": "~0.23.2",
"node-sass": "^4.14.1",
"postcss-loader": "^3.0.0",
"sass-loader": "^8.0.2",
Expand All @@ -71,8 +72,9 @@
"demo:test": "eslint --ext js,jsx src/demo",
"lib:build": "webpack --mode development --config webpack.config.lib.js && webpack --mode production --config webpack.config.lib.js",
"lib:test": "stylelint \"src/lib/**/*.scss\" --config stylelint.config.js && eslint --ext js,jsx src/lib && jest -w",
"lint-markdown": "markdownlint **/*.md --ignore dist --ignore node_modules",
"prepublishOnly": "npm run lib:build",
"start": "npm run demo:start",
"test": "npm run lib:test && npm run demo:test"
"test": "npm run lint-markdown && npm run lib:test && npm run demo:test"
}
}

0 comments on commit 6be2dcb

Please sign in to comment.