.eslintrc.mjs (1868B)
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/. */ 4 5 export default [ 6 { 7 files: [ 8 "chrome/geckoview/**", 9 "components/geckoview/**", 10 "modules/geckoview/**", 11 "actors/**", 12 ], 13 rules: { 14 complexity: ["error", 35], 15 "no-unused-vars": [ 16 "error", 17 { 18 args: "none", 19 caughtErrors: "none", 20 vars: "local", 21 varsIgnorePattern: "(debug|warn)", 22 }, 23 ], 24 "no-restricted-syntax": [ 25 "error", 26 { 27 selector: `CallExpression > \ 28 Identifier.callee[name = /^debug$|^warn$/]`, 29 message: 30 "Use debug and warn with template literals, e.g. debug `foo`;", 31 }, 32 { 33 selector: `BinaryExpression[operator = '+'] > \ 34 TaggedTemplateExpression.left > \ 35 Identifier.tag[name = /^debug$|^warn$/]`, 36 message: 37 "Use only one template literal with debug/warn instead of concatenating multiple expressions,\n" + 38 " e.g. (debug `foo ${42} bar`) instead of (debug `foo` + 42 + `bar`)", 39 }, 40 { 41 selector: `TaggedTemplateExpression[tag.type = 'Identifier'][tag.name = /^debug$|^warn$/] > \ 42 TemplateLiteral.quasi CallExpression > \ 43 MemberExpression.callee[object.type = 'Identifier'][object.name = 'JSON'] > \ 44 Identifier.property[name = 'stringify']`, 45 message: 46 "Don't call JSON.stringify within debug/warn literals,\n" + 47 " e.g. (debug `foo=${foo}`) instead of (debug `foo=${JSON.stringify(foo)}`)", 48 }, 49 ], 50 }, 51 }, 52 ];