Skip to content

Commit

Permalink
Merge pull request #2882 from HSLdevcom/no-console
Browse files Browse the repository at this point in the history
Throw eslint error from using console commands
  • Loading branch information
Antiik91 authored Jul 26, 2019
2 parents 8ffcfdd + 5e0ffd3 commit 5318711
Show file tree
Hide file tree
Showing 19 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
'lines-between-class-members': 'warn',
'no-else-return': 'warn',
'no-plusplus': ['error', { "allowForLoopAfterthoughts": true }],

'no-console': 'error',
// react
'react/button-has-type': 'warn',
'react/destructuring-assignment': 'warn',
Expand Down
2 changes: 1 addition & 1 deletion app/action/PositionActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function watchPosition(actionContext) {
}
actionContext.dispatch('GeolocationNotSupported');
updateGeolocationMessage(actionContext, 'failed');
console.error(error);
console.error(error); // eslint-disable-line no-console
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/component/AdminPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AdminPage extends React.Component {
});
},
err => {
console.log(err);
console.log(err); // eslint-disable-line no-console
this.setState({ loading: false });
},
);
Expand Down
3 changes: 1 addition & 2 deletions app/component/MessageBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,8 @@ class MessageBar extends Component {
) {
return true;
}
/* eslint-disable no-console */
// eslint-disable-next-line no-console
console.error(`Message ${el.id} has no translation for ${lang}`);
/* eslint-enable no-console */
return false;
});
};
Expand Down
2 changes: 1 addition & 1 deletion app/component/TripLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function TripLink(props) {
</Link>
);
}

// eslint-disable-next-line no-console
console.warn('Unable to match trip', props);
return <span className="route-now-content">{icon}</span>;
}
Expand Down
1 change: 1 addition & 0 deletions app/component/map/popups/TicketSalesPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function getIcon(type) {
case 'R-kioski':
return 'icon-icon_ticket-sales-point';
default:
// eslint-disable-next-line no-console
console.log(`Unknown ticket sales type: ${type}`);
return 'icon-icon_ticket-sales-point';
}
Expand Down
2 changes: 1 addition & 1 deletion app/component/map/tile-layer/CityBikes.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class CityBikes {

this.features.forEach(actionFn);
},
err => console.log(err),
err => console.log(err), // eslint-disable-line no-console
);
});

Expand Down
2 changes: 1 addition & 1 deletion app/component/map/tile-layer/ParkAndRide.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default class ParkAndRide {
}
}
},
err => console.log(err),
err => console.log(err), // eslint-disable-line no-console
);
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/component/map/tile-layer/Stops.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class Stops {
}
}
},
err => console.log(err),
err => console.log(err), // eslint-disable-line no-console
);
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/component/map/tile-layer/TicketSales.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default class TicketSales {
}
}
},
err => console.log(err),
err => console.log(err), // eslint-disable-line no-console
);
});
}
Expand Down
1 change: 1 addition & 0 deletions app/localStorageHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const getLocationListener = () => event => {
PUSH(event);
break;
default:
// eslint-disable-next-line no-console
console.error('unhandled history event:', event);
}
if (this && this[event.action] !== undefined) {
Expand Down
1 change: 1 addition & 0 deletions app/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ export default function(req, res, next) {
return [content, relayData];
})
.catch(err => {
// eslint-disable-next-line no-console
console.log(err);
return ['', undefined];
});
Expand Down
1 change: 1 addition & 0 deletions app/store/localStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function setItem(key, value) {
localStorage.setItem(key, JSON.stringify(value));
} catch (error) {
if (error.name === 'QuotaExceededError') {
// eslint-disable-next-line no-console
console.log(
'[localStorage]' + // eslint-disable-line no-console
' Unable to save state; localStorage is not available in Safari private mode',
Expand Down
1 change: 1 addition & 0 deletions app/store/sessionStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function setItem(key, value) {
sessionStorage.setItem(key, JSON.stringify(value));
} catch (error) {
if (error.name === 'QuotaExceededError') {
// eslint-disable-next-line no-console
console.log(
'[sessionStorage]' + // eslint-disable-line no-console
' Unable to save state; sessionStorage is not available in Safari private mode',
Expand Down
2 changes: 1 addition & 1 deletion build/generate-schema.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable import/no-extraneous-dependencies, no-console */

const fs = require('fs');
const { introspectionQuery } = require('graphql/utilities/introspectionQuery');
Expand Down
1 change: 1 addition & 0 deletions server/proxyTester.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
const express = require('express');
const proxy = require('express-http-proxy');

Expand Down
1 change: 1 addition & 0 deletions test/flow/custom_commands/debug.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
exports.command = function debug(...args) {
try {
this.perform(() => {
Expand Down
1 change: 1 addition & 0 deletions test/unit/helpers/init.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import { expect } from 'chai';
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Expand Down
2 changes: 1 addition & 1 deletion test/visual/components.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global gemini */

/* eslint-disable no-console */
/**
* Customizable test function
* @componentName the component name to test
Expand Down

0 comments on commit 5318711

Please sign in to comment.