1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 } = require("../../toolkit/components/extensions/parent/.eslintrc.js");
14 files: ["components/extensions/ext-*.js"],
15 excludedFiles: ["components/extensions/ext-c-*.js"],
18 // These globals are defined in ext-android.js and can only be used in
19 // the extension files that run in the parent process.
20 EventDispatcher: true,
22 makeGlobalEvent: true,
30 "chrome/geckoview/**",
31 "components/geckoview/**",
32 "modules/geckoview/**",
41 varsIgnorePattern: "(debug|warn)",
44 "no-restricted-syntax": [
47 selector: `CallExpression > \
48 Identifier.callee[name = /^debug$|^warn$/]`,
50 "Use debug and warn with template literals, e.g. debug `foo`;",
53 selector: `BinaryExpression[operator = '+'] > \
54 TaggedTemplateExpression.left > \
55 Identifier.tag[name = /^debug$|^warn$/]`,
57 "Use only one template literal with debug/warn instead of concatenating multiple expressions,\n" +
58 " e.g. (debug `foo ${42} bar`) instead of (debug `foo` + 42 + `bar`)",
61 selector: `TaggedTemplateExpression[tag.type = 'Identifier'][tag.name = /^debug$|^warn$/] > \
62 TemplateLiteral.quasi CallExpression > \
63 MemberExpression.callee[object.type = 'Identifier'][object.name = 'JSON'] > \
64 Identifier.property[name = 'stringify']`,
66 "Don't call JSON.stringify within debug/warn literals,\n" +
67 " e.g. (debug `foo=${foo}`) instead of (debug `foo=${JSON.stringify(foo)}`)",