forked from mirrors/gecko-dev
# ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D35940 --HG-- extra : source : d214f0c82813e5a8d3987debc490a2c11f1308ff
46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
"use strict";
|
|
|
|
// ------------------------------------------------------------------------------
|
|
// Requirements
|
|
// ------------------------------------------------------------------------------
|
|
|
|
var rule = require("../lib/rules/reject-importGlobalProperties");
|
|
var RuleTester = require("eslint/lib/testers/rule-tester");
|
|
|
|
const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 8 } });
|
|
|
|
// ------------------------------------------------------------------------------
|
|
// Tests
|
|
// ------------------------------------------------------------------------------
|
|
|
|
ruleTester.run("reject-importGlobalProperties", rule, {
|
|
valid: [
|
|
{
|
|
code: "Cu.something();",
|
|
},
|
|
{
|
|
options: ["allownonwebidl"],
|
|
code: "Cu.importGlobalProperties(['fetch'])",
|
|
},
|
|
],
|
|
invalid: [
|
|
{
|
|
code: "Cu.importGlobalProperties(['fetch'])",
|
|
options: ["everything"],
|
|
errors: [{ messageId: "unexpectedCall" }],
|
|
},
|
|
{
|
|
code: "Cu.importGlobalProperties(['TextEncoder'])",
|
|
options: ["everything"],
|
|
errors: [{ messageId: "unexpectedCall" }],
|
|
},
|
|
{
|
|
code: "Cu.importGlobalProperties(['TextEncoder'])",
|
|
options: ["allownonwebidl"],
|
|
errors: [{ messageId: "unexpectedCallWebIdl" }],
|
|
},
|
|
],
|
|
});
|