Bug 1891710: part 2) Enable <Element-outerHTML.html> WPT for Trusted Types. r=smaug
[gecko.git] / mobile / android / .eslintrc.js
blob684f782f95e7a85e2927924bf57fd72dfb4265e7
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/. */
5 "use strict";
7 const {
8   globals,
9 } = require("../../toolkit/components/extensions/parent/.eslintrc.js");
11 module.exports = {
12   overrides: [
13     {
14       files: ["components/extensions/ext-*.js"],
15       excludedFiles: ["components/extensions/ext-c-*.js"],
16       globals: {
17         ...globals,
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,
21         ExtensionError: true,
22         makeGlobalEvent: true,
23         TabContext: true,
24         tabTracker: true,
25         windowTracker: true,
26       },
27     },
28     {
29       files: [
30         "chrome/geckoview/**",
31         "components/geckoview/**",
32         "modules/geckoview/**",
33         "actors/**",
34       ],
35       rules: {
36         "no-unused-vars": [
37           "error",
38           {
39             argsIgnorePattern: "^_",
40             vars: "local",
41             varsIgnorePattern: "(debug|warn)",
42           },
43         ],
44         "no-restricted-syntax": [
45           "error",
46           {
47             selector: `CallExpression > \
48                          Identifier.callee[name = /^debug$|^warn$/]`,
49             message:
50               "Use debug and warn with template literals, e.g. debug `foo`;",
51           },
52           {
53             selector: `BinaryExpression[operator = '+'] > \
54                          TaggedTemplateExpression.left > \
55                          Identifier.tag[name = /^debug$|^warn$/]`,
56             message:
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`)",
59           },
60           {
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']`,
65             message:
66               "Don't call JSON.stringify within debug/warn literals,\n" +
67               "    e.g. (debug `foo=${foo}`) instead of (debug `foo=${JSON.stringify(foo)}`)",
68           },
69         ],
70       },
71     },
72   ],