DuckDuckGo JavaScript Style Guide
To lint all our JavaScript we make use of ESLint. This repository contains our default linting configuration.
What follows is a high-level summary of how we've applied ESLint's rules:
Best Practices
- complexity
- consistent-return
- eqeqeq
- curly
- dot-location
- dot-notation
- no-case-declarations
- no-else-return
- no-empty-function
- no-empty-pattern
- no-eq-null
- no-eval
- no-extend-native
- no-extra-bind
- no-fallthrough
- no-floating-decimal
- no-global-assign
- no-invalid-this
- no-lone-blocks
- no-loop-func
- no-octal
- no-proto
- no-redeclare
- no-return-assign
- no-script-url
- no-self-assign
- no-self-compare
- no-sequences
- no-useless-return
- no-with
- radix
- yoda
- no-unmodified-loop-condition
- no-multi-spaces
- no-multi-str
- no-implied-eval
- no-useless-escape
- no-iterator
Possible Errors
- no-cond-assign
- no-constant-condition
- no-control-regex
- no-debugger
- no-dupe-args
- no-dupe-keys
- no-duplicate-case
- no-empty-character-class
- no-empty
- no-ex-assign
- no-extra-boolean-cast
- no-extra-parens
- no-extra-semi
- no-func-assign
- no-inner-declarations
- no-invalid-regexp
- no-irregular-whitespace
- no-obj-calls
- no-prototype-builtins
- no-regex-spaces
- no-sparse-arrays
- no-unexpected-multiline
- no-unreachable
- no-unsafe-finally
- no-unsafe-negation
- use-isnan
- valid-typeof
- no-compare-neg-zero
Stylistic Issues
- array-bracket-spacing
- block-spacing
- brace-style
- camelcase
- comma-dangle
- comma-style
- semi
- comma-spacing
- computed-property-spacing
- consistent-this
- eol-last
- func-call-spacing
- new-parens
- newline-per-chained-call
- no-array-constructor
- no-bitwise
- no-lonely-if
- spaced-comment
- space-unary-ops
- linebreak-style
- no-mixed-spaces-and-tabs
- space-before-function-paren
- space-in-parens
- space-infix-ops
- semi-spacing
- no-multiple-empty-lines
- no-new-object
- no-tabs
- no-trailing-spaces
- no-spaced-func
- operator-assignment
- one-var-declaration-per-line
- no-whitespace-before-property
- no-unneeded-ternary
- object-curly-spacing
- object-property-newline
- key-spacing
- space-before-blocks
- keyword-spacing
- max-len
- new-cap
- no-restricted-syntax
- no-plusplus
- no-nested-ternary
- padded-blocks
- no-mixed-operators
- quote-props
- max-depth
- max-params
- padding-line-between-statements
- quotes
- unicode-bom