forked from mirrors/gecko-dev
Bug 1558485 - Turn on ESLint for all of dom/ disabling most of the failing rules. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D34761 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
c51c2a8807
commit
201255ab84
23 changed files with 216 additions and 71 deletions
|
|
@ -12,52 +12,13 @@
|
|||
obj*/**
|
||||
|
||||
# dom/ exclusions which should be removed (aka ESLint enabled)
|
||||
dom/animation/**
|
||||
dom/base/*.*
|
||||
dom/base/test/*.*
|
||||
dom/base/test/unit/test_serializers_entities*.js
|
||||
dom/base/test/unit_ipc/**
|
||||
dom/base/test/jsmodules/**
|
||||
dom/canvas/**
|
||||
dom/encoding/**
|
||||
dom/events/**
|
||||
dom/fetch/**
|
||||
dom/file/**
|
||||
dom/html/**
|
||||
dom/jsurl/**
|
||||
dom/media/test/**
|
||||
!dom/media/test/marionette/yttest/*.js
|
||||
dom/media/tests/**
|
||||
dom/media/webaudio/**
|
||||
dom/media/webspeech/**
|
||||
dom/messagechannel/**
|
||||
dom/midi/**
|
||||
dom/network/**
|
||||
dom/payments/**
|
||||
dom/performance/**
|
||||
dom/permission/**
|
||||
dom/promise/**
|
||||
dom/quota/**
|
||||
dom/security/test/cors/**
|
||||
dom/security/test/csp/**
|
||||
dom/security/test/general/**
|
||||
dom/security/test/mixedcontentblocker/**
|
||||
dom/security/test/sri/**
|
||||
dom/serviceworkers/**
|
||||
dom/smil/**
|
||||
dom/tests/mochitest/**
|
||||
dom/u2f/**
|
||||
dom/vr/**
|
||||
dom/webauthn/**
|
||||
dom/webgpu/**
|
||||
dom/websocket/**
|
||||
dom/workers/**
|
||||
dom/worklet/**
|
||||
dom/xbl/**
|
||||
dom/xhr/**
|
||||
dom/xml/**
|
||||
dom/xslt/**
|
||||
dom/xul/**
|
||||
|
||||
# build/ third-party code
|
||||
build/pgo/js-input/**
|
||||
|
|
@ -207,6 +168,26 @@ dom/media/webvtt/**
|
|||
dom/svg/test/test_nonAnimStrings.xhtml
|
||||
dom/svg/test/test_SVG_namespace_ids.html
|
||||
|
||||
# Strange encodings
|
||||
dom/encoding/test/test_utf16_files.html
|
||||
dom/encoding/test/file_utf16_be_bom.js
|
||||
dom/encoding/test/file_utf16_le_bom.js
|
||||
|
||||
# Not parsable
|
||||
dom/tests/mochitest/general/test_focusrings.xul
|
||||
dom/html/test/test_bug677658.html
|
||||
|
||||
# Intentional broken files
|
||||
dom/base/test/file_js_cache_syntax_error.js
|
||||
dom/media/tests/mochitest/identity/idp-bad.js
|
||||
dom/serviceworkers/test/file_js_cache_syntax_error.js
|
||||
dom/serviceworkers/test/parse_error_worker.js
|
||||
dom/tests/mochitest/bugs/test_bug531176.html
|
||||
dom/webauthn/tests/cbor.js
|
||||
dom/workers/test/importScripts_worker_imported3.js
|
||||
dom/workers/test/invalid.js
|
||||
dom/workers/test/threadErrors_worker1.js
|
||||
|
||||
# Third-party
|
||||
editor/libeditor/tests/browserscope/**
|
||||
|
||||
|
|
|
|||
133
.eslintrc.js
133
.eslintrc.js
|
|
@ -330,5 +330,138 @@ module.exports = {
|
|||
"space-unary-ops": "off",
|
||||
"spaced-comment": "off",
|
||||
}
|
||||
}, {
|
||||
"files": [
|
||||
"dom/animation/**",
|
||||
"dom/base/test/*.*",
|
||||
"dom/base/test/unit/test_serializers_entities*.js",
|
||||
"dom/base/test/unit_ipc/**",
|
||||
"dom/base/test/jsmodules/**",
|
||||
"dom/base/*.*",
|
||||
"dom/canvas/**",
|
||||
"dom/encoding/**",
|
||||
"dom/events/**",
|
||||
"dom/fetch/**",
|
||||
"dom/file/**",
|
||||
"dom/html/**",
|
||||
"dom/jsurl/**",
|
||||
"dom/media/tests/**",
|
||||
"dom/media/webaudio/**",
|
||||
"dom/media/webspeech/**",
|
||||
"dom/messagechannel/**",
|
||||
"dom/midi/**",
|
||||
"dom/network/**",
|
||||
"dom/payments/**",
|
||||
"dom/performance/**",
|
||||
"dom/permission/**",
|
||||
"dom/quota/**",
|
||||
"dom/security/test/cors/**",
|
||||
"dom/security/test/csp/**",
|
||||
"dom/security/test/general/**",
|
||||
"dom/security/test/mixedcontentblocker/**",
|
||||
"dom/security/test/sri/**",
|
||||
"dom/serviceworkers/**",
|
||||
"dom/smil/**",
|
||||
"dom/tests/mochitest/**",
|
||||
"dom/u2f/**",
|
||||
"dom/vr/**",
|
||||
"dom/webauthn/**",
|
||||
"dom/webgpu/**",
|
||||
"dom/websocket/**",
|
||||
"dom/workers/**",
|
||||
"dom/worklet/**",
|
||||
"dom/xbl/**",
|
||||
"dom/xml/**",
|
||||
"dom/xslt/**",
|
||||
"dom/xul/**",
|
||||
],
|
||||
"rules": {
|
||||
"consistent-return": "off",
|
||||
"dot-notation": "off",
|
||||
"object-shorthand": "off",
|
||||
"mozilla/avoid-removeChild": "off",
|
||||
"mozilla/consistent-if-bracing": "off",
|
||||
"mozilla/no-arbitrary-setTimeout": "off",
|
||||
"mozilla/no-compare-against-boolean-literals": "off",
|
||||
"mozilla/no-define-cc-etc": "off",
|
||||
"mozilla/no-useless-parameters": "off",
|
||||
"mozilla/no-useless-run-test": "off",
|
||||
"mozilla/reject-importGlobalProperties": "off",
|
||||
"mozilla/use-cc-etc": "off",
|
||||
"mozilla/use-chromeutils-generateqi": "off",
|
||||
"mozilla/use-chromeutils-import": "off",
|
||||
"mozilla/use-includes-instead-of-indexOf": "off",
|
||||
"mozilla/use-ownerGlobal": "off",
|
||||
"mozilla/use-services": "off",
|
||||
"no-array-constructor": "off",
|
||||
"no-caller": "off",
|
||||
"no-cond-assign": "off",
|
||||
"no-control-regex": "off",
|
||||
"no-debugger": "off",
|
||||
"no-else-return": "off",
|
||||
"no-empty": "off",
|
||||
"no-eval": "off",
|
||||
"no-extra-boolean-cast": "off",
|
||||
"no-func-assign": "off",
|
||||
"no-global-assign": "off",
|
||||
"no-implied-eval": "off",
|
||||
"no-lone-blocks": "off",
|
||||
"no-lonely-if": "off",
|
||||
"no-nested-ternary": "off",
|
||||
"no-new-object": "off",
|
||||
"no-new-wrappers": "off",
|
||||
"no-octal": "off",
|
||||
"no-redeclare": "off",
|
||||
"no-return-await": "off",
|
||||
"no-restricted-globals": "off",
|
||||
"no-self-assign": "off",
|
||||
"no-self-compare": "off",
|
||||
"no-sequences": "off",
|
||||
"no-shadow": "off",
|
||||
"no-shadow-restricted-names": "off",
|
||||
"no-sparse-arrays": "off",
|
||||
"no-throw-literal": "off",
|
||||
"no-unneeded-ternary": "off",
|
||||
"no-unreachable": "off",
|
||||
"no-unsanitized/method": "off",
|
||||
"no-unsanitized/property": "off",
|
||||
"no-undef": "off",
|
||||
"no-unused-vars": "off",
|
||||
"no-useless-call": "off",
|
||||
"no-useless-concat": "off",
|
||||
"no-useless-return": "off",
|
||||
"no-with": "off",
|
||||
|
||||
// Not enabling the rules below for now pending prettier roll-out.
|
||||
"arrow-spacing": "off",
|
||||
"block-spacing": "off",
|
||||
"brace-style": "off",
|
||||
"comma-dangle": "off",
|
||||
"comma-spacing": "off",
|
||||
"comma-style": "off",
|
||||
"computed-property-spacing": "off",
|
||||
"eol-last": "off",
|
||||
"func-call-spacing": "off",
|
||||
"generator-star-spacing": "off",
|
||||
"linebreak-style": "off",
|
||||
"key-spacing": "off",
|
||||
"keyword-spacing": "off",
|
||||
"no-extra-semi": "off",
|
||||
"no-tabs": "off",
|
||||
"no-mixed-spaces-and-tabs": "off",
|
||||
"no-multi-spaces": "off",
|
||||
"no-trailing-spaces": "off",
|
||||
"no-unexpected-multiline": "off",
|
||||
"no-whitespace-before-property": "off",
|
||||
"padded-blocks": "off",
|
||||
"quotes": "off",
|
||||
"rest-spread-spacing": "off",
|
||||
"semi": "off",
|
||||
"space-before-blocks": "off",
|
||||
"space-before-function-paren": "off",
|
||||
"space-infix-ops": "off",
|
||||
"space-unary-ops": "off",
|
||||
"spaced-comment": "off",
|
||||
}
|
||||
}]
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5891,6 +5891,7 @@ isPixel(ctx, 40,20, 0,255,0,255, 2);
|
|||
<canvas id="c220" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
function test_2d_gradient_linear_nonfinite() {
|
||||
|
||||
var canvas = document.getElementById('c220');
|
||||
|
|
@ -6704,6 +6705,7 @@ var _thrown = undefined; try {
|
|||
<canvas id="c244" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
function test_2d_gradient_radial_nonfinite() {
|
||||
|
||||
var canvas = document.getElementById('c244');
|
||||
|
|
@ -7666,6 +7668,7 @@ ok(imgdata2.data[2] === 255, "imgdata2.data[\""+(2)+"\"] === 255");
|
|||
<canvas id="c265" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
function test_2d_imageData_get_nonfinite() {
|
||||
|
||||
var canvas = document.getElementById('c265');
|
||||
|
|
@ -8564,6 +8567,7 @@ isPixel(ctx, 75,25, 0,255,0,255, 2);
|
|||
<script>
|
||||
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
function test_2d_imageData_put_created() {
|
||||
|
||||
var canvas = document.getElementById('c291');
|
||||
|
|
@ -8853,6 +8857,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 2);
|
|||
<canvas id="c299" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
function test_2d_imageData_put_nonfinite() {
|
||||
|
||||
var canvas = document.getElementById('c299');
|
||||
|
|
@ -10456,6 +10461,7 @@ isPixel(ctx, 86,25, 0,255,0,255, 0);
|
|||
<canvas id="c331" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
|
||||
<script>
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
function test_2d_missingargs() {
|
||||
|
||||
var canvas = document.getElementById('c331');
|
||||
|
|
@ -22338,6 +22344,7 @@ function asyncTestsDone() {
|
|||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
function runTests() {
|
||||
/**
|
||||
* xor and lighter aren't well handled by cairo; they mostly work, but we don't want
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ var target = null;
|
|||
var testGen = getTests();
|
||||
var currentTest = null;
|
||||
|
||||
function getTests() {
|
||||
function* getTests() {
|
||||
let tests = [
|
||||
{ "func": function() { setTimeout(doCheckContextMenu, 100)}, "message": "Context menu should has fired"},
|
||||
{ "func": function() { setTimeout(doCheckDuration, 100)}, "message": "Context menu should has fired with delay"},
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/* eslint-disable max-nested-callbacks */
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(runTests);
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ const kKeyList = [
|
|||
const kStrictKeyPressEvents =
|
||||
SpecialPowers.getBoolPref("dom.keyboardevent.keypress.dispatch_non_printable_keys_only_system_group_in_content");
|
||||
|
||||
/* eslint-disable mozilla/no-arbitrary-setTimeout */
|
||||
function frameScript() {
|
||||
let doc = content.document;
|
||||
addMessageListener("Test:RequestFullscreen", () => {
|
||||
|
|
@ -52,6 +53,7 @@ function frameScript() {
|
|||
}
|
||||
waitUntilActive();
|
||||
}
|
||||
/* eslint-enable mozilla/no-arbitrary-setTimeout */
|
||||
|
||||
var gMessageManager;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
// error.
|
||||
SimpleTest.ignoreAllUncaughtExceptions(true);
|
||||
|
||||
/* eslint-disable mozilla/no-arbitrary-setTimeout */
|
||||
function frameScript() {
|
||||
addMessageListener("Test:RequestFullscreen", () => {
|
||||
content.document.body.requestFullscreen();
|
||||
|
|
@ -27,6 +28,7 @@ function frameScript() {
|
|||
}
|
||||
waitUntilActive();
|
||||
}
|
||||
/* eslint-enable mozilla/no-arbitrary-setTimeout */
|
||||
|
||||
var gMessageManager;
|
||||
|
||||
|
|
@ -95,6 +97,7 @@ add_task(async function() {
|
|||
|
||||
// Wait a small time to confirm that the first ESC key
|
||||
// does not exit fullscreen.
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
gMessageManager.sendAsyncMessage("Test:QueryFullscreenState");
|
||||
state = await promiseOneMessage("Test:FullscreenState");
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ async function runTest() {
|
|||
// Ensure the browser exits fullscreen state in reasonable time.
|
||||
await Promise.race([
|
||||
BrowserTestUtils.waitForCondition(() => getSizeMode() == "normal"),
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
new Promise(resolve => setTimeout(resolve, 2000))
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
<script class="testbody" type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
// eslint-disable-next-line complexity
|
||||
SimpleTest.waitForFocus(() => {
|
||||
let content = document.getElementById("content");
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -315,6 +315,7 @@ var pedanticChecks = report => {
|
|||
[...report.keys()].forEach(key => is(report[key], undefined,
|
||||
`Report is not dictionary like, it lacks a property for key ${key}`));
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
report.forEach((statObj, mapKey) => {
|
||||
let tested = {};
|
||||
// Record what fields get tested.
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ function discreteSum(sourceBuffer, destBuffer) {
|
|||
|
||||
// Speaker channel interpretation mixing:
|
||||
// https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#UpMix
|
||||
// eslint-disable-next-line complexity
|
||||
function speakersSum(sourceBuffer, destBuffer)
|
||||
{
|
||||
var numberOfSourceChannels = sourceBuffer.numberOfChannels;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
await navigator.requestMIDIAccess({ "sysex": false })
|
||||
ok(true, "MIDI Access Request successful");
|
||||
SimpleTest.finish();
|
||||
} catch {
|
||||
} catch (ex) {
|
||||
ok(false, "MIDI Access Request Failed!");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
await navigator.requestMIDIAccess({ "sysex": false });
|
||||
ok(false, "MIDI Access Request Deny failed");
|
||||
SimpleTest.finish();
|
||||
} catch {
|
||||
} catch (ex) {
|
||||
ok(true, "MIDI Access Request Deny successful!");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ function checkSimplestRequest(payRequest) {
|
|||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
function checkComplexRequest(payRequest) {
|
||||
if (payRequest.topLevelPrincipal.origin != "https://example.com") {
|
||||
emitTestFail("Top level principal's origin should be 'https://example.com', but got '"
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ function initTestCallback() {
|
|||
gen.next()
|
||||
}
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
function* runTest() {
|
||||
var loader = document.getElementById('loader');
|
||||
var loaderWindow = loader.contentWindow;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ var tests = {
|
|||
},
|
||||
'none-src-by-frame-src': {
|
||||
id: "none-src-by-frame-src",
|
||||
file: "file_child-src_iframe.html",
|
||||
file: IFRAME_SRC,
|
||||
result : "blocked",
|
||||
policy : "default-src 'none'; script-src 'unsafe-inline'; child-src http://mochi.test:8888; frame-src 'none'"
|
||||
|
|
|
|||
|
|
@ -11,9 +11,11 @@ const USER_CONTEXT_ID = 3
|
|||
let mockAlertsService = {
|
||||
showAlert: function(alert, alertListener) {
|
||||
ok(true, "Showing alert");
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
setTimeout(function () {
|
||||
alertListener.observe(null, "alertshow", alert.cookie);
|
||||
}, 100);
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
setTimeout(function () {
|
||||
alertListener.observe(null, "alertclickcallback", alert.cookie);
|
||||
}, 100);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
var seenIndex = false;
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
onfetch = function(ev) {
|
||||
if (ev.request.url.includes("ignore")) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
{ scope: "./sw_clients/focus_stealing_client.html" })
|
||||
.then((swr) => {
|
||||
registration = swr;
|
||||
returun waitForState(swr.installing, 'activated', swr);
|
||||
return waitForState(swr.installing, 'activated', swr);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -97,4 +97,3 @@
|
|||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ async function test_noUint8Array_continue(r, that) {
|
|||
try {
|
||||
await r.blob();
|
||||
that.ok(false, "We cannot have a blob here!");
|
||||
} catch {
|
||||
} catch (ex) {
|
||||
that.ok(true, "We cannot have a blob here!");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
|
||||
/* eslint-disable max-nested-callbacks */
|
||||
|
||||
/*
|
||||
This is strictly implementation specific test for dom storage code from bug 600307.
|
||||
It exercises code for asynchronous data flushing with regard to cache life time and its preload.
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ function expectException(func, msg) {
|
|||
ok(failed, msg + " succeeded, but should have failed.");
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
function* runTest() {
|
||||
// We can't enable universal XPConnect privleges in this function, because
|
||||
// test 5 needs to be running at normal privleges in order to test the
|
||||
// same-origin policy.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,15 @@ dom/media/webspeech/recognition/energy_endpointer.cc
|
|||
dom/media/webspeech/recognition/energy_endpointer.h
|
||||
dom/media/webspeech/recognition/energy_endpointer_params.cc
|
||||
dom/media/webspeech/recognition/energy_endpointer_params.h
|
||||
dom/tests/ajax/jquery/
|
||||
dom/tests/ajax/mochikit/
|
||||
dom/tests/mochitest/ajax/
|
||||
dom/tests/mochitest/dom-level1-core/
|
||||
dom/tests/mochitest/dom-level2-core/
|
||||
dom/tests/mochitest/dom-level2-html/
|
||||
dom/u2f/tests/pkijs/
|
||||
dom/webauthn/cbor-cpp/
|
||||
dom/webauthn/tests/pkijs/
|
||||
editor/libeditor/tests/browserscope/lib/richtext/
|
||||
editor/libeditor/tests/browserscope/lib/richtext2/
|
||||
extensions/spellcheck/hunspell/src/
|
||||
|
|
|
|||
Loading…
Reference in a new issue