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

chore: fix eslint no-undef #1462

Merged
merged 3 commits into from
Jan 13, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module.exports = {
// start with google standard style
// https://github.com/google/eslint-config-google/blob/master/index.js
"extends": "google",
"extends": ["eslint:recommended", "google"],
"env": {
"node": true
"node": true,
"es6": true
},
"rules": {
// 2 == error, 1 == warning, 0 == off
Expand All @@ -16,6 +17,9 @@ module.exports = {
"ignoreUrls": true,
"tabWidth": 2
}],
"no-empty": [2, {
"allowEmptyCatch": true
}],
"no-implicit-coercion": [2, {
"boolean": false,
"number": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

/* global window, document, location */
/* global window, document, location, fetch */

'use strict';

Expand Down
2 changes: 2 additions & 0 deletions lighthouse-cli/test/fixtures/static-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
'use strict';

/* eslint-disable no-console */

const http = require('http');
const path = require('path');
const fs = require('fs');
Expand Down
2 changes: 2 additions & 0 deletions lighthouse-cli/test/smokehouse/smokehouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
*/
'use strict';

/* eslint-disable no-console */

const path = require('path');
const spawnSync = require('child_process').spawnSync;
const yargs = require('yargs');
Expand Down
1 change: 1 addition & 0 deletions lighthouse-core/gather/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,7 @@ class Driver {
* @return {function(...*): *} A wrapper around the original function.
*/
function captureJSCallUsage(funcRef, set) {
/* global window */
const __nativeError = window.__nativeError || Error;
const originalFunc = funcRef;
const originalPrepareStackTrace = __nativeError.prepareStackTrace;
Expand Down
2 changes: 2 additions & 0 deletions lighthouse-core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

'use strict';

/* eslint-disable no-console */
Copy link
Member

Choose a reason for hiding this comment

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

maybe just // eslint-disable-next-line no-console for just the one line in this file too?


const environment = require('../lighthouse-core/lib/environment');
if (!environment.checkNodeCompatibility()) {
console.warn('Compatibility error', 'Lighthouse requires node 5+ or 4 with --harmony');
Expand Down
2 changes: 2 additions & 0 deletions lighthouse-core/lib/console-quieter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

'use strict';

/* eslint-disable no-console */

const log = require('./log.js');

class ConsoleQuieter {
Expand Down
2 changes: 2 additions & 0 deletions lighthouse-core/scripts/build-traceviewer-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
*/
'use strict';

/* eslint-disable no-console */

const fs = require('fs');
const path = require('path');
const jsdom = require('jsdom');
Expand Down
2 changes: 2 additions & 0 deletions lighthouse-extension/app/src/chromereload.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

'use strict';

/* eslint-disable no-console */

// Reload client for Chrome Apps & Extensions.
// The reload client has a compatibility with livereload.
// WARNING: only supports reload command.
Expand Down
2 changes: 2 additions & 0 deletions lighthouse-extension/app/src/lighthouse-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
'use strict';

/* eslint-disable no-console */
Copy link
Member

Choose a reason for hiding this comment

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

since there's only one console.log in here for a specific reason, but it's mostly a log.*() file, does it make sense to limit to // eslint-disable-next-line no-console over line 285?


const ExtensionProtocol = require('../../../lighthouse-core/gather/connections/extension');
const RawProtocol = require('../../../lighthouse-core/gather/connections/raw');
const Runner = require('../../../lighthouse-core/runner');
Expand Down
6 changes: 4 additions & 2 deletions lighthouse-viewer/app/src/lighthouse-report-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,11 +370,12 @@ class LighthouseViewerReport {
case 'print':
window.print();
break;
case 'save-json':
case 'save-json': {
const jsonStr = JSON.stringify(this.json, null, 2);
this._saveFile(new Blob([jsonStr], {type: 'application/json'}));
break;
case 'save-html':
}
case 'save-html': {
const reportGenerator = new ReportGenerator();
try {
const htmlStr = reportGenerator.generateHTML(this.json, 'cli');
Expand All @@ -383,6 +384,7 @@ class LighthouseViewerReport {
logger.error('Could not export as HTML.');
}
break;
}
}

this.closeExportDropdown();
Expand Down
2 changes: 2 additions & 0 deletions lighthouse-viewer/app/src/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

'use strict';

/* eslint-disable no-console */

/**
* Logs messages via a UI butter.
* @class
Expand Down