17 "client/framework/**",
20 "no-return-assign": "off",
24 "client/scratchpad/scratchpad-manager.jsm",
25 "client/scratchpad/scratchpad.js",
26 "client/shared/*.jsm",
33 "client/framework/**",
34 "client/scratchpad/**",
35 "client/shared/*.jsm",
36 "client/shared/widgets/*.jsm",
40 "consistent-return": "off",
44 "client/framework/**",
45 "client/scratchpad/**",
49 "max-nested-callbacks": "off",
53 "client/framework/**",
54 "client/scratchpad/**",
55 "client/shared/*.jsm",
56 "client/shared/widgets/*.jsm",
64 "client/scratchpad/test/browser_scratchpad_inspect.js",
65 "client/scratchpad/test/browser_scratchpad_inspect_primitives.js",
72 "client/framework/**",
73 "client/scratchpad/**",
74 "client/shared/*.jsm",
75 "client/shared/widgets/*.jsm",
79 "mozilla/no-aArgs": "off",
83 "client/framework/test/**",
84 "client/scratchpad/**",
87 "mozilla/var-only-at-top-level": "off",
91 "client/framework/**",
92 "client/scratchpad/**",
93 "client/shared/widgets/*.jsm",
101 "client/framework/**",
102 "client/scratchpad/**",
110 // Note: Bug 1403938 may be removing canvasdebugger, check before
111 // doing more work on enabling these rules.
112 "client/canvasdebugger/**",
113 // Note: Bug 1342237 may be removing shadereditor, check before
114 // doing more work on enabling these rules.
115 "client/shadereditor/**",
116 // Note: Bug 1403944 may be removing webaudioeditor, check before
117 // doing more work on enabling these rules.
118 "client/webaudioeditor/**",
121 "consistent-return": "off",
123 "mozilla/no-aArgs": "off",
124 "mozilla/var-only-at-top-level": "off",
125 "no-redeclare": "off",
126 "no-return-assign": "off",
129 "no-unused-vars": "off",
130 "no-useless-call": "off",
134 // For all head*.js files, turn off no-unused-vars at a global level
139 "no-unused-vars": ["error", {"args": "none", "vars": "local"}],
142 // Cu, Cc etc... are not available in most devtools modules loaded by require.
147 // Enable the rule on JSM, test head files and some specific files.
149 "**/test/**/head.js",
150 "**/test/**/shared-head.js",
151 "client/debugger/test/mochitest/code_frame-script.js",
152 "client/inspector/animation-old/test/doc_frame_script.js",
153 "client/inspector/animation/test/doc_frame_script.js",
154 "client/inspector/rules/test/doc_frame_script.js",
155 "client/inspector/shared/test/doc_frame_script.js",
156 "client/jsonview/converter-observer.js",
157 "client/jsonview/test/doc_frame_script.js",
158 "client/responsive.html/browser/content.js",
159 "client/shared/browser-loader.js",
160 "server/actors/webconsole/content-process-forward.js",
161 "server/actors/worker/service-worker-process.js",
162 "server/startup/content-process.js",
163 "server/startup/frame.js",
164 "shared/base-loader.js",
165 "shared/worker/loader.js",
166 "startup/aboutdebugging-registration.js",
167 "startup/aboutdevtools/aboutdevtools-registration.js",
168 "startup/aboutdevtoolstoolbox-registration.js",
169 "startup/devtools-startup.js",
172 "mozilla/no-define-cc-etc": "off",
176 // These are the rules that have been configured so far to match the
177 // devtools coding style.
179 // Rules from the mozilla plugin
180 "mozilla/no-aArgs": "error",
182 "mozilla/reject-importGlobalProperties": ["error", "everything"],
183 // devtools/shared/platform is special; see the README.md in that
184 // directory for details. We reject requires using explicit
185 // subdirectories of this directory.
186 "mozilla/reject-some-requires": ["error", "^devtools/shared/platform/(chome|content)/"],
187 "mozilla/var-only-at-top-level": "error",
188 "mozilla/use-chromeutils-import": ["error", {allowCu: true}],
190 // Rules from the React plugin
191 "react/display-name": "error",
192 "react/no-danger": "error",
193 "react/no-did-mount-set-state": "error",
194 "react/no-did-update-set-state": "error",
195 "react/no-direct-mutation-state": "error",
196 "react/no-unknown-property": "error",
197 "react/prefer-es6-class": ["off", "always"],
198 "react/prop-types": "error",
199 "react/sort-comp": ["error", {
220 "componentWillMount",
222 "componentWillReceiveProps",
223 "shouldComponentUpdate",
224 "componentWillUpdate",
225 "componentDidUpdate",
226 "componentWillUnmount"
231 // Disallow using variables outside the blocks they are defined (especially
232 // since only let and const are used, see "no-var").
233 "block-scoped-var": "error",
234 // Enforce one true brace style (opening brace on the same line) and avoid
235 // start and end braces on the same line.
236 "brace-style": ["error", "1tbs", {"allowSingleLine": false}],
237 // Require camel case names
238 "camelcase": "error",
239 // Warn about cyclomatic complexity in functions.
240 "complexity": ["error", 53],
241 // Don't warn for inconsistent naming when capturing this (not so important
242 // with auto-binding fat arrow functions).
243 "consistent-this": "off",
244 // Enforce curly brace conventions for all control statements.
246 // Don't require a default case in switch statements. Avoid being forced to
247 // add a bogus default when you know all possible cases are handled.
248 "default-case": "off",
249 // Enforce dots on the next line with property name.
250 "dot-location": ["error", "property"],
251 // Allow using == instead of ===, in the interest of landing something since
252 // the devtools codebase is split on convention here.
254 // Disallow space between function identifier and application.
255 "func-call-spacing": "error",
256 // Don't require function expressions to have a name.
257 // This makes the code more verbose and hard to read. Our engine already
258 // does a fantastic job assigning a name to the function, which includes
259 // the enclosing function name, and worst case you have a line number that
260 // you can just look up.
262 // Allow use of function declarations and expressions.
264 // Only useful in a node environment.
265 "handle-callback-err": "off",
267 "indent-legacy": ["error", 2, {"SwitchCase": 1, "ArrayExpression": "first", "ObjectExpression": "first"}],
268 // Enforces spacing between keys and values in object literal properties.
269 "key-spacing": ["error", {"beforeColon": false, "afterColon": true}],
270 // Maximum length of a line.
271 "max-len": ["error", 90, 2, {
273 "ignorePattern": "data:image\/|\\s*require\\s*\\(|^\\s*loader\\.lazy|-\\*-"
275 // Maximum depth callbacks can be nested.
276 "max-nested-callbacks": ["error", 3],
277 // Don't limit the number of parameters that can be used in a function.
279 // Don't limit the maximum number of statement allowed in a function. We
280 // already have the complexity rule that's a better measurement.
281 "max-statements": "off",
282 // Require a capital letter for constructors, only check if all new
283 // operators are followed by a capital letter. Don't warn when capitalized
284 // functions are used without the new operator.
285 "new-cap": ["error", {"capIsNew": false}],
286 // Disallow the omission of parentheses when invoking a constructor with no
288 "new-parens": "error",
289 // Allow use of bitwise operators.
291 // Allow using the console API.
293 // Allow using constant expressions in conditions like while (true)
294 "no-constant-condition": "off",
295 // Allow use of the continue statement.
296 "no-continue": "off",
297 // Allow division operators explicitly at beginning of regular expression.
298 "no-div-regex": "off",
299 // Disallow empty statements. This will report an error for:
300 // try { something(); } catch (e) {}
301 // but will not report it for:
302 // try { something(); } catch (e) { /* Silencing the error because ...*/ }
303 // which is a valid use case.
305 // Disallow adding to native types
306 "no-extend-native": "error",
307 // Allow unnecessary parentheses, as they may make the code more readable.
308 "no-extra-parens": "off",
309 // Disallow fallthrough of case statements, except if there is a comment.
310 "no-fallthrough": "error",
311 // Allow the use of leading or trailing decimal points in numeric literals.
312 "no-floating-decimal": "off",
313 // Allow comments inline after code.
314 "no-inline-comments": "off",
315 // Allow mixing regular variable and require declarations (not a node env).
316 "no-mixed-requires": "off",
317 // Disallow use of multiple spaces (sometimes used to align const values,
318 // array or object items, etc.). It's hard to maintain and doesn't add that
320 "no-multi-spaces": "error",
321 // Disallow use of multiline strings (use template strings instead).
322 "no-multi-str": "error",
323 // Disallow multiple empty lines.
324 "no-multiple-empty-lines": ["error", {"max": 1}],
325 // Allow use of new operator with the require function.
326 "no-new-require": "off",
327 // Allow reassignment of function parameters.
328 "no-param-reassign": "off",
329 // Allow string concatenation with __dirname and __filename (not a node env).
330 "no-path-concat": "off",
331 // Allow use of unary operators, ++ and --.
332 "no-plusplus": "off",
333 // Allow using process.env (not a node environment).
334 "no-process-env": "off",
335 // Allow using process.exit (not a node environment).
336 "no-process-exit": "off",
337 // Disallow usage of __proto__ property.
339 // Disallow multiple spaces in a regular expression literal.
340 "no-regex-spaces": "off",
341 // Don't restrict usage of specified node modules (not a node environment).
342 "no-restricted-modules": "off",
343 // Disallow use of assignment in return statement. It is preferable for a
344 // single line of code to have only one easily predictable effect.
345 "no-return-assign": "error",
346 // Allow use of javascript: urls.
347 "no-script-url": "off",
348 // Warn about declaration of variables already declared in the outer scope.
349 // This isn't an error because it sometimes is useful to use the same name
350 // in a small helper function rather than having to come up with another
352 // Still, making this a warning can help people avoid being confused.
353 "no-shadow": "error",
354 // Allow use of synchronous methods (not a node environment).
356 // Allow the use of ternary operators.
358 // Disallow throwing literals (eg. throw "error" instead of
359 // throw new Error("error")).
360 "no-throw-literal": "error",
361 // Allow dangling underscores in identifiers (for privates).
362 "no-underscore-dangle": "off",
363 // Allow use of undefined variable.
364 "no-undefined": "off",
365 // Disallow global and local variables that aren't used, but allow unused
366 // function arguments.
367 "no-unused-vars": ["error", {"args": "none", "vars": "all"}],
368 // Allow using variables before they are defined.
369 "no-use-before-define": "off",
370 // We use var-only-at-top-level instead of no-var as we allow top level
373 // Allow using TODO/FIXME comments.
374 "no-warning-comments": "off",
375 // Don't require method and property shorthand syntax for object literals.
376 // We use this in the code a lot, but not consistently, and this seems more
377 // like something to check at code review time.
378 "object-shorthand": "off",
379 // Allow more than one variable declaration per function.
381 // Enforce using `let` only when variables are reassigned.
382 "prefer-const": ["error", { "destructuring": "all" }],
383 // Don't require quotes around object literal property names.
384 "quote-props": "off",
385 // Require use of the second argument for parseInt().
387 // Enforce spacing after semicolons.
388 "semi-spacing": ["error", {"before": false, "after": true}],
389 // Don't require to sort variables within the same declaration block.
390 // Anyway, one-var is disabled.
392 // Disallow spaces inside parentheses.
393 "space-in-parens": ["error", "never"],
394 // Require spaces before/after unary operators (words on by default,
395 // nonwords off by default).
396 "space-unary-ops": ["error", { "words": true, "nonwords": false }],
397 // Require "use strict" to be defined globally in the script.
398 "strict": ["error", "global"],
399 // Warn about invalid JSDoc comments.
400 // Disabled for now because of https://github.com/eslint/eslint/issues/2270
401 // The rule fails on some jsdoc comments like in:
402 // devtools/client/webconsole/old/console-output.js
403 "valid-jsdoc": "off",
404 // Allow vars to be declared anywhere in the scope.
405 "vars-on-top": "off",
406 // Don't require immediate function invocation to be wrapped in parentheses.
408 // Don't require regex literals to be wrapped in parentheses (which
409 // supposedly prevent them from being mistaken for division operators).
411 // Disallow Yoda conditions (where literal value comes first).
414 // And these are the rules that haven't been discussed so far, and that are
415 // disabled for now until we introduce them, one at a time.
417 // enforce consistent spacing before and after the arrow in arrow functions
418 "arrow-spacing": "off",
419 // enforce consistent spacing inside computed property brackets
420 "computed-property-spacing": "off",
421 // Require for-in loops to have an if statement.
422 "guard-for-in": "off",
423 // disallow the use of alert, confirm, and prompt
425 // disallow comparisons to null without a type-checking operator
427 // disallow overwriting functions written as function declarations
428 "no-func-assign": "off",
429 // disallow function or variable declarations in nested blocks
430 "no-inner-declarations": "off",
431 // disallow invalid regular expression strings in the RegExp constructor
432 "no-invalid-regexp": "off",
433 // disallow irregular whitespace outside of strings and comments
434 "no-irregular-whitespace": "off",
435 // disallow usage of __iterator__ property
436 "no-iterator": "off",
437 // disallow labels that share a name with a variable
438 "no-label-var": "off",
439 // disallow unnecessary nested blocks
440 "no-lone-blocks": "off",
441 // disallow creation of functions within loops
442 "no-loop-func": "off",
443 // disallow use of new operator when not part of the assignment or
446 // disallow use of new operator for Function object
447 "no-new-func": "off",
448 // disallow use of the Object constructor
449 "no-new-object": "off",
450 // disallows creating new instances of String,Number, and Boolean
451 "no-new-wrappers": "off",
452 // disallow the use of object properties of the global object (Math and
453 // JSON) as functions
454 "no-obj-calls": "off",
455 // disallow use of octal escape sequences in string literals, such as
456 // var foo = "Copyright \251";
457 "no-octal-escape": "off",
458 // disallow use of undefined when initializing variables
459 "no-undef-init": "off",
460 // disallow usage of expressions in statement position
461 "no-unused-expressions": "off",
462 // disallow unnecessary concatenation of literals or template literals
463 "no-useless-concat": "off",
464 // disallow use of void operator
466 // require assignment operator shorthand where possible or prohibit it
468 "operator-assignment": "off",
469 // enforce operators to be placed before or after line breaks
470 "operator-linebreak": "off",