Skip to content

Commit

Permalink
fix(eslint): Enable trailing commas rule in ESLint, fix all errors (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kdzwinel authored and brendankenny committed Sep 20, 2017
1 parent f2b3fb8 commit c780dfa
Show file tree
Hide file tree
Showing 292 changed files with 1,688 additions and 1,681 deletions.
8 changes: 7 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ module.exports = {
"strict": [2, "global"],
"prefer-const": 2,
"curly": [2, "multi-line"],
"comma-dangle": [2, {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "never",
"exports": "never",
"functions": "never"
}],

// Disabled rules
"require-jsdoc": 0,
"valid-jsdoc": 0,
"comma-dangle": 0,
"arrow-parens": 0,
},
"parserOptions": {
Expand Down
12 changes: 6 additions & 6 deletions docs/recipes/custom-audit/custom-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ module.exports = {
passes: [{
passName: 'defaultPass',
gatherers: [
'searchable-gatherer'
'searchable-gatherer',
],
}],

// 3. Add custom audit to the list of audits 'lighthouse:default' will run.
audits: [
'searchable-audit'
'searchable-audit',
],

// 4. Create a new 'My site metrics' section in the default report for our results.
Expand All @@ -29,8 +29,8 @@ module.exports = {
description: 'Metrics for our super awesome site',
audits: [
// When we add more custom audits, `weight` controls how they're averaged together.
{id: 'searchable-audit', weight: 1}
]
}
}
{id: 'searchable-audit', weight: 1},
],
},
},
};
4 changes: 2 additions & 2 deletions docs/recipes/custom-audit/searchable-audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LoadAudit extends Audit {
' box is initialized and ready to search.',

// The name of the custom gatherer class that provides input to this audit.
requiredArtifacts: ['TimeToSearchable']
requiredArtifacts: ['TimeToSearchable'],
};
}

Expand All @@ -38,7 +38,7 @@ class LoadAudit extends Audit {

return {
rawValue: loadMetrics.searchableTime,
score: belowThreshold
score: belowThreshold,
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/recipes/gulp/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const PORT = 8080;
const startServer = function() {
return connect.server({
root: './public',
port: PORT
port: PORT,
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class ConfigPanel {
_rerunLighthouse() {
this.log('Start Rerunning Lighthouse');
const options = {
blockedUrlPatterns: this.getBlockedUrlPatterns()
blockedUrlPatterns: this.getBlockedUrlPatterns(),
};

const xhr = new XMLHttpRequest();
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-cli/performance-experiment/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,5 @@ class HTTPError extends Error {
}

module.exports = {
hostExperiment
hostExperiment,
};
36 changes: 18 additions & 18 deletions lighthouse-cli/test/cli/performance-experiment/database-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,34 @@ describe.skip('Perf-X Database', function() {
{
flags: {
'blockedUrlPatterns': ['.woff2', '.jpg'],
'disableNetworkThrottling': false
'disableNetworkThrottling': false,
},
results: sampleResults
results: sampleResults,
},
{
flags: {
'blockedUrlPatterns': ['.woff'],
'disableCpuThrottling': true,
'deepReference': {'anObject': {'anArray': ['anElement', 'anotherElement']}}
'deepReference': {'anObject': {'anArray': ['anElement', 'anotherElement']}},
},
results: {
generatedTime: new Date(2015, 6, 27, 0, 12, 55, 60).toJSON(),
url: 'http://google.com/',
else: 'someData'
}
else: 'someData',
},
},
{
flags: {
'blockedUrlPatterns': ['.woff', 'cat.jpg', '*'],
'disableCpuThrottling': false,
'disableDeviceEmulation': true
'disableDeviceEmulation': true,
},
results: {
'generatedTime': new Date(2014, 5, 1, 23, 56, 54, 99).toJSON(),
'url': 'http://mdn.com/',
'audits': [{'is-on-https': {'score': true}}],
}
}
},
},
];

dataSets.forEach(dataSet => {
Expand All @@ -67,7 +67,7 @@ describe.skip('Perf-X Database', function() {
const flags = {
'blockedUrlPatterns': ['.woff', '.jpg', 'random'],
'disableCpuThrottling': false,
'randomFlag': 'randomString'
'randomFlag': 'randomString',
};
const results = JSON.parse(JSON.stringify(sampleResults));

Expand All @@ -90,20 +90,20 @@ describe.skip('Perf-X Database', function() {
it('returns correct timestamps', () => {
const dataSets = [
{
results: sampleResults
results: sampleResults,
},
{
results: {
generatedTime: new Date(2015, 6, 12, 0, 6, 30, 60).toJSON(),
url: 'http://google.com/',
}
},
},
{
results: {
'generatedTime': new Date(2014, 2, 21, 11, 12, 33, 46).toJSON(),
'url': 'http://mdn.com/',
}
}
},
},
];

dataSets.forEach(dataSet => {
Expand All @@ -122,22 +122,22 @@ describe.skip('Perf-X Database', function() {
{
flags: {
'blockedUrlPatterns': ['.css', '.jpg'],
'disableDeviceEmulation': false
'disableDeviceEmulation': false,
},
results: sampleResults
results: sampleResults,
},
{
flags: {
'blockedUrlPatterns': ['.js', '*'],
'disableCpuThrottling': true,
'disableNetworkThrottling': true
'disableNetworkThrottling': true,
},
results: {
'generatedTime': new Date(2015, 7, 23, 23, 56, 54, 99).toJSON(),
'url': 'http://w3school.com/',
'audits': [{'is-on-https': {'score': true}}],
}
}
},
},
];

dataSets.forEach(dataSet => {
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-cli/test/cli/run-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const parseChromeFlags = require('../../run').parseChromeFlags;
const fastConfig = {
'extends': 'lighthouse:default',
'settings': {
'onlyAudits': ['viewport']
}
'onlyAudits': ['viewport'],
},
};

const getFlags = require('../../cli-flags').getFlags;
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-cli/test/fixtures/offline-ready-sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// A list of local resources we always want to be cached.
const PRECACHE_URLS = [
'./offline-ready.html',
'./offline-ready-sw.js'
'./offline-ready-sw.js',
];

// Names of the two caches used in this version of the service worker.
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-cli/test/smokehouse/byte-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ module.exports = {
'uses-responsive-images',
'unused-css-rules',
'unused-javascript',
]
}
],
},
};
44 changes: 22 additions & 22 deletions lighthouse-cli/test/smokehouse/byte-efficiency/expectations.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ module.exports = [
value: {
wastedKb: 39,
results: {
length: 2
}
}
}
length: 2,
},
},
},
},
'unused-javascript': {
score: '<100',
Expand All @@ -41,41 +41,41 @@ module.exports = [
extendedInfo: {
value: {
results: {
length: 3
}
}
}
length: 3,
},
},
},
},
'uses-webp-images': {
score: '<100',
extendedInfo: {
value: {
results: {
length: 4
}
}
}
length: 4,
},
},
},
},
'uses-optimized-images': {
score: '<100',
extendedInfo: {
value: {
results: {
length: 1
}
}
}
length: 1,
},
},
},
},
'uses-responsive-images': {
score: '<100',
extendedInfo: {
value: {
results: {
length: 3
}
}
}
}
}
length: 3,
},
},
},
},
},
},
];
6 changes: 3 additions & 3 deletions lighthouse-cli/test/smokehouse/dbw-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ module.exports = {
extends: 'lighthouse:default',
settings: {
onlyCategories: [
'best-practices'
'best-practices',
],
onlyAudits: [
'dom-size',
'link-blocking-first-paint',
'script-blocking-first-paint',
]
}
],
},
};
Loading

0 comments on commit c780dfa

Please sign in to comment.