Skip to content

Commit e495c00

Browse files
committed
Initial commit
1 parent 26e297d commit e495c00

File tree

314 files changed

+51060
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

314 files changed

+51060
-0
lines changed

.babelrc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"presets": [
3+
"@babel/preset-env",
4+
"@babel/preset-flow",
5+
"@babel/preset-react"
6+
],
7+
"plugins": [
8+
"@babel/plugin-proposal-class-properties",
9+
"@babel/plugin-proposal-export-namespace-from",
10+
"@babel/plugin-proposal-object-rest-spread",
11+
"@babel/plugin-proposal-throw-expressions",
12+
"@babel/plugin-syntax-dynamic-import",
13+
"@babel/plugin-transform-runtime",
14+
"angularjs-annotate",
15+
["babel-plugin-transform-builtin-extend", {
16+
"globals": ["Error"]
17+
}]
18+
],
19+
"env": {
20+
"test": {
21+
"presets": [
22+
"@babel/preset-env",
23+
"@babel/preset-flow",
24+
"@babel/preset-react"
25+
]
26+
}
27+
}
28+
}

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
flow-typed/*
2+
*.test.es6.js

.eslintrc.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
const path = require('path')
2+
3+
module.exports = {
4+
"extends": [
5+
"standard",
6+
"plugin:flowtype/recommended",
7+
"plugin:react/recommended"
8+
],
9+
"parser": "babel-eslint",
10+
"settings": {
11+
"flowtype": {
12+
"onlyFilesWithFlowAnnotation": true
13+
}
14+
},
15+
"plugins": [
16+
"standard",
17+
"flowtype",
18+
"promise",
19+
"import",
20+
"react",
21+
"jsx-a11y"
22+
],
23+
"env": {
24+
"mocha": true,
25+
"node": true,
26+
"browser": true,
27+
"es6": true,
28+
"jquery": true
29+
},
30+
"globals": {
31+
"expect": false,
32+
"jest": false
33+
},
34+
"rules": {
35+
"import/extensions": 0,
36+
"no-useless-escape": 0,
37+
"no-useless-return": 0,
38+
"camelcase": 0,
39+
"prefer-const": 1,
40+
"react/prop-types": [2, { ignore: ['className'] }],
41+
"no-multi-spaces": [2, { "ignoreEOLComments": true }],
42+
"import/no-webpack-loader-syntax": 0,
43+
"no-use-before-define": [0],
44+
"no-duplicate-imports": 0,
45+
"react/no-deprecated": 0,
46+
"semi": ["error", "never"],
47+
"quotes": ["error", "single"],
48+
"comma-dangle": "off",
49+
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
50+
"jsx-a11y/no-static-element-interactions": "off",
51+
"jsx-a11y/img-has-alt": [0],
52+
"jsx-a11y/href-no-hash": "off",
53+
"jsx-a11y/anchor-is-valid": ["warn", { "aspects": ["invalidHref"] }],
54+
"import/no-extraneous-dependencies": ["error", {
55+
"devDependencies": true,
56+
"optionalDependencies": false,
57+
"peerDependencies": false,
58+
"packageDir": path.join(__dirname)
59+
}]
60+
}
61+
};

.flowconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[ignore]
2+
.*/build/.*
3+
.*/node_modules/findup/test/fixture/f/e/d/c/b/a/top.json
4+
.*/node_modules/findup/test/fixture/config.json
5+
.*/node_modules/findup/test/fixture/f/e/d/c/config.json
6+
7+
[options]
8+
emoji=true
9+
module.file_ext=.css
10+
module.file_ext=.scss
11+
module.file_ext=.js
12+
module.file_ext=.json
13+
module.name_mapper.extension='css' -> 'empty/object'
14+
module.name_mapper.extension='scss' -> 'empty/object'
15+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe
16+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue
17+
suppress_comment=\\(.\\|\n\\)*\\$FlowIgnore
18+
19+
[version]
20+
0.95.1

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dist/
2+
node_modules/
3+
.vscode/
4+
styleguide/static/

.npmignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
static/
2+
jest/
3+
src/
4+
flow-typed/
5+
.flowconfig
6+
yarn.lock
7+
webpack.config.js
8+
__test__
9+
__snapshots__
10+
*.test.es6.js
11+
styleguide/
12+
styleguide.config.js
13+
styleguide.md
14+
*.example.md

.yarnrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
save-prefix ""

components/BaseComponent.es6.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* @flow */
2+
import React from 'react'
3+
import { pick, isEqual } from 'lodash'
4+
5+
class BaseComponent<P: Object, S: ?Object = void> extends React.Component<P, S> {
6+
propsToTrack: Array<string> = []
7+
8+
shouldComponentUpdate (nextProps: P, nextState: S) {
9+
if (this.propsToTrack.length === 0) {
10+
return true
11+
}
12+
13+
const before = pick(this.props, this.propsToTrack)
14+
const after = pick(nextProps, this.propsToTrack)
15+
16+
return !isEqual(before, after) || !isEqual(this.state, nextState)
17+
}
18+
}
19+
20+
export default BaseComponent

0 commit comments

Comments
 (0)