Skip to content
Permalink
Browse files
Web Inspector: fix ESLint errors
https://bugs.webkit.org/show_bug.cgi?id=175065

Reviewed by Joseph Pecoraro.

Removed trailing whitespace, extra parenthesis, and some unnecessary escape characters.
Added missing semicolons, spacing around default values for parameters, and changed `==` to
`===` where applicable.

Specific changes to each file were removed for brevity.

* .eslintrc:
Alphabetize each list of global variables and add some missing utility functions.

* UserInterface/Base/EventListener.js:
* UserInterface/Base/EventListenerSet.js:
* UserInterface/Base/Main.js:
* UserInterface/Base/Setting.js:
* UserInterface/Base/TextUtilities.js:
* UserInterface/Base/URLUtilities.js:
* UserInterface/Base/Utilities.js:
* UserInterface/Base/YieldableTask.js:
* UserInterface/Controllers/AppControllerBase.js:
* UserInterface/Controllers/CanvasManager.js:
* UserInterface/Controllers/CodeMirrorCompletionController.js:
* UserInterface/Controllers/DOMDebuggerManager.js:
* UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js:
* UserInterface/Controllers/RuntimeManager.js:
* UserInterface/Controllers/SourceMapManager.js:
* UserInterface/Debug/DebugContentView.js:
* UserInterface/Debug/UncaughtExceptionReporter.js:
* UserInterface/Models/CSSKeywordCompletions.js:
* UserInterface/Models/DOMNode.js:
* UserInterface/Models/DOMNodeStyles.js:
* UserInterface/Models/KeyboardShortcut.js:
* UserInterface/Models/ProfileNode.js:
* UserInterface/Models/Resource.js:
* UserInterface/Models/ResourceCollection.js:
* UserInterface/Models/Script.js:
* UserInterface/Models/ScriptSyntaxTree.js:
* UserInterface/Models/ScriptTimelineRecord.js:
* UserInterface/Protocol/Connection.js:
* UserInterface/Test/FrontendTestHarness.js:
* UserInterface/Test/TestHarness.js:
* UserInterface/Views/CSSStyleDeclarationSection.js:
* UserInterface/Views/ChartDetailsSectionRow.js:
* UserInterface/Views/CodeMirrorAdditions.js:
* UserInterface/Views/CodeMirrorFormatters.js:
* UserInterface/Views/CodeMirrorRegexMode.js:
* UserInterface/Views/ContentBrowserTabContentView.js:
* UserInterface/Views/DataGrid.js:
* UserInterface/Views/DataGridNode.js:
* UserInterface/Views/FindBanner.js:
* UserInterface/Views/GroupNavigationItem.js:
* UserInterface/Views/HierarchicalPathNavigationItem.js:
* UserInterface/Views/NetworkTableContentView.js:
* UserInterface/Views/NetworkTimelineView.js:
* UserInterface/Views/ObjectTreePropertyTreeElement.js:
* UserInterface/Views/ObjectTreeView.js:
* UserInterface/Views/RecordingContentView.js:
* UserInterface/Views/RenderingFrameTimelineOverviewGraph.js:
* UserInterface/Views/ResourceCookiesContentView.js:
* UserInterface/Views/ResourceDetailsSection.js:
* UserInterface/Views/ResourceHeadersContentView.js:
* UserInterface/Views/ResourceTimelineDataGridNode.js:
* UserInterface/Views/SettingEditor.js:
* UserInterface/Views/Sidebar.js:
* UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
* UserInterface/Views/Table.js:
* UserInterface/Views/TextEditor.js:
* UserInterface/Views/TimelineDataGridNode.js:
* UserInterface/Views/TreeElement.js:
* UserInterface/Views/TreeOutline.js:
* UserInterface/Views/WebSocketDataGridNode.js:
* UserInterface/Workers/Formatter/EsprimaFormatter.js:
* UserInterface/Workers/Formatter/FormatterWorker.js:


Canonical link: https://commits.webkit.org/194515@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223308 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
dcrousso committed Oct 13, 2017
1 parent f402e39 commit 4abd69b35cfacc3a7899983af675bff3c8319c1d
Showing 64 changed files with 241 additions and 131 deletions.
@@ -28,7 +28,10 @@
"env": {
"browser": true,
"worker": true,
"ecmaVersion": 2017,
"es6": true,
},
"parserOptions": {
"ecmaVersion": 2018,
},
"globals": {
// Agents
@@ -54,6 +57,9 @@
"TimelineAgent": true,
"WorkerAgent": true,

// Namespace
"WI": true,

// WebInspector
"AsyncTestSuite": true,
"Formatter": true,
@@ -76,50 +82,82 @@

// Externals
"CodeMirror": true,
"THREE": true,
"esprima": true,

// Formatters
"ESTreeWalker": true,
"EsprimaFormatter": true,
"FormatterWorker": true,

// Heap Snapshot
"HeapSnapshot": true,
"HeapSnapshotDiff": true,
"HeapSnapshotWorker": true,

// DOM
"CSSPrimitiveValue": true,
"Exception": true,
"WebKitPoint": true,

// Utilities
"figureDash": true,
"appendWebInspectorConsoleEvaluationSourceURL": true,
"appendWebInspectorSourceURL": true,
"clamp": true,
"doubleQuotedString": true,
"ellipsis": true,
"emDash": true,
"enDash": true,
"clamp": true,
"isEnterKey": true,
"isEmptyObject": true,
"figureDash": true,
"handlePromiseException": true,
"insertionIndexForObjectInListSortedByFunction": true,
"insertObjectIntoSortedArray": true,
"isEmptyObject": true,
"isEnterKey": true,
"isFunctionStringNativeCode": true,
"parseMIMEType": true,
"doubleQuotedString": true,
"isWebKitInternalScript": true,
"isWebInspectorInternalScript": true,
"isTextLikelyMinified": true,
"isWebInspectorConsoleEvaluationScript": true,
"appendWebInspectorSourceURL": true,
"appendWebInspectorConsoleEvaluationSourceURL": true,
"isWebInspectorInternalScript": true,
"isWebKitInternalScript": true,
"multiplicationSign": true,
"parseMIMEType": true,
"resolveDotsInPath": true,
"simpleGlobStringToRegExp": true,
"timestamp": true,
"handlePromiseException": true,
"insertObjectIntoSortedArray": true,
"zeroWidthSpace": true,

// DOM Utilities
"createSVGElement": true,

// Image Utilities
"platformImagePath": true,
"wrappedSVGDocument": true,
"createSVGElement": true,
"useSVGSymbol": true,
"wrappedSVGDocument": true,

// URL Utilities
"absoluteURL": true,
"parseQueryString": true,
"parseURL": true,
"parseSecurityOrigin": true,
"removeURLFragment": true,
"decodeBase64ToBlob": true,
"relativePath": true,
"parseDataURL": true,
"parseLocationQueryParameters": true,
"parseQueryString": true,
"parseSecurityOrigin": true,
"parseURL": true,
"relativePath": true,
"removeURLFragment": true,

// Formatter Utilities
"isECMAScriptLineTerminator": true,
"isECMAScriptWhitespace": true,

// Debug
"handleInternalException": true,

// CodeMirror
"createCodeMirrorColorTextMarkers": true,
"createCodeMirrorCubicBezierTextMarkers": true,
"createCodeMirrorGradientTextMarkers": true,
"createCodeMirrorSpringTextMarkers": true,
"createCodeMirrorVariableTextMarkers": true,
},
"rules": {
"array-bracket-spacing": [2, "never"],
@@ -1,3 +1,82 @@
2017-10-13 Devin Rousso <webkit@devinrousso.com>

Web Inspector: fix ESLint errors
https://bugs.webkit.org/show_bug.cgi?id=175065

Reviewed by Joseph Pecoraro.

Removed trailing whitespace, extra parenthesis, and some unnecessary escape characters.
Added missing semicolons, spacing around default values for parameters, and changed `==` to
`===` where applicable.

Specific changes to each file were removed for brevity.

* .eslintrc:
Alphabetize each list of global variables and add some missing utility functions.

* UserInterface/Base/EventListener.js:
* UserInterface/Base/EventListenerSet.js:
* UserInterface/Base/Main.js:
* UserInterface/Base/Setting.js:
* UserInterface/Base/TextUtilities.js:
* UserInterface/Base/URLUtilities.js:
* UserInterface/Base/Utilities.js:
* UserInterface/Base/YieldableTask.js:
* UserInterface/Controllers/AppControllerBase.js:
* UserInterface/Controllers/CanvasManager.js:
* UserInterface/Controllers/CodeMirrorCompletionController.js:
* UserInterface/Controllers/DOMDebuggerManager.js:
* UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js:
* UserInterface/Controllers/RuntimeManager.js:
* UserInterface/Controllers/SourceMapManager.js:
* UserInterface/Debug/DebugContentView.js:
* UserInterface/Debug/UncaughtExceptionReporter.js:
* UserInterface/Models/CSSKeywordCompletions.js:
* UserInterface/Models/DOMNode.js:
* UserInterface/Models/DOMNodeStyles.js:
* UserInterface/Models/KeyboardShortcut.js:
* UserInterface/Models/ProfileNode.js:
* UserInterface/Models/Resource.js:
* UserInterface/Models/ResourceCollection.js:
* UserInterface/Models/Script.js:
* UserInterface/Models/ScriptSyntaxTree.js:
* UserInterface/Models/ScriptTimelineRecord.js:
* UserInterface/Protocol/Connection.js:
* UserInterface/Test/FrontendTestHarness.js:
* UserInterface/Test/TestHarness.js:
* UserInterface/Views/CSSStyleDeclarationSection.js:
* UserInterface/Views/ChartDetailsSectionRow.js:
* UserInterface/Views/CodeMirrorAdditions.js:
* UserInterface/Views/CodeMirrorFormatters.js:
* UserInterface/Views/CodeMirrorRegexMode.js:
* UserInterface/Views/ContentBrowserTabContentView.js:
* UserInterface/Views/DataGrid.js:
* UserInterface/Views/DataGridNode.js:
* UserInterface/Views/FindBanner.js:
* UserInterface/Views/GroupNavigationItem.js:
* UserInterface/Views/HierarchicalPathNavigationItem.js:
* UserInterface/Views/NetworkTableContentView.js:
* UserInterface/Views/NetworkTimelineView.js:
* UserInterface/Views/ObjectTreePropertyTreeElement.js:
* UserInterface/Views/ObjectTreeView.js:
* UserInterface/Views/RecordingContentView.js:
* UserInterface/Views/RenderingFrameTimelineOverviewGraph.js:
* UserInterface/Views/ResourceCookiesContentView.js:
* UserInterface/Views/ResourceDetailsSection.js:
* UserInterface/Views/ResourceHeadersContentView.js:
* UserInterface/Views/ResourceTimelineDataGridNode.js:
* UserInterface/Views/SettingEditor.js:
* UserInterface/Views/Sidebar.js:
* UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
* UserInterface/Views/Table.js:
* UserInterface/Views/TextEditor.js:
* UserInterface/Views/TimelineDataGridNode.js:
* UserInterface/Views/TreeElement.js:
* UserInterface/Views/TreeOutline.js:
* UserInterface/Views/WebSocketDataGridNode.js:
* UserInterface/Workers/Formatter/EsprimaFormatter.js:
* UserInterface/Workers/Formatter/FormatterWorker.js:

2017-10-13 Nikita Vasilyev <nvasilyev@apple.com>

Web Inspector: Styles Redesign: hook up autocompletion to property names and values
@@ -40,7 +40,7 @@ WI.EventListener = class EventListener
{
console.assert(!this._emitter && !this._callback, "EventListener already bound to a callback.", this);
console.assert(emitter, `Missing event emitter for event: ${type}.`);
console.assert(type, `Missing event type.`);
console.assert(type, "Missing event type.");
console.assert(callback, `Missing callback for event: ${type}.`);
var emitterIsValid = emitter && (emitter instanceof WI.Object || emitter instanceof Node || (typeof emitter.addEventListener === "function"));
console.assert(emitterIsValid, "Event emitter ", emitter, ` (type: ${type}) is null or does not implement Node or WI.Object.`);
@@ -45,7 +45,7 @@ WI.EventListenerSet = class EventListenerSet
register(emitter, type, callback, thisObject, usesCapture)
{
console.assert(emitter, `Missing event emitter for event: ${type}.`);
console.assert(type, `Missing event type.`);
console.assert(type, "Missing event type.");
console.assert(callback, `Missing callback for event: ${type}.`);
var emitterIsValid = emitter && (emitter instanceof WI.Object || emitter instanceof Node || (typeof emitter.addEventListener === "function"));
console.assert(emitterIsValid, "Event emitter ", emitter, ` (type: ${type}) is null or does not implement Node or WI.Object.`);
@@ -375,7 +375,6 @@ WI.contentLoaded = function()
reloadToolTip = WI.UIString("Restart (%s)").format(this._reloadPageKeyboardShortcut.displayName);
else
reloadToolTip = WI.UIString("Reload page (%s)\nReload page ignoring cache (%s)").format(this._reloadPageKeyboardShortcut.displayName, this._reloadPageFromOriginKeyboardShortcut.displayName);

this._reloadToolbarButton = new WI.ButtonToolbarItem("reload", reloadToolTip, "Images/ReloadToolbar.svg");
this._reloadToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._reloadToolbarButtonClicked, this);

@@ -720,7 +719,7 @@ WI.updateWindowTitle = function()
var lastPathComponent;
try {
lastPathComponent = decodeURIComponent(urlComponents.lastPathComponent || "");
} catch (e) {
} catch {
lastPathComponent = urlComponents.lastPathComponent;
}

@@ -992,8 +991,8 @@ WI.showNetworkTab = function()
let tabContentView;
if (WI.settings.experimentalEnableNewNetworkTab.value) {
tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.NetworkTabContentView);
if (!tabBrowser)
tabBrowser = new WI.NetworkTabContentView;
if (!tabContentView)
tabContentView = new WI.NetworkTabContentView;
} else {
tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.LegacyNetworkTabContentView);
if (!tabContentView)
@@ -1865,7 +1864,7 @@ WI._updateInspectModeToolbarButton = function()
}

this._inspectModeToolbarButton.hidden = false;
}
};

WI._toggleInspectMode = function(event)
{
@@ -2030,7 +2029,7 @@ WI._populateFind = function(event)
return;

contentBrowser.handlePopulateFindShortcut();
}
};

WI._findNext = function(event)
{
@@ -2048,7 +2047,7 @@ WI._findNext = function(event)
return;

contentBrowser.handleFindNextShortcut();
}
};

WI._findPrevious = function(event)
{
@@ -2066,7 +2065,7 @@ WI._findPrevious = function(event)
return;

contentBrowser.handleFindPreviousShortcut();
}
};

WI._copy = function(event)
{
@@ -2207,7 +2206,7 @@ WI._enableControlFlowProfilerSettingChanged = function(event)
WI._resourceCachingDisabledSettingChanged = function(event)
{
NetworkAgent.setResourceCachingDisabled(this.resourceCachingDisabledSetting.value);
}
};

WI.elementDragStart = function(element, dividerDrag, elementDragEnd, event, cursor, eventTarget)
{
@@ -2359,7 +2358,7 @@ WI.linkifyURLAsNode = function(url, linkText, classes)
if (!linkText)
linkText = url;

classes = (classes ? classes + " " : "");
classes = classes ? classes + " " : "";

var a = document.createElement("a");
a.href = url;
@@ -2634,13 +2633,13 @@ WI._sharedWindowKeydownListener = function(event)
}
};

WI.reportInternalError = function(errorOrString, details={})
WI.reportInternalError = function(errorOrString, details = {})
{
// The 'details' object includes additional information from the caller as free-form string keys and values.
// Each key and value will be shown in the uncaught exception reporter, console error message, or in
// a pre-filled bug report generated for this internal error.

let error = (errorOrString instanceof Error) ? errorOrString : new Error(errorOrString);
let error = errorOrString instanceof Error ? errorOrString : new Error(errorOrString);
error.details = details;

// The error will be displayed in the Uncaught Exception Reporter sheet if DebugUI is enabled.
@@ -61,7 +61,7 @@ WI.Setting = class Setting extends WI.Object
if (!window.InspectorTest && window.localStorage && this._localStorageKey in window.localStorage) {
try {
this._value = JSON.parse(window.localStorage[this._localStorageKey]);
} catch (e) {
} catch {
delete window.localStorage[this._localStorageKey];
}
}
@@ -83,7 +83,7 @@ WI.Setting = class Setting extends WI.Object
delete window.localStorage[this._localStorageKey];
else
window.localStorage[this._localStorageKey] = JSON.stringify(this._value);
} catch (e) {
} catch {
console.error("Error saving setting with name: " + this._name);
}
}
@@ -40,7 +40,7 @@ WI.rangeForNextCSSNameOrValue = function(text, index = 0) {

// Don't select leading/trailing whitespace.
from += substring.match(/^\s*/)[0].length;
to -= substring.match(/[\s\;]*$/)[0].length;
to -= substring.match(/[\s;]*$/)[0].length;

return {from, to};
};
@@ -202,7 +202,7 @@ function parseQueryString(queryString, arrayResult)
try {
// Replace "+" with " " then decode percent encoded values.
return decodeURIComponent(string.replace(/\+/g, " "));
} catch (e) {
} catch {
return string;
}
}
@@ -231,7 +231,7 @@ WI.displayNameForURL = function(url, urlComponents)
var displayName;
try {
displayName = decodeURIComponent(urlComponents.lastPathComponent || "");
} catch (e) {
} catch {
displayName = urlComponents.lastPathComponent;
}

0 comments on commit 4abd69b

Please sign in to comment.