18 "client/framework/**",
21 "no-return-assign": "off",
25 "client/scratchpad/scratchpad-manager.jsm",
26 "client/scratchpad/scratchpad.js",
27 "client/shared/*.jsm",
34 "client/framework/**",
35 "client/scratchpad/**",
36 "client/shared/*.jsm",
37 "client/shared/widgets/*.jsm",
41 "consistent-return": "off",
45 "client/framework/**",
46 "client/scratchpad/**",
50 "max-nested-callbacks": "off",
54 "client/scratchpad/test/browser_scratchpad_inspect.js",
55 "client/scratchpad/test/browser_scratchpad_inspect_primitives.js",
62 "client/framework/**",
63 "client/scratchpad/**",
64 "client/shared/*.jsm",
65 "client/shared/widgets/*.jsm",
69 "mozilla/no-aArgs": "off",
73 "client/framework/test/**",
74 "client/scratchpad/**",
77 "mozilla/var-only-at-top-level": "off",
81 "client/framework/**",
82 "client/scratchpad/**",
83 "client/shared/widgets/*.jsm",
91 "client/framework/**",
92 "client/scratchpad/**",
99 // For all head*.js files, turn off no-unused-vars at a global level
104 "no-unused-vars": ["error", {"args": "none", "vars": "local"}],
107 // Cu, Cc etc... are not available in most devtools modules loaded by require.
112 // Enable the rule on JSM, test head files and some specific files.
114 "**/test/**/head.js",
115 "**/test/**/shared-head.js",
116 "client/debugger/test/mochitest/code_frame-script.js",
117 "client/inspector/animation-old/test/doc_frame_script.js",
118 "client/inspector/animation/test/doc_frame_script.js",
119 "client/inspector/rules/test/doc_frame_script.js",
120 "client/inspector/shared/test/doc_frame_script.js",
121 "client/jsonview/converter-observer.js",
122 "client/jsonview/test/doc_frame_script.js",
123 "client/responsive.html/browser/content.js",
124 "client/shared/browser-loader.js",
125 "server/actors/webconsole/content-process-forward.js",
126 "server/actors/worker/service-worker-process.js",
127 "server/startup/content-process.js",
128 "server/startup/frame.js",
129 "shared/base-loader.js",
130 "shared/worker/loader.js",
131 "startup/aboutdebugging-registration.js",
132 "startup/aboutdevtools/aboutdevtools-registration.js",
133 "startup/aboutdevtoolstoolbox-registration.js",
134 "startup/devtools-startup.js",
137 "mozilla/no-define-cc-etc": "off",
141 // These are the rules that have been configured so far to match the
142 // devtools coding style.
144 // Rules from the mozilla plugin
145 "mozilla/no-aArgs": "error",
147 "mozilla/reject-importGlobalProperties": ["error", "everything"],
148 // devtools/shared/platform is special; see the README.md in that
149 // directory for details. We reject requires using explicit
150 // subdirectories of this directory.
151 "mozilla/reject-some-requires": ["error", "^devtools/shared/platform/(chome|content)/"],
152 "mozilla/var-only-at-top-level": "error",
153 "mozilla/use-chromeutils-import": ["error", {allowCu: true}],
155 // Rules from the React plugin
156 "react/display-name": "error",
157 "react/no-danger": "error",
158 "react/no-did-mount-set-state": "error",
159 "react/no-did-update-set-state": "error",
160 "react/no-direct-mutation-state": "error",
161 "react/no-unknown-property": "error",
162 "react/prefer-es6-class": ["off", "always"],
163 "react/prop-types": "error",
164 "react/sort-comp": ["error", {
185 "componentWillMount",
187 "componentWillReceiveProps",
188 "shouldComponentUpdate",
189 "componentWillUpdate",
190 "componentDidUpdate",
191 "componentWillUnmount"
196 // Disallow using variables outside the blocks they are defined (especially
197 // since only let and const are used, see "no-var").
198 "block-scoped-var": "error",
199 // Require camel case names
200 "camelcase": ["error", { "properties": "never" }],
201 // Warn about cyclomatic complexity in functions.
202 // 20 is ESLint's default, and we want to keep it this way to prevent new highly
203 // complex functions from being introduced. However, because Mozilla's eslintrc has
204 // some other value defined, we need to override it here. See bug 1553449 for more
205 // information on complex DevTools functions that are currently excluded.
206 "complexity": ["error", 20],
207 // Don't warn for inconsistent naming when capturing this (not so important
208 // with auto-binding fat arrow functions).
209 "consistent-this": "off",
210 // Don't require a default case in switch statements. Avoid being forced to
211 // add a bogus default when you know all possible cases are handled.
212 "default-case": "off",
213 // Allow using == instead of ===, in the interest of landing something since
214 // the devtools codebase is split on convention here.
216 // Don't require function expressions to have a name.
217 // This makes the code more verbose and hard to read. Our engine already
218 // does a fantastic job assigning a name to the function, which includes
219 // the enclosing function name, and worst case you have a line number that
220 // you can just look up.
222 // Allow use of function declarations and expressions.
224 // Only useful in a node environment.
225 "handle-callback-err": "off",
226 // Maximum depth callbacks can be nested.
227 "max-nested-callbacks": ["error", 3],
228 // Don't limit the number of parameters that can be used in a function.
230 // Don't limit the maximum number of statement allowed in a function. We
231 // already have the complexity rule that's a better measurement.
232 "max-statements": "off",
233 // Require a capital letter for constructors, only check if all new
234 // operators are followed by a capital letter. Don't warn when capitalized
235 // functions are used without the new operator.
236 "new-cap": ["error", {"capIsNew": false}],
237 // Allow use of bitwise operators.
239 // Allow using the console API.
241 // Allow using constant expressions in conditions like while (true)
242 "no-constant-condition": "off",
243 // Allow use of the continue statement.
244 "no-continue": "off",
245 // Allow division operators explicitly at beginning of regular expression.
246 "no-div-regex": "off",
247 // Disallow empty statements. This will report an error for:
248 // try { something(); } catch (e) {}
249 // but will not report it for:
250 // try { something(); } catch (e) { /* Silencing the error because ...*/ }
251 // which is a valid use case.
253 // Disallow adding to native types
254 "no-extend-native": "error",
255 // Disallow fallthrough of case statements, except if there is a comment.
256 "no-fallthrough": "error",
257 // Allow comments inline after code.
258 "no-inline-comments": "off",
259 // Allow mixing regular variable and require declarations (not a node env).
260 "no-mixed-requires": "off",
261 // Disallow use of multiline strings (use template strings instead).
262 "no-multi-str": "error",
263 // Allow use of new operator with the require function.
264 "no-new-require": "off",
265 // Allow reassignment of function parameters.
266 "no-param-reassign": "off",
267 // Allow string concatenation with __dirname and __filename (not a node env).
268 "no-path-concat": "off",
269 // Allow use of unary operators, ++ and --.
270 "no-plusplus": "off",
271 // Allow using process.env (not a node environment).
272 "no-process-env": "off",
273 // Allow using process.exit (not a node environment).
274 "no-process-exit": "off",
275 // Disallow usage of __proto__ property.
277 // Disallow multiple spaces in a regular expression literal.
278 "no-regex-spaces": "off",
279 // Don't restrict usage of specified node modules (not a node environment).
280 "no-restricted-modules": "off",
281 // Prevent using some properties
282 "no-restricted-properties": ["error", {
283 "property": "setupInParent",
284 "message": "avoid child/parent communication with setupInParent"
286 // Disallow use of assignment in return statement. It is preferable for a
287 // single line of code to have only one easily predictable effect.
288 "no-return-assign": "error",
289 // Allow use of javascript: urls.
290 "no-script-url": "off",
291 // Warn about declaration of variables already declared in the outer scope.
292 // This isn't an error because it sometimes is useful to use the same name
293 // in a small helper function rather than having to come up with another
295 // Still, making this a warning can help people avoid being confused.
296 "no-shadow": "error",
297 // Allow use of synchronous methods (not a node environment).
299 // Allow the use of ternary operators.
301 // Allow dangling underscores in identifiers (for privates).
302 "no-underscore-dangle": "off",
303 // Allow use of undefined variable.
304 "no-undefined": "off",
305 // Disallow global and local variables that aren't used, but allow unused
306 // function arguments.
307 "no-unused-vars": ["error", {"args": "none", "vars": "all"}],
308 // Allow using variables before they are defined.
309 "no-use-before-define": "off",
310 // We use var-only-at-top-level instead of no-var as we allow top level
313 // Allow using TODO/FIXME comments.
314 "no-warning-comments": "off",
315 // Don't require method and property shorthand syntax for object literals.
316 // We use this in the code a lot, but not consistently, and this seems more
317 // like something to check at code review time.
318 "object-shorthand": "off",
319 // Allow more than one variable declaration per function.
321 // Enforce using `let` only when variables are reassigned.
322 "prefer-const": ["error", { "destructuring": "all" }],
323 // Require use of the second argument for parseInt().
325 // Don't require to sort variables within the same declaration block.
326 // Anyway, one-var is disabled.
328 // Require "use strict" to be defined globally in the script.
329 "strict": ["error", "global"],
330 // Warn about invalid JSDoc comments.
331 // Disabled for now because of https://github.com/eslint/eslint/issues/2270
332 // The rule fails on some jsdoc comments like in:
333 // devtools/client/webconsole/old/console-output.js
334 "valid-jsdoc": "off",
335 // Allow vars to be declared anywhere in the scope.
336 "vars-on-top": "off",
337 // Disallow Yoda conditions (where literal value comes first).
340 // And these are the rules that haven't been discussed so far, and that are
341 // disabled for now until we introduce them, one at a time.
343 // Require for-in loops to have an if statement.
344 "guard-for-in": "off",
345 // disallow the use of alert, confirm, and prompt
347 // disallow comparisons to null without a type-checking operator
349 // disallow overwriting functions written as function declarations
350 "no-func-assign": "off",
351 // disallow function or variable declarations in nested blocks
352 "no-inner-declarations": "off",
353 // disallow invalid regular expression strings in the RegExp constructor
354 "no-invalid-regexp": "off",
355 // disallow irregular whitespace outside of strings and comments
356 "no-irregular-whitespace": "off",
357 // disallow usage of __iterator__ property
358 "no-iterator": "off",
359 // disallow labels that share a name with a variable
360 "no-label-var": "off",
361 // disallow unnecessary nested blocks
362 "no-lone-blocks": "off",
363 // disallow creation of functions within loops
364 "no-loop-func": "off",
365 // disallow use of new operator when not part of the assignment or
368 // disallow use of new operator for Function object
369 "no-new-func": "off",
370 // disallow use of the Object constructor
371 "no-new-object": "off",
372 // disallows creating new instances of String,Number, and Boolean
373 "no-new-wrappers": "off",
374 // disallow the use of object properties of the global object (Math and
375 // JSON) as functions
376 "no-obj-calls": "off",
377 // disallow use of octal escape sequences in string literals, such as
378 // var foo = "Copyright \251";
379 "no-octal-escape": "off",
380 // disallow use of undefined when initializing variables
381 "no-undef-init": "off",
382 // disallow usage of expressions in statement position
383 "no-unused-expressions": "off",
384 // disallow unnecessary concatenation of literals or template literals
385 "no-useless-concat": "off",
386 // disallow use of void operator
388 // require assignment operator shorthand where possible or prohibit it
390 "operator-assignment": "off",