зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1762444 - Make no-addtask-setup eslint rule case-insensitive. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D150329
This commit is contained in:
Родитель
1f4593f091
Коммит
d714558ef6
|
@ -9,9 +9,9 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
// -----------------------------------------------------------------------------
|
||||
function isNamedLikeSetup(name) {
|
||||
return name.toLowerCase() === "setup";
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
|
@ -27,7 +27,7 @@ module.exports = {
|
|||
if (
|
||||
arg.type !== "FunctionExpression" ||
|
||||
!arg.id ||
|
||||
arg.id.name !== "setup"
|
||||
!isNamedLikeSetup(arg.id.name)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -63,5 +63,12 @@ ruleTester.run("no-addtask-setup", rule, {
|
|||
"Do not use add_task() for setup, use add_setup() instead."
|
||||
),
|
||||
},
|
||||
{
|
||||
code: "add_task(async function setUp() {});",
|
||||
output: "add_setup(async function() {});",
|
||||
errors: callError(
|
||||
"Do not use add_task() for setup, use add_setup() instead."
|
||||
),
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче