Skip to content

Commit 0eb0110

Browse files
authored
Merge pull request #104 from jxom/create-script-for-checks-in-ci
Added fbjs eslint config, fixed lint errors and warnings
2 parents db1262d + 4b155a2 commit 0eb0110

File tree

8 files changed

+151
-111
lines changed

8 files changed

+151
-111
lines changed

.eslintrc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
{
22
"extends": [
3-
"eslint:recommended",
4-
"plugin:react/recommended"
3+
"fbjs"
54
],
65
"plugins": [
76
"prettier",
87
"react"
98
],
109
"parser": "babel-eslint",
10+
"rules": {
11+
"relay/graphql-naming": 0,
12+
"max-len": 0
13+
},
1114
"env": {
1215
"node": true,
1316
"browser": true

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
"array-from": "^2.1.1",
1717
"babel-eslint": "^8.0.1",
1818
"eslint": "^4.8.0",
19+
"eslint-config-fbjs": "^2.0.0",
1920
"eslint-config-react": "^1.1.7",
20-
"eslint-plugin-flowtype": "^2.37.0",
21+
"eslint-plugin-babel": "^4.1.2",
22+
"eslint-plugin-flowtype": "^2.39.1",
23+
"eslint-plugin-jsx-a11y": "^6.0.2",
2124
"eslint-plugin-prettier": "^2.3.1",
2225
"eslint-plugin-react": "^7.4.0",
26+
"eslint-plugin-relay": "^0.0.19",
2327
"flow-bin": "^0.56.0",
2428
"gatsby": "^1.9.9",
2529
"gatsby-link": "^1.6.9",

src/components/StickyResponsiveSidebar/StickyResponsiveSidebar.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ class StickyResponsiveSidebar extends Component {
147147
boxShadow: '0 0 20px rgba(0, 0, 0, 0.3)',
148148
[media.lessThan('small')]: smallScreenBottomBarStyles,
149149
}}
150-
onClick={this._openNavMenu}>
150+
onClick={this._openNavMenu}
151+
role="button"
152+
tabIndex={0}>
151153
<Container>
152154
<div
153155
css={{

src/html.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if (process.env.NODE_ENV === `production`) {
1616
try {
1717
stylesStr = require(`!raw-loader!../public/styles.css`);
1818
} catch (e) {
19-
console.log(e);
19+
console.error(e);
2020
}
2121
}
2222

src/templates/components/MetaTitle/index.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,10 @@
1212
import React from 'react';
1313
import {colors} from 'theme';
1414

15-
const MetaTitle = ({
16-
children,
17-
title,
18-
cssProps = {},
19-
onClick,
20-
onDark = false,
21-
}) => (
15+
const MetaTitle = ({children, title, cssProps = {}, onDark = false}) => (
2216
<div
23-
onClick={onClick}
2417
css={{
2518
color: onDark ? colors.subtleOnDark : colors.subtle,
26-
cursor: onClick ? 'pointer' : null,
2719
fontSize: 14,
2820
fontWeight: 700,
2921
lineHeight: 3,

src/templates/components/Sidebar/Section.js

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
'use strict';
1111

12+
import React from 'react';
1213
import {colors, media} from 'theme';
1314
import isItemActive from 'utils/isItemActive';
1415
import MetaTitle from '../MetaTitle';
@@ -25,32 +26,35 @@ const Section = ({
2526
section,
2627
}) => (
2728
<div>
28-
<MetaTitle
29-
onClick={onSectionTitleClick}
30-
cssProps={{
31-
marginTop: 10,
29+
<button
30+
css={{cursor: 'pointer', backgroundColor: 'transparent', border: 0}}
31+
onClick={onSectionTitleClick}>
32+
<MetaTitle
33+
cssProps={{
34+
marginTop: 10,
3235

33-
[media.greaterThan('small')]: {
34-
color: isActive ? colors.text : colors.subtle,
36+
[media.greaterThan('small')]: {
37+
color: isActive ? colors.text : colors.subtle,
3538

36-
':hover': {
37-
color: colors.text,
39+
':hover': {
40+
color: colors.text,
41+
},
3842
},
39-
},
40-
}}>
41-
{section.title}
42-
<ChevronSvg
43-
cssProps={{
44-
marginLeft: 7,
45-
transform: isActive ? 'rotateX(180deg)' : 'rotateX(0deg)',
46-
transition: 'transform 0.2s ease',
43+
}}>
44+
{section.title}
45+
<ChevronSvg
46+
cssProps={{
47+
marginLeft: 7,
48+
transform: isActive ? 'rotateX(180deg)' : 'rotateX(0deg)',
49+
transition: 'transform 0.2s ease',
4750

48-
[media.lessThan('small')]: {
49-
display: 'none',
50-
},
51-
}}
52-
/>
53-
</MetaTitle>
51+
[media.lessThan('small')]: {
52+
display: 'none',
53+
},
54+
}}
55+
/>
56+
</MetaTitle>
57+
</button>
5458
<ul
5559
css={{
5660
marginBottom: 10,

src/utils/isItemActive.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ const isItemActive = (location, item) => {
2626
}
2727
} else if (item.id.includes('html')) {
2828
return location.pathname.includes(item.id);
29-
} else {
30-
const slugId = location.pathname.split('/').slice(-1)[0];
31-
return slugId === slugify(item.id);
3229
}
30+
const slugId = location.pathname.split('/').slice(-1)[0];
31+
return slugId === slugify(item.id);
3332
};
3433

3534
export default isItemActive;

0 commit comments

Comments
 (0)