Skip to content

Commit a2189d1

Browse files
committed
Get basic styleguidist to work
1 parent 16327a5 commit a2189d1

18 files changed

+1183
-95
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*.md
22
**/*{.,-}min.js
3+
example/src/serviceWorker.js
34
node_modules/
45
/example/build/
56
/lib/

.eslintrc.json

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
{
2-
"plugins": [
3-
"babel"
4-
],
2+
"plugins": ["babel"],
53
"extends": [
64
"eslint:recommended",
75
"plugin:flowtype/recommended",
86
"plugin:react/recommended",
97
"plugin:jest/recommended"
108
],
9+
"settings": {
10+
"react": {
11+
"version": "detect",
12+
"flowVersion": "0.91"
13+
}
14+
},
1115
"rules": {
1216
"no-console": 0,
1317
"no-mixed-spaces-and-tabs": 1,
@@ -27,17 +31,12 @@
2731
"require-await": 2,
2832
"react/prop-types": 0,
2933
"no-var": 2,
30-
"linebreak-style": [
31-
2,
32-
"unix"
33-
],
34-
"semi": [
35-
1,
36-
"always"
37-
],
34+
"linebreak-style": [2, "unix"],
35+
"semi": [1, "always"],
3836
"flowtype/require-valid-file-annotation": [
3937
0,
40-
"always", {
38+
"always",
39+
{
4140
"annotationStyle": "line"
4241
}
4342
],
@@ -52,8 +51,8 @@
5251
"parserOptions": {
5352
"sourceType": "module",
5453
"ecmaVersion": 2018,
55-
"ecmaFeatures" : {
56-
"modules": true
54+
"ecmaFeatures": {
55+
"modules": true
5756
}
5857
}
5958
}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
/flow-typed/
66
/docs/
77
/.git/
8+
example/src/serviceWorker.js
89
**/*.sh

.prettierrc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"singleQuote": true,
3-
"trailingComma": "all",
4-
"arrowParens": "always",
5-
"tabWidth": 2,
6-
"overrides": [
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"arrowParens": "always",
5+
"tabWidth": 2,
6+
"overrides": [
77
{
88
"files": "*.ts",
99
"options": {

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ npm install --save react-file-utils
1313
## Usage
1414

1515
```jsx
16-
import React, { Component } from 'react'
16+
import React, { Component } from 'react';
1717

18-
import MyComponent from 'react-file-utils'
18+
import MyComponent from 'react-file-utils';
1919

2020
class Example extends Component {
21-
render () {
22-
return (
23-
<MyComponent />
24-
)
21+
render() {
22+
return <MyComponent />;
2523
}
2624
}
2725
```

example/src/index.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
body {
22
margin: 0;
33
padding: 0;
4-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
5-
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
4+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
5+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
66
sans-serif;
77
-webkit-font-smoothing: antialiased;
88
-moz-osx-font-smoothing: grayscale;
99
}
1010

1111
code {
12-
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
12+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
1313
monospace;
1414
}

package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
"scripts": {
1616
"test": "cross-env CI=1 react-scripts test --env=jsdom",
1717
"test:watch": "react-scripts test --env=jsdom",
18+
"docs": "styleguidist build",
19+
"docs-server": "styleguidist server",
20+
"prettier": "prettier --list-different '**/*.{js,ts,md,css,scss,json}' .eslintrc.json .prettierrc .babelrc",
21+
"prettier-fix": "prettier --write '**/*.{js,ts,md,css,scss,json}' .eslintrc.json .prettierrc .babelrc",
22+
"eslint": "eslint '**/*.js' --max-warnings 0",
23+
"eslint-fix": "eslint --fix '**/*.js' --max-warnings 0",
24+
"lint": "prettier --list-different '**/*.{js,ts,md,css,scss,json}' .eslintrc.json .prettierrc .babelrc && eslint '**/*.{js,md}' --max-warnings 0",
25+
"lint-fix": "prettier --write '**/*.{js,ts,md,css,scss,json}' .eslintrc.json .prettierrc .babelrc && eslint --fix '**/*.{js,md}' --max-warnings 0",
1826
"build": "rollup -c",
1927
"start": "rollup -c -w",
2028
"prepare": "yarn run build",
@@ -44,10 +52,16 @@
4452
"babel-register": "^7.0.0-beta.3",
4553
"cross-env": "^5.1.4",
4654
"eslint": "^5.0.1",
55+
"eslint-config-react-app": "^3.0.6",
4756
"eslint-config-standard": "^11.0.0",
4857
"eslint-config-standard-react": "^6.0.0",
58+
"eslint-loader": "^2.1.1",
4959
"eslint-plugin-babel": "^5.2.0",
60+
"eslint-plugin-flowtype": "^3.2.1",
5061
"eslint-plugin-import": "^2.13.0",
62+
"eslint-plugin-jest": "^22.2.1",
63+
"eslint-plugin-jsx-a11y": "^6.2.0",
64+
"eslint-plugin-markdown": "^1.0.0",
5165
"eslint-plugin-node": "^7.0.1",
5266
"eslint-plugin-promise": "^4.0.0",
5367
"eslint-plugin-react": "^7.10.0",
@@ -65,6 +79,7 @@
6579
"react": "^16.4.1",
6680
"react-dom": "^16.4.1",
6781
"react-scripts": "2.1.3",
82+
"react-styleguidist": "^8.0.6",
6883
"rollup": "^0.66.4",
6984
"rollup-plugin-babel": "^4.0.3",
7085
"rollup-plugin-commonjs": "^9.1.8",
@@ -77,6 +92,7 @@
7792
"dist"
7893
],
7994
"dependencies": {
95+
"@fortawesome/fontawesome-svg-core": "^1.2.13",
8096
"@fortawesome/free-regular-svg-icons": "^5.7.0",
8197
"@fortawesome/react-fontawesome": "^0.1.4",
8298
"react-dropzone": "5.1.1"

postcss.config.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/* eslint-disable */
2+
const variables = {
3+
borderRadius: '4px',
4+
5+
z0: '0',
6+
z1: '10',
7+
z2: '20',
8+
z3: '30',
9+
z4: '40',
10+
z5: '50',
11+
z6: '60',
12+
z7: '70',
13+
z8: '80',
14+
z9: '90',
15+
16+
transparent: 'rgba(255,255,255,0)',
17+
white: '#ffffff',
18+
black: '#000000',
19+
primary: '#00D46A',
20+
info: '#0BA8E0',
21+
faded: '#DDDDDD',
22+
error: '#FF0000',
23+
fontColor: '#414D54',
24+
25+
// Colors to optimize
26+
rafAttachedActivityAuthor: '#414D54',
27+
rafActivityFooterBorder: '#E6F0F2',
28+
rafCommentfieldBackground: '#F7F7F7', // lightest grey
29+
rafCardBackground: '#F4F4F4', // lighter grey
30+
rafCardBorder: '#A0B2B8', // grey
31+
rafDropdownBackground: '#313E47', // dark grey
32+
};
33+
34+
module.exports = {
35+
plugins: {
36+
'postcss-easy-import': {},
37+
'postcss-cssnext': {},
38+
'postcss-nested': {},
39+
'postcss-color-function': {},
40+
'postcss-simple-vars': { variables },
41+
},
42+
};

rollup.config.js

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,25 @@
1-
import babel from 'rollup-plugin-babel'
2-
import commonjs from 'rollup-plugin-commonjs'
3-
import external from 'rollup-plugin-peer-deps-external'
4-
import postcss from 'rollup-plugin-postcss'
5-
import url from 'rollup-plugin-url'
1+
import babel from 'rollup-plugin-babel';
2+
import commonjs from 'rollup-plugin-commonjs';
3+
import external from 'rollup-plugin-peer-deps-external';
4+
import postcss from 'rollup-plugin-postcss';
5+
import url from 'rollup-plugin-url';
66
import replace from 'rollup-plugin-replace';
77

8-
import atImport from 'postcss-easy-import';
9-
import cssnext from 'postcss-cssnext';
10-
import nested from 'postcss-nested';
11-
import colorFunction from 'postcss-color-function';
12-
import vars from 'postcss-simple-vars';
13-
14-
import pkg from './package.json'
8+
import pkg from './package.json';
159

1610
export default {
1711
input: 'src/index.js',
1812
output: [
1913
{
2014
file: pkg.main,
2115
format: 'cjs',
22-
sourcemap: true
16+
sourcemap: true,
2317
},
2418
{
2519
file: pkg.module,
2620
format: 'es',
27-
sourcemap: true
28-
}
21+
sourcemap: true,
22+
},
2923
],
3024
external: [
3125
'react-images',
@@ -56,13 +50,6 @@ export default {
5650
}),
5751
external(),
5852
postcss({
59-
plugins: [
60-
atImport(),
61-
nested(),
62-
//vars({ variables }),
63-
colorFunction(),
64-
cssnext(),
65-
],
6653
modules: false,
6754
extract: true,
6855
}),
@@ -71,6 +58,6 @@ export default {
7158
runtimeHelpers: true,
7259
exclude: 'node_modules/**',
7360
}),
74-
commonjs()
75-
]
76-
}
61+
commonjs(),
62+
],
63+
};

src/index.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
1-
import React, { Component } from 'react'
2-
import PropTypes from 'prop-types'
1+
import React, { Component } from 'react';
2+
import PropTypes from 'prop-types';
33

4-
import styles from './styles.css'
4+
import styles from './styles.css';
55

66
export default class ExampleComponent extends Component {
77
static propTypes = {
8-
text: PropTypes.string
9-
}
8+
text: PropTypes.string,
9+
};
1010

1111
render() {
12-
const {
13-
text
14-
} = this.props
12+
const { text } = this.props;
1513

16-
return (
17-
<div className={styles.test}>
18-
Example Component: {text}
19-
</div>
20-
)
14+
return <div className={styles.test}>Example Component: {text}</div>;
2115
}
2216
}

0 commit comments

Comments
 (0)