Skip to content
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

Merged
merged 2 commits into from
Feb 13, 2017
Merged

Fix eslint errors/warnings #199

merged 2 commits into from
Feb 13, 2017

Conversation

rajpatel507
Copy link
Contributor

Fix all eslint warnings and errors.

Copy link
Member

@frenzzy frenzzy left a 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:

@@ -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
Copy link
Member

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,

),
to,
href,
...other,
},
children
children // eslint-disable-line comma-dangle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

children,

@@ -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
Copy link
Member

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
Copy link
Member

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

@@ -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
Copy link
Member

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,

<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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what the problem here?

@frenzzy frenzzy mentioned this pull request Feb 2, 2017
@rajpatel507
Copy link
Contributor Author

rajpatel507 commented Feb 6, 2017

committed feedback points

@koistya koistya merged commit 88341b3 into kriasoft:master Feb 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants