-
-
Notifications
You must be signed in to change notification settings - Fork 753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix eslint errors/warnings #199
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Just few notes:
components/Button/Button.js
Outdated
@@ -55,13 +55,13 @@ class Button extends React.Component { | |||
'mdl-button--accent': accent, | |||
'mdl-js-ripple-effect': ripple, | |||
}, | |||
className | |||
className // eslint-disable-line comma-dangle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's just use trailing comma here instead of comment
className,
components/Button/Button.js
Outdated
), | ||
to, | ||
href, | ||
...other, | ||
}, | ||
children | ||
children // eslint-disable-line comma-dangle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
children,
components/Link/Link.js
Outdated
@@ -49,7 +49,7 @@ class Link extends React.Component { | |||
|
|||
render() { | |||
const { to, ...props } = this.props; // eslint-disable-line no-use-before-define | |||
return <a href={typeof to === 'string' ? to : history.createHref(to)} {...props} onClick={this.handleClick} />; | |||
return <a href={typeof to === 'string' ? to : history.createHref(to)} {...props} onClick={this.handleClick} />; // eslint-disable-line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using of eslint-disable-line
is not obvious what exactly rule you want to ignore. It is better to always specify rule name in comment:
let code; // eslint-disable-line rule-name
or
// eslint-disable-next-line rule-name
let loooooongLineOfCode;
if eslint here warns about max-len, let's split the code into two lines:
const href = typeof to === 'string' ? to : history.createHref(to);
return <a href={href} {...props} onClick={this.handleClick} />;
package.json
Outdated
"import/no-extraneous-dependencies": "off" | ||
}, | ||
"env": { | ||
"browser": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to remove two extra spaces here,
ident coding style for this project is 2 spaces
src/home/index.js
Outdated
@@ -16,7 +16,7 @@ import { title, html } from './index.md'; | |||
class HomePage extends React.Component { | |||
|
|||
static propTypes = { | |||
articles: PropTypes.array.isRequired, | |||
articles: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
articles: PropTypes.arrayOf(PropTypes.shape({
url: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
author: PropTypes.string.isRequired,
}).isRequired).isRequired,
src/home/index.js
Outdated
<h4>Articles</h4> | ||
<ul> | ||
{this.props.articles.map((article, i) => | ||
<li key={i}><a href={article.url}>{article.title}</a> by {article.author}</li> | ||
<li key={i}><a href={article.url}>{article.title}</a> by {article.author}</li> // eslint-disable-line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<li key={article.url}>
src/router.js
Outdated
@@ -49,11 +49,11 @@ function matchURI(route, path) { | |||
// Find the route matching the specified location (context), fetch the required data, | |||
// instantiate and return a React component | |||
function resolve(routes, context) { | |||
for (const route of routes) { | |||
for (const route of routes) { // eslint-disable-line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eslint-rule-name?
src/router.js
Outdated
const params = matchURI(route, context.error ? '/error' : context.pathname); | ||
|
||
if (!params) { | ||
continue; | ||
continue; // eslint-disable-line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
tools/routes-loader.js
Outdated
@@ -38,7 +38,7 @@ module.exports = function routesLoader(source) { | |||
const output = ['[\n']; | |||
const routes = JSON.parse(source); | |||
|
|||
for (const route of routes) { | |||
for (const route of routes) { // eslint-disable-line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
tools/routes-loader.js
Outdated
@@ -60,7 +60,7 @@ module.exports = function routesLoader(source) { | |||
if (route.data) { | |||
output.push(` data: ${JSON.stringify(route.data)},\n`); | |||
} | |||
output.push(` load() {\n return ${require(route.page)};\n },\n`); | |||
output.push(` load() {\n return ${require(route.page)};\n },\n`); // eslint-disable-line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what the problem here?
committed feedback points |
Fix all eslint warnings and errors.