.eslintrc.yaml
extends:
- "eslint:recommended"
- "jquery"
- "plugin:prettier/recommended"
# Accept `window`, etc.
env:
browser: true
# Known globals (`false`: read-only)
globals:
define: false
require: false
module: false
jQuery: false
# Custom rules (see https://eslint.org/docs/rules/ )
# 0:off, 1:warn, 2:error
rules:
# --- Best Practices ---------------------------------------------------------
block-scoped-var: warn
# complexity: [warn, 20]
# consistent-return: warn
no-alert: error
no-caller: error
guard-for-in: warn
# linebreak-style: warn
no-else-return: warn
# no-empty-function: warn
no-extend-native: error
no-eval: error
no-floating-decimal: error
no-implied-eval: error
# no-invalid-this: warn
no-labels: warn
no-lone-blocks: warn
no-loop-func: warn
no-new: error
no-new-func: warn
no-new-wrappers: warn
no-octal-escape: warn
no-return-assign: warn
no-script-url: warn
no-self-compare: warn
no-sequences: warn
no-throw-literal: error
no-unmodified-loop-condition: warn
no-unused-expressions: error
# Not enabled because we want to allow `self._superApply(self, args)`:
# no-useless-call: warn
no-useless-catch: warn
no-useless-return: warn
no-with: warn
prefer-promise-reject-errors: warn
radix: error
# vars-on-top: warn
wrap-iife:
- error
- any
yoda: warn
# --- Strict Mode ------------------------------------------------------------
# strict: error
# --- Variables --------------------------------------------------------------
# init-declarations: ["warn", "always"]
no-label-var: error
# no-shadow: warn
no-shadow-restricted-names: error
no-undef: error
no-undef-init: warn
# no-undefined: warn
no-use-before-define: error
# - error
# - functions: false
# --- Stylistic Issues -------------------------------------------------------
camelcase: error
# Not enabled because sometimes we set `node = this`:
# consistent-this: [warn, self] # use `self = this`
func-name-matching: warn
new-cap:
- error
- { "capIsNewExceptionPattern": "^\\$\\.." } # Allow `d = $.Deferred()`
no-bitwise: error
# no-multi-assign: warn
no-negated-condition: warn
no-unneeded-ternary: warn
no-new-object: error
one-var: # see also no-use-before-define
- warn
- consecutive
# one-var-declaration-per-line: warn
# --- Possible Errors --------------------------------------------------------
curly: error
eqeqeq: ["error", "always", {"null": "ignore"}]
no-cond-assign:
- error
- except-parens
no-constant-condition:
- error
- { "checkLoops": false }
no-empty:
- error
- {allowEmptyCatch: true}
# no-extra-parens: [warn, all, {conditionalAssign: false }]
no-nested-ternary: warn
no-unused-vars:
- error
# Allow unused vars in catch() and if start with '_'
- {args: none, caughtErrors: none, varsIgnorePattern: "^_" }