2016-10-18 10:38:10 +03:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
module.exports = {
|
2016-02-25 10:25:00 +03:00
|
|
|
"plugins": [
|
|
|
|
"react"
|
|
|
|
],
|
2015-05-28 10:30:03 +03:00
|
|
|
"globals": {
|
|
|
|
"exports": true,
|
2016-03-11 17:19:00 +03:00
|
|
|
"isWorker": true,
|
2015-05-28 10:30:03 +03:00
|
|
|
"loader": true,
|
|
|
|
"module": true,
|
2016-06-29 03:42:30 +03:00
|
|
|
"reportError": true,
|
2015-05-28 10:30:03 +03:00
|
|
|
"require": true,
|
|
|
|
},
|
2018-03-07 01:50:58 +03:00
|
|
|
"overrides": [{
|
2018-04-05 01:24:04 +03:00
|
|
|
"files": [
|
|
|
|
"client/framework/**",
|
|
|
|
],
|
|
|
|
"rules": {
|
|
|
|
"no-return-assign": "off",
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
"files": [
|
|
|
|
"client/scratchpad/scratchpad-manager.jsm",
|
|
|
|
"client/scratchpad/scratchpad.js",
|
2018-04-09 13:14:01 +03:00
|
|
|
"client/shared/*.jsm",
|
2018-04-05 01:24:04 +03:00
|
|
|
],
|
|
|
|
"rules": {
|
|
|
|
"camelcase": "off",
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
"files": [
|
|
|
|
"client/framework/**",
|
|
|
|
"client/scratchpad/**",
|
2018-04-09 13:14:01 +03:00
|
|
|
"client/shared/*.jsm",
|
|
|
|
"client/shared/widgets/*.jsm",
|
2018-04-11 18:10:35 +03:00
|
|
|
"client/webide/**",
|
2018-04-05 01:24:04 +03:00
|
|
|
],
|
|
|
|
"rules": {
|
|
|
|
"consistent-return": "off",
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
"files": [
|
|
|
|
"client/framework/**",
|
|
|
|
"client/scratchpad/**",
|
2018-04-11 18:10:35 +03:00
|
|
|
"client/webide/**",
|
2018-04-05 01:24:04 +03:00
|
|
|
],
|
|
|
|
"rules": {
|
|
|
|
"max-nested-callbacks": "off",
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
"files": [
|
|
|
|
"client/framework/**",
|
|
|
|
"client/scratchpad/**",
|
2018-04-09 13:14:01 +03:00
|
|
|
"client/shared/*.jsm",
|
|
|
|
"client/shared/widgets/*.jsm",
|
2018-04-11 18:10:35 +03:00
|
|
|
"client/webide/**",
|
2018-04-05 01:24:04 +03:00
|
|
|
],
|
|
|
|
"rules": {
|
|
|
|
"max-len": "off",
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
"files": [
|
|
|
|
"client/scratchpad/test/browser_scratchpad_inspect.js",
|
|
|
|
"client/scratchpad/test/browser_scratchpad_inspect_primitives.js",
|
|
|
|
],
|
|
|
|
"rules": {
|
|
|
|
"no-labels": "off",
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
"files": [
|
|
|
|
"client/framework/**",
|
|
|
|
"client/scratchpad/**",
|
2018-04-09 13:14:01 +03:00
|
|
|
"client/shared/*.jsm",
|
|
|
|
"client/shared/widgets/*.jsm",
|
2018-04-11 18:10:35 +03:00
|
|
|
"client/webide/**",
|
2018-04-05 01:24:04 +03:00
|
|
|
],
|
|
|
|
"rules": {
|
|
|
|
"mozilla/no-aArgs": "off",
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
"files": [
|
|
|
|
"client/framework/test/**",
|
|
|
|
"client/scratchpad/**",
|
|
|
|
],
|
|
|
|
"rules": {
|
|
|
|
"mozilla/var-only-at-top-level": "off",
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
"files": [
|
|
|
|
"client/framework/**",
|
|
|
|
"client/scratchpad/**",
|
2018-04-09 13:14:01 +03:00
|
|
|
"client/shared/AppCacheUtils.jsm",
|
|
|
|
"client/shared/widgets/*.jsm",
|
2018-04-11 18:10:35 +03:00
|
|
|
"client/webide/**",
|
2018-04-05 01:24:04 +03:00
|
|
|
],
|
|
|
|
"rules": {
|
|
|
|
"no-shadow": "off",
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
"files": [
|
|
|
|
"client/framework/**",
|
|
|
|
"client/scratchpad/**",
|
2018-04-11 18:10:35 +03:00
|
|
|
"client/webide/**",
|
2018-04-05 01:24:04 +03:00
|
|
|
],
|
|
|
|
"rules": {
|
|
|
|
"strict": "off",
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
"files": [
|
|
|
|
// Note: Bug 1403938 may be removing canvasdebugger, check before
|
|
|
|
// doing more work on enabling these rules.
|
|
|
|
"client/canvasdebugger/**",
|
|
|
|
// Note: Bug 1342237 may be removing shadereditor, check before
|
|
|
|
// doing more work on enabling these rules.
|
|
|
|
"client/shadereditor/**",
|
2018-04-11 18:10:35 +03:00
|
|
|
// Note: Bug 1403944 may be removing webaudioeditor, check before
|
|
|
|
// doing more work on enabling these rules.
|
|
|
|
"client/webaudioeditor/**",
|
2018-04-05 01:24:04 +03:00
|
|
|
],
|
|
|
|
"rules": {
|
|
|
|
"consistent-return": "off",
|
|
|
|
"max-len": "off",
|
|
|
|
"mozilla/no-aArgs": "off",
|
|
|
|
"mozilla/var-only-at-top-level": "off",
|
2018-04-11 18:10:35 +03:00
|
|
|
"no-redeclare": "off",
|
2018-04-05 01:24:04 +03:00
|
|
|
"no-return-assign": "off",
|
|
|
|
"no-shadow": "off",
|
|
|
|
"no-undef": "off",
|
|
|
|
"no-unused-vars": "off",
|
2018-04-11 18:10:35 +03:00
|
|
|
"no-useless-call": "off",
|
2018-04-05 01:24:04 +03:00
|
|
|
"strict": "off",
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
// For all head*.js files, turn off no-unused-vars at a global level
|
|
|
|
"files": [
|
|
|
|
"**/head*.js",
|
|
|
|
],
|
|
|
|
"rules": {
|
|
|
|
"no-unused-vars": ["error", {"args": "none", "vars": "local"}],
|
|
|
|
}
|
2018-06-08 17:46:59 +03:00
|
|
|
}, {
|
|
|
|
// Cu, Cc etc... are not available in most devtools modules loaded by require.
|
|
|
|
"files": [
|
|
|
|
"**"
|
|
|
|
],
|
|
|
|
"excludedFiles": [
|
|
|
|
// Enable the rule on JSM, test head files and some specific files.
|
|
|
|
"**/*.jsm",
|
|
|
|
"**/test/**/head.js",
|
|
|
|
"**/test/**/shared-head.js",
|
|
|
|
"client/debugger/test/mochitest/code_frame-script.js",
|
|
|
|
"client/inspector/animation-old/test/doc_frame_script.js",
|
|
|
|
"client/inspector/animation/test/doc_frame_script.js",
|
|
|
|
"client/inspector/rules/test/doc_frame_script.js",
|
|
|
|
"client/inspector/shared/test/doc_frame_script.js",
|
|
|
|
"client/jsonview/converter-observer.js",
|
|
|
|
"client/jsonview/test/doc_frame_script.js",
|
|
|
|
"client/responsive.html/browser/content.js",
|
|
|
|
"client/shared/browser-loader.js",
|
|
|
|
"server/actors/webconsole/content-process-forward.js",
|
|
|
|
"server/actors/worker/service-worker-process.js",
|
|
|
|
"server/startup/content-process.js",
|
|
|
|
"server/startup/frame.js",
|
|
|
|
"shared/base-loader.js",
|
|
|
|
"shared/worker/loader.js",
|
|
|
|
"startup/aboutdebugging-registration.js",
|
|
|
|
"startup/aboutdevtools/aboutdevtools-registration.js",
|
|
|
|
"startup/aboutdevtoolstoolbox-registration.js",
|
|
|
|
"startup/devtools-startup.js",
|
|
|
|
],
|
|
|
|
"rules": {
|
|
|
|
"mozilla/no-define-cc-etc": "off",
|
|
|
|
}
|
|
|
|
}, ],
|
2015-05-28 10:30:03 +03:00
|
|
|
"rules": {
|
|
|
|
// These are the rules that have been configured so far to match the
|
|
|
|
// devtools coding style.
|
|
|
|
|
2015-09-30 16:44:48 +03:00
|
|
|
// Rules from the mozilla plugin
|
2017-09-18 21:07:17 +03:00
|
|
|
"mozilla/no-aArgs": "error",
|
2016-11-08 23:14:19 +03:00
|
|
|
"mozilla/no-single-arg-cu-import": "error",
|
2016-01-21 20:20:13 +03:00
|
|
|
// See bug 1224289.
|
2016-11-08 23:14:19 +03:00
|
|
|
"mozilla/reject-importGlobalProperties": "error",
|
2016-08-05 22:17:17 +03:00
|
|
|
// devtools/shared/platform is special; see the README.md in that
|
|
|
|
// directory for details. We reject requires using explicit
|
|
|
|
// subdirectories of this directory.
|
2016-11-08 23:14:19 +03:00
|
|
|
"mozilla/reject-some-requires": ["error", "^devtools/shared/platform/(chome|content)/"],
|
2017-09-18 21:07:17 +03:00
|
|
|
"mozilla/var-only-at-top-level": "error",
|
2018-01-18 23:53:01 +03:00
|
|
|
"mozilla/use-chromeutils-import": ["error", {allowCu: true}],
|
2015-09-30 16:44:48 +03:00
|
|
|
|
2016-02-25 10:25:00 +03:00
|
|
|
// Rules from the React plugin
|
2016-11-08 23:14:19 +03:00
|
|
|
"react/display-name": "error",
|
|
|
|
"react/no-danger": "error",
|
|
|
|
"react/no-did-mount-set-state": "error",
|
|
|
|
"react/no-did-update-set-state": "error",
|
|
|
|
"react/no-direct-mutation-state": "error",
|
|
|
|
"react/no-unknown-property": "error",
|
2017-10-24 14:50:31 +03:00
|
|
|
"react/prefer-es6-class": ["off", "always"],
|
2016-11-08 13:33:48 +03:00
|
|
|
"react/prop-types": "error",
|
2016-11-08 23:14:19 +03:00
|
|
|
"react/sort-comp": ["error", {
|
2016-02-25 10:25:00 +03:00
|
|
|
order: [
|
2018-07-20 15:26:45 +03:00
|
|
|
"static-methods",
|
2016-05-17 21:55:33 +03:00
|
|
|
"lifecycle",
|
2016-02-25 10:25:00 +03:00
|
|
|
"everything-else",
|
|
|
|
"render"
|
2016-05-17 21:55:33 +03:00
|
|
|
],
|
|
|
|
groups: {
|
|
|
|
lifecycle: [
|
|
|
|
"displayName",
|
|
|
|
"propTypes",
|
|
|
|
"contextTypes",
|
|
|
|
"childContextTypes",
|
|
|
|
"mixins",
|
|
|
|
"statics",
|
|
|
|
"defaultProps",
|
|
|
|
"constructor",
|
|
|
|
"getDefaultProps",
|
|
|
|
"getInitialState",
|
|
|
|
"state",
|
|
|
|
"getChildContext",
|
|
|
|
"componentWillMount",
|
|
|
|
"componentDidMount",
|
|
|
|
"componentWillReceiveProps",
|
|
|
|
"shouldComponentUpdate",
|
|
|
|
"componentWillUpdate",
|
|
|
|
"componentDidUpdate",
|
|
|
|
"componentWillUnmount"
|
|
|
|
]
|
|
|
|
}
|
2016-02-25 10:25:00 +03:00
|
|
|
}],
|
|
|
|
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow using variables outside the blocks they are defined (especially
|
|
|
|
// since only let and const are used, see "no-var").
|
2016-11-08 23:14:19 +03:00
|
|
|
"block-scoped-var": "error",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Enforce one true brace style (opening brace on the same line) and avoid
|
|
|
|
// start and end braces on the same line.
|
2016-11-08 23:14:19 +03:00
|
|
|
"brace-style": ["error", "1tbs", {"allowSingleLine": false}],
|
2015-05-28 10:30:03 +03:00
|
|
|
// Require camel case names
|
2016-11-08 23:14:19 +03:00
|
|
|
"camelcase": "error",
|
2015-06-04 20:09:24 +03:00
|
|
|
// Allow trailing commas for easy list extension. Having them does not
|
|
|
|
// impair readability, but also not required either.
|
2016-11-08 23:14:19 +03:00
|
|
|
"comma-dangle": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Warn about cyclomatic complexity in functions.
|
2018-02-07 19:16:09 +03:00
|
|
|
"complexity": ["error", 53],
|
2015-05-28 10:30:03 +03:00
|
|
|
// Don't warn for inconsistent naming when capturing this (not so important
|
|
|
|
// with auto-binding fat arrow functions).
|
2016-11-08 23:14:19 +03:00
|
|
|
"consistent-this": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Enforce curly brace conventions for all control statements.
|
2016-11-08 23:14:19 +03:00
|
|
|
"curly": "error",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Don't require a default case in switch statements. Avoid being forced to
|
|
|
|
// add a bogus default when you know all possible cases are handled.
|
2016-11-08 23:14:19 +03:00
|
|
|
"default-case": "off",
|
2015-06-02 17:53:24 +03:00
|
|
|
// Enforce dots on the next line with property name.
|
2016-11-08 23:14:19 +03:00
|
|
|
"dot-location": ["error", "property"],
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow using == instead of ===, in the interest of landing something since
|
|
|
|
// the devtools codebase is split on convention here.
|
2016-11-08 23:14:19 +03:00
|
|
|
"eqeqeq": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Don't require function expressions to have a name.
|
|
|
|
// This makes the code more verbose and hard to read. Our engine already
|
|
|
|
// does a fantastic job assigning a name to the function, which includes
|
|
|
|
// the enclosing function name, and worst case you have a line number that
|
|
|
|
// you can just look up.
|
2016-11-08 23:14:19 +03:00
|
|
|
"func-names": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow use of function declarations and expressions.
|
2016-11-08 23:14:19 +03:00
|
|
|
"func-style": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Only useful in a node environment.
|
2016-11-08 23:14:19 +03:00
|
|
|
"handle-callback-err": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Tab width.
|
2017-10-09 12:54:16 +03:00
|
|
|
"indent-legacy": ["error", 2, {"SwitchCase": 1, "ArrayExpression": "first", "ObjectExpression": "first"}],
|
2015-05-28 10:30:03 +03:00
|
|
|
// Enforces spacing between keys and values in object literal properties.
|
2016-11-08 23:14:19 +03:00
|
|
|
"key-spacing": ["error", {"beforeColon": false, "afterColon": true}],
|
2015-05-28 10:30:03 +03:00
|
|
|
// Maximum length of a line.
|
2016-11-08 23:14:19 +03:00
|
|
|
"max-len": ["error", 90, 2, {
|
2016-10-18 10:38:10 +03:00
|
|
|
"ignoreUrls": true,
|
|
|
|
"ignorePattern": "data:image\/|\\s*require\\s*\\(|^\\s*loader\\.lazy|-\\*-"
|
|
|
|
}],
|
2015-05-28 10:30:03 +03:00
|
|
|
// Maximum depth callbacks can be nested.
|
2016-11-08 23:14:19 +03:00
|
|
|
"max-nested-callbacks": ["error", 3],
|
2015-05-28 10:30:03 +03:00
|
|
|
// Don't limit the number of parameters that can be used in a function.
|
2016-11-08 23:14:19 +03:00
|
|
|
"max-params": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Don't limit the maximum number of statement allowed in a function. We
|
|
|
|
// already have the complexity rule that's a better measurement.
|
2016-11-08 23:14:19 +03:00
|
|
|
"max-statements": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Require a capital letter for constructors, only check if all new
|
|
|
|
// operators are followed by a capital letter. Don't warn when capitalized
|
|
|
|
// functions are used without the new operator.
|
2016-11-08 23:14:19 +03:00
|
|
|
"new-cap": ["error", {"capIsNew": false}],
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow the omission of parentheses when invoking a constructor with no
|
|
|
|
// arguments.
|
2016-11-08 23:14:19 +03:00
|
|
|
"new-parens": "error",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow use of bitwise operators.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-bitwise": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow the catch clause parameter name being the same as a variable in
|
|
|
|
// the outer scope, to avoid confusion.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-catch-shadow": "error",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow using the console API.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-console": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow using constant expressions in conditions like while (true)
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-constant-condition": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow use of the continue statement.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-continue": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow division operators explicitly at beginning of regular expression.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-div-regex": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow empty statements. This will report an error for:
|
|
|
|
// try { something(); } catch (e) {}
|
|
|
|
// but will not report it for:
|
|
|
|
// try { something(); } catch (e) { /* Silencing the error because ...*/ }
|
|
|
|
// which is a valid use case.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-empty": "error",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow adding to native types
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-extend-native": "error",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow unnecessary parentheses, as they may make the code more readable.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-extra-parens": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow fallthrough of case statements, except if there is a comment.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-fallthrough": "error",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow the use of leading or trailing decimal points in numeric literals.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-floating-decimal": "off",
|
2017-03-21 00:06:44 +03:00
|
|
|
// Allow comments inline after code.
|
|
|
|
"no-inline-comments": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow mixing regular variable and require declarations (not a node env).
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-mixed-requires": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow use of multiple spaces (sometimes used to align const values,
|
|
|
|
// array or object items, etc.). It's hard to maintain and doesn't add that
|
|
|
|
// much benefit.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-multi-spaces": "error",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow use of multiline strings (use template strings instead).
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-multi-str": "error",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow multiple empty lines.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-multiple-empty-lines": ["error", {"max": 1}],
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow use of new operator with the require function.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-new-require": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow reassignment of function parameters.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-param-reassign": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow string concatenation with __dirname and __filename (not a node env).
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-path-concat": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow use of unary operators, ++ and --.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-plusplus": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow using process.env (not a node environment).
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-process-env": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow using process.exit (not a node environment).
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-process-exit": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow usage of __proto__ property.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-proto": "error",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow multiple spaces in a regular expression literal.
|
2017-01-04 01:47:28 +03:00
|
|
|
"no-regex-spaces": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow reserved words being used as object literal keys.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-reserved-keys": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Don't restrict usage of specified node modules (not a node environment).
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-restricted-modules": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow use of assignment in return statement. It is preferable for a
|
|
|
|
// single line of code to have only one easily predictable effect.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-return-assign": "error",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow use of javascript: urls.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-script-url": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow use of comma operator.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-sequences": "error",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Warn about declaration of variables already declared in the outer scope.
|
|
|
|
// This isn't an error because it sometimes is useful to use the same name
|
|
|
|
// in a small helper function rather than having to come up with another
|
|
|
|
// random name.
|
|
|
|
// Still, making this a warning can help people avoid being confused.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-shadow": "error",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow space between function identifier and application.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-spaced-func": "error",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow use of synchronous methods (not a node environment).
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-sync": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow the use of ternary operators.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-ternary": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow throwing literals (eg. throw "error" instead of
|
|
|
|
// throw new Error("error")).
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-throw-literal": "error",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow dangling underscores in identifiers (for privates).
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-underscore-dangle": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow use of undefined variable.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-undefined": "off",
|
2016-10-18 10:38:10 +03:00
|
|
|
// Disallow global and local variables that aren't used, but allow unused
|
|
|
|
// function arguments.
|
2018-02-22 19:55:36 +03:00
|
|
|
"no-unused-vars": ["error", {"args": "none", "vars": "all"}],
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow using variables before they are defined.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-use-before-define": "off",
|
2015-10-26 17:39:47 +03:00
|
|
|
// We use var-only-at-top-level instead of no-var as we allow top level
|
|
|
|
// vars.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-var": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow using TODO/FIXME comments.
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-warning-comments": "off",
|
2017-01-12 01:21:56 +03:00
|
|
|
// Don't require method and property shorthand syntax for object literals.
|
|
|
|
// We use this in the code a lot, but not consistently, and this seems more
|
|
|
|
// like something to check at code review time.
|
|
|
|
"object-shorthand": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow more than one variable declaration per function.
|
2016-11-08 23:14:19 +03:00
|
|
|
"one-var": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow padding within blocks.
|
2016-11-08 23:14:19 +03:00
|
|
|
"padded-blocks": ["error", "never"],
|
2018-06-01 10:54:20 +03:00
|
|
|
// Enforce using `let` only when variables are reassigned.
|
|
|
|
"prefer-const": ["error", { "destructuring": "all" }],
|
2015-05-28 10:30:03 +03:00
|
|
|
// Don't require quotes around object literal property names.
|
2016-11-08 23:14:19 +03:00
|
|
|
"quote-props": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Require use of the second argument for parseInt().
|
2016-11-08 23:14:19 +03:00
|
|
|
"radix": "error",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Enforce spacing after semicolons.
|
2016-11-08 23:14:19 +03:00
|
|
|
"semi-spacing": ["error", {"before": false, "after": true}],
|
2015-05-28 10:30:03 +03:00
|
|
|
// Don't require to sort variables within the same declaration block.
|
|
|
|
// Anyway, one-var is disabled.
|
2016-11-08 23:14:19 +03:00
|
|
|
"sort-vars": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disable the rule that checks if spaces inside {} and [] are there or not.
|
2016-11-08 23:14:19 +03:00
|
|
|
// Our code is split on conventions, and it'd be nice to have "error" rules
|
2015-05-28 10:30:03 +03:00
|
|
|
// instead, one for [] and one for {}. So, disabling until we write them.
|
2016-11-08 23:14:19 +03:00
|
|
|
"space-in-brackets": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow spaces inside parentheses.
|
2016-11-08 23:14:19 +03:00
|
|
|
"space-in-parens": ["error", "never"],
|
2015-05-28 10:30:03 +03:00
|
|
|
// Require spaces before/after unary operators (words on by default,
|
|
|
|
// nonwords off by default).
|
2016-11-08 23:14:19 +03:00
|
|
|
"space-unary-ops": ["error", { "words": true, "nonwords": false }],
|
2015-05-28 10:30:03 +03:00
|
|
|
// Require "use strict" to be defined globally in the script.
|
2016-11-08 23:14:19 +03:00
|
|
|
"strict": ["error", "global"],
|
2015-05-28 10:30:03 +03:00
|
|
|
// Warn about invalid JSDoc comments.
|
|
|
|
// Disabled for now because of https://github.com/eslint/eslint/issues/2270
|
|
|
|
// The rule fails on some jsdoc comments like in:
|
2018-04-06 09:02:58 +03:00
|
|
|
// devtools/client/webconsole/old/console-output.js
|
2016-11-08 23:14:19 +03:00
|
|
|
"valid-jsdoc": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Allow vars to be declared anywhere in the scope.
|
2016-11-08 23:14:19 +03:00
|
|
|
"vars-on-top": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Don't require immediate function invocation to be wrapped in parentheses.
|
2016-11-08 23:14:19 +03:00
|
|
|
"wrap-iife": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Don't require regex literals to be wrapped in parentheses (which
|
|
|
|
// supposedly prevent them from being mistaken for division operators).
|
2016-11-08 23:14:19 +03:00
|
|
|
"wrap-regex": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Disallow Yoda conditions (where literal value comes first).
|
2016-11-08 23:14:19 +03:00
|
|
|
"yoda": "error",
|
2015-05-28 10:30:03 +03:00
|
|
|
|
|
|
|
// And these are the rules that haven't been discussed so far, and that are
|
|
|
|
// disabled for now until we introduce them, one at a time.
|
|
|
|
|
2017-05-10 18:51:17 +03:00
|
|
|
// enforce consistent spacing before and after the arrow in arrow functions
|
|
|
|
"arrow-spacing": "off",
|
|
|
|
// enforce consistent spacing inside computed property brackets
|
|
|
|
"computed-property-spacing": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// Require for-in loops to have an if statement.
|
2016-11-08 23:14:19 +03:00
|
|
|
"guard-for-in": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// allow/disallow an empty newline after var statement
|
2016-11-08 23:14:19 +03:00
|
|
|
"newline-after-var": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow the use of alert, confirm, and prompt
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-alert": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow comparisons to null without a type-checking operator
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-eq-null": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow overwriting functions written as function declarations
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-func-assign": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow function or variable declarations in nested blocks
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-inner-declarations": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow invalid regular expression strings in the RegExp constructor
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-invalid-regexp": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow irregular whitespace outside of strings and comments
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-irregular-whitespace": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow usage of __iterator__ property
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-iterator": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow labels that share a name with a variable
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-label-var": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow unnecessary nested blocks
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-lone-blocks": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow creation of functions within loops
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-loop-func": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow negation of the left operand of an in expression
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-negated-in-lhs": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow use of new operator when not part of the assignment or
|
|
|
|
// comparison
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-new": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow use of new operator for Function object
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-new-func": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow use of the Object constructor
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-new-object": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallows creating new instances of String,Number, and Boolean
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-new-wrappers": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow the use of object properties of the global object (Math and
|
|
|
|
// JSON) as functions
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-obj-calls": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow use of octal escape sequences in string literals, such as
|
|
|
|
// var foo = "Copyright \251";
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-octal-escape": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow use of undefined when initializing variables
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-undef-init": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow usage of expressions in statement position
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-unused-expressions": "off",
|
2017-05-10 18:51:17 +03:00
|
|
|
// disallow unnecessary concatenation of literals or template literals
|
|
|
|
"no-useless-concat": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow use of void operator
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-void": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// disallow wrapping of non-IIFE statements in parens
|
2016-11-08 23:14:19 +03:00
|
|
|
"no-wrap-func": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// require assignment operator shorthand where possible or prohibit it
|
|
|
|
// entirely
|
2016-11-08 23:14:19 +03:00
|
|
|
"operator-assignment": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
// enforce operators to be placed before or after line breaks
|
2016-11-08 23:14:19 +03:00
|
|
|
"operator-linebreak": "off",
|
2015-05-28 10:30:03 +03:00
|
|
|
}
|
2016-10-18 10:38:10 +03:00
|
|
|
};
|