Browse Source

Added fbjs eslint config, fixed lint errors and warnings

main
jxom 7 years ago
parent
commit
de3bd87f4b
  1. 7
      .eslintrc
  2. 6
      package.json
  3. 4
      src/components/StickyResponsiveSidebar/StickyResponsiveSidebar.js
  4. 2
      src/html.js
  5. 4
      src/templates/components/MetaTitle/index.js
  6. 1
      src/templates/components/Sidebar/Section.js
  7. 3
      src/utils/isItemActive.js

7
.eslintrc

@ -1,13 +1,16 @@
{
"extends": [
"eslint:recommended",
"plugin:react/recommended"
"fbjs"
],
"plugins": [
"prettier",
"react"
],
"parser": "babel-eslint",
"rules": {
"relay/graphql-naming": 0,
"max-len": 0
},
"env": {
"node": true,
"browser": true

6
package.json

@ -16,10 +16,14 @@
"array-from": "^2.1.1",
"babel-eslint": "^8.0.1",
"eslint": "^4.8.0",
"eslint-config-fbjs": "^2.0.0",
"eslint-config-react": "^1.1.7",
"eslint-plugin-flowtype": "^2.37.0",
"eslint-plugin-babel": "^4.1.2",
"eslint-plugin-flowtype": "^2.39.1",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-prettier": "^2.3.1",
"eslint-plugin-react": "^7.4.0",
"eslint-plugin-relay": "^0.0.19",
"flow-bin": "^0.56.0",
"gatsby": "^1.9.9",
"gatsby-link": "^1.6.9",

4
src/components/StickyResponsiveSidebar/StickyResponsiveSidebar.js

@ -147,7 +147,9 @@ class StickyResponsiveSidebar extends Component {
boxShadow: '0 0 20px rgba(0, 0, 0, 0.3)',
[media.lessThan('small')]: smallScreenBottomBarStyles,
}}
onClick={this._openNavMenu}>
onClick={this._openNavMenu}
role="button"
tabIndex="-1">
<Container>
<div
css={{

2
src/html.js

@ -16,7 +16,7 @@ if (process.env.NODE_ENV === `production`) {
try {
stylesStr = require(`!raw-loader!../public/styles.css`);
} catch (e) {
console.log(e);
console.error(e);
}
}

4
src/templates/components/MetaTitle/index.js

@ -30,7 +30,9 @@ const MetaTitle = ({
textTransform: 'uppercase',
letterSpacing: '0.08em',
...cssProps,
}}>
}}
role="link"
tabIndex="-1">
{children}
</div>
);

1
src/templates/components/Sidebar/Section.js

@ -9,6 +9,7 @@
'use strict';
import React from 'react';
import {colors, media} from 'theme';
import isItemActive from 'utils/isItemActive';
import MetaTitle from '../MetaTitle';

3
src/utils/isItemActive.js

@ -26,10 +26,9 @@ const isItemActive = (location, item) => {
}
} else if (item.id.includes('html')) {
return location.pathname.includes(item.id);
} else {
}
const slugId = location.pathname.split('/').slice(-1)[0];
return slugId === slugify(item.id);
}
};
export default isItemActive;

Loading…
Cancel
Save