Skip to content

Commit 6643759

Browse files
committed
chore(lint): add eslint
1 parent 9f0472e commit 6643759

File tree

6 files changed

+824
-56
lines changed

6 files changed

+824
-56
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lib/
2+
node_modules

.eslintrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "@workpop/eslint-config-workpop",
3+
"rules": {
4+
"react/jsx-filename-extension": 0,
5+
"react/prop-types": 0,
6+
"import/no-extraneous-dependencies": 0,
7+
"import/no-unresolved": 0,
8+
"import/extensions": 0
9+
}
10+
}

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"scripts": {
1414
"build": "rollup -c rollup.config.js",
1515
"prepublish": "npm run build",
16-
"release": "standard-version"
16+
"release": "standard-version",
17+
"lint:fix": "eslint . --fix"
1718
},
1819
"bundlesize": [
1920
{
@@ -31,6 +32,8 @@
3132
"react"
3233
],
3334
"devDependencies": {
35+
"@workpop/eslint-config-workpop": "^1.0.0",
36+
"eslint": "^3.3.1",
3437
"babel-plugin-transform-export-extensions": "^6.22.0",
3538
"babel-plugin-transform-object-rest-spread": "^6.26.0",
3639
"babel-preset-env": "^1.6.1",

rollup.config.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
1-
import babel from "rollup-plugin-babel";
1+
import babel from 'rollup-plugin-babel';
22
import minify from 'rollup-plugin-babel-minify';
33

44
export default [
55
{
6-
input: "src/index.js",
6+
input: 'src/index.js',
77
output: {
8-
file: "lib/umd/recompose-apollo.js",
9-
format: "umd",
10-
name: "recompose-apollo",
11-
sourcemap: true
8+
file: 'lib/umd/recompose-apollo.js',
9+
format: 'umd',
10+
name: 'recompose-apollo',
11+
sourcemap: true,
1212
},
1313
plugins: [
1414
minify(),
1515
babel({
16-
exclude: "node_modules/**"
17-
})
16+
exclude: 'node_modules/**',
17+
}),
1818
],
19-
onwarn
19+
onwarn,
2020
},
2121
{
22-
input: "src/index.js",
22+
input: 'src/index.js',
2323
output: {
24-
file: "lib/index.js",
25-
format: "cjs",
26-
sourcemap: true
24+
file: 'lib/index.js',
25+
format: 'cjs',
26+
sourcemap: true,
2727
},
2828
plugins: [
2929
minify(),
3030
babel({
31-
exclude: "node_modules/**"
32-
})
31+
exclude: 'node_modules/**',
32+
}),
3333
],
34-
onwarn
34+
onwarn,
3535
},
3636
{
37-
input: "src/index.js",
37+
input: 'src/index.js',
3838
output: {
39-
file: "lib/es/index.js",
40-
format: "es",
41-
sourcemap: true
39+
file: 'lib/es/index.js',
40+
format: 'es',
41+
sourcemap: true,
4242
},
4343
plugins: [
4444
minify(),
4545
babel({
46-
exclude: "node_modules/**"
47-
})
46+
exclude: 'node_modules/**',
47+
}),
4848
],
49-
onwarn
50-
}
49+
onwarn,
50+
},
5151
];
5252

5353
function onwarn(message) {
54-
const suppressed = ["UNRESOLVED_IMPORT", "THIS_IS_UNDEFINED"];
54+
const suppressed = ['UNRESOLVED_IMPORT', 'THIS_IS_UNDEFINED'];
5555

56-
if (!suppressed.find(code => message.code === code)) {
57-
return console.warn(message.message);
56+
if (!suppressed.find((code) => { return message.code === code; })) {
57+
return console.warn(message.message); // eslint-disable-line no-console
5858
}
5959
}

src/withLoadingState.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
1-
import { branch, renderComponent, withPropsOnChange } from "recompose";
1+
import { branch, renderComponent, withPropsOnChange } from 'recompose';
22

33
// Loading States
4-
const initialLoading = networkStatus => networkStatus === 1;
5-
const activelyRefetching = networkStatus => networkStatus === 4;
6-
const passivelyRefetching = networkStatus =>
7-
networkStatus === 2 || networkStatus === 6;
8-
const fetchingMore = networkStatus => networkStatus === 3;
4+
const initialLoading = (networkStatus) => { return networkStatus === 1; };
5+
const activelyRefetching = (networkStatus) => { return networkStatus === 4; };
6+
const passivelyRefetching = (networkStatus) => { return networkStatus === 2 || networkStatus === 6; };
7+
const fetchingMore = (networkStatus) => { return networkStatus === 3; };
98

109
// Error States
11-
const hasErrored = networkStatus => networkStatus === 8;
10+
const hasErrored = (networkStatus) => { return networkStatus === 8; };
1211

1312
export function withLoadingState(Component) {
1413
return branch(
1514
({ networkStatus }) => {
1615
return initialLoading(networkStatus);
1716
},
1817
renderComponent(Component),
19-
withPropsOnChange(["networkStatus"], ({ networkStatus }) => {
18+
withPropsOnChange(['networkStatus'], ({ networkStatus }) => {
2019
return {
2120
activelyRefetching: activelyRefetching(networkStatus),
2221
passivelyRefetching: passivelyRefetching(networkStatus),
23-
fetchingMore: fetchingMore(networkStatus)
22+
fetchingMore: fetchingMore(networkStatus),
2423
};
2524
})
2625
);

0 commit comments

Comments
 (0)