Skip to content

lb-/eslint-config-wagtail

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm Build status

Shareable ESLint config for Wagtail, based on airbnb/javascript.

The package provides Wagtail's .eslintrc as an extensible shared config.

Usage

Our default export contains all of our ESLint rules, including Airbnb's config (which has ECMAScript 6 and React). It requires eslint, as well as the configuration’s peer dependencies.

# npm v7 and up:
npm install --save-dev @wagtail/eslint-config-wagtail@latest
# npm v6 and below:
npx install-peerdeps --dev @wagtail/eslint-config-wagtail@latest

Links

Code style

Write JavaScript according to the Airbnb Styleguide, with some exceptions:

  • Use soft-tabs with a two space indent. Spaces are the only way to guarantee code renders the same in any person’s environment.
  • We accept snake_case in object properties, such as ajaxResponse.page_title, however camelCase or UPPER_CASE should be used everywhere else.

Contribution Guidelines

Install

  • Required Node
  • We recommend using nvm
  • Clone the project on to your computer
  • Run nvm install to ensure you have the correct Node version
  • Run npm install to install project dependencies
  • Ensure your editor is set up to use editorconfig, Prettier and Eslint

Development

  • Run nvm use to set Node to the correct version
  • Run tests via npm run test
  • Run linting via npm run lint
  • Run preflight checks before commiting final code via npm run preflight
  • Note: When working with the rule set, only modify the index.js file, not the .eslintrc file as it is for local linting only

Rules

Rule Severity Config
array-callback-return error {"allowImplicit":true,"checkForEach":false,"allowVoid":false}
arrow-body-style error "as-needed", {"requireReturnForObjectLiteral":false}
block-scoped-var error
camelcase error see Config
consistent-return error
constructor-super error
default-case error {"commentPattern":"^no default$"}
default-case-last error
default-param-last error
dot-notation error {"allowKeywords":true,"allowPattern":""}
eqeqeq error "always", {"null":"ignore"}
for-direction error
func-names warn
getter-return error {"allowImplicit":true}
global-require error
grouped-accessor-pairs error
guard-for-in error
id-length warn {"min":2,"exceptions":["x","y","e","i","j","k","d","n","_","$"]}
import/export error
import/extensions error "ignorePackages", {"js":"never","mjs":"never","jsx":"never"}
import/first error
import/named error
import/newline-after-import error
import/no-absolute-path error
import/no-amd error
import/no-cycle error see Config
import/no-duplicates error
import/no-dynamic-require error
import/no-extraneous-dependencies error see Config
import/no-import-module-exports error {"exceptions":[]}
import/no-mutable-exports error
import/no-named-as-default error
import/no-named-as-default-member error
import/no-named-default error
import/no-relative-packages error
import/no-self-import error
import/no-unresolved error {"commonjs":true,"caseSensitive":true,"caseSensitiveStrict":false}
import/no-useless-path-segments error {"commonjs":true}
import/no-webpack-loader-syntax error
import/order error see Config
import/prefer-default-export error
jsx-a11y/alt-text error see Config
jsx-a11y/anchor-has-content error {"components":[]}
jsx-a11y/anchor-is-valid error see Config
jsx-a11y/aria-activedescendant-has-tabindex error
jsx-a11y/aria-props error
jsx-a11y/aria-proptypes error
jsx-a11y/aria-role error {"ignoreNonDOM":false}
jsx-a11y/aria-unsupported-elements error
jsx-a11y/click-events-have-key-events error
jsx-a11y/control-has-associated-label error see Config
jsx-a11y/heading-has-content error {"components":[""]}
jsx-a11y/html-has-lang error
jsx-a11y/iframe-has-title error
jsx-a11y/img-redundant-alt error
jsx-a11y/interactive-supports-focus error
jsx-a11y/label-has-associated-control error see Config
jsx-a11y/lang error
jsx-a11y/media-has-caption error {"audio":[],"video":[],"track":[]}
jsx-a11y/mouse-events-have-key-events error
jsx-a11y/no-access-key error
jsx-a11y/no-autofocus error {"ignoreNonDOM":true}
jsx-a11y/no-distracting-elements error {"elements":["marquee","blink"]}
jsx-a11y/no-interactive-element-to-noninteractive-role error {"tr":["none","presentation"]}
jsx-a11y/no-noninteractive-element-interactions error see Config
jsx-a11y/no-noninteractive-element-to-interactive-role error see Config
jsx-a11y/no-noninteractive-tabindex error {"tags":[],"roles":["tabpanel"]}
jsx-a11y/no-redundant-roles error
jsx-a11y/no-static-element-interactions error see Config
jsx-a11y/role-has-required-aria-props error
jsx-a11y/role-supports-aria-props error
jsx-a11y/scope error
jsx-a11y/tabindex-no-positive error
lines-around-directive error {"before":"always","after":"always"}
lines-between-class-members error "always", {"exceptAfterSingleLine":false}
new-cap error see Config
no-alert warn
no-array-constructor error
no-async-promise-executor error
no-await-in-loop error
no-bitwise error
no-buffer-constructor error
no-caller error
no-case-declarations error
no-class-assign error
no-compare-neg-zero error
no-cond-assign error "always"
no-console warn
no-const-assign error
no-constant-binary-expression error
no-constant-condition warn
no-constructor-return error
no-continue error
no-control-regex error
no-debugger error
no-delete-var error
no-dupe-args error
no-dupe-class-members error
no-dupe-else-if error
no-dupe-keys error
no-duplicate-case error
no-else-return error {"allowElseIf":false}
no-empty error
no-empty-character-class error
no-empty-function error {"allow":["arrowFunctions","functions","methods"]}
no-empty-pattern error
no-eval error
no-ex-assign error
no-extend-native error
no-extra-bind error
no-extra-boolean-cast error
no-extra-label error
no-fallthrough error
no-func-assign error
no-global-assign error {"exceptions":[]}
no-implied-eval error
no-import-assign error
no-inner-declarations error
no-invalid-regexp error
no-irregular-whitespace error
no-iterator error
no-label-var error
no-labels error {"allowLoop":false,"allowSwitch":false}
no-lone-blocks error
no-lonely-if error
no-loop-func error
no-loss-of-precision error
no-misleading-character-class error
no-multi-assign error
no-multi-str error
no-nested-ternary error
no-new warn
no-new-func error
no-new-object error
no-new-require error
no-new-symbol error
no-new-wrappers error
no-nonoctal-decimal-escape error
no-obj-calls error
no-octal error
no-octal-escape error
no-param-reassign error see Config
no-path-concat error
no-plusplus error
no-promise-executor-return error
no-proto error
no-prototype-builtins error
no-redeclare error
no-regex-spaces error
no-restricted-exports error {"restrictedNamedExports":["default","then"]}
no-restricted-globals error see Config
no-restricted-properties error see Config
no-restricted-syntax error see Config
no-return-assign error "always"
no-return-await error
no-script-url error
no-self-assign error {"props":true}
no-self-compare error
no-sequences error
no-setter-return error
no-shadow error
no-shadow-restricted-names error
no-sparse-arrays error
no-template-curly-in-string error
no-this-before-super error
no-throw-literal error
no-undef error
no-undef-init error
no-underscore-dangle error see Config
no-unneeded-ternary error {"defaultAssignment":false}
no-unreachable error
no-unreachable-loop error {"ignore":[]}
no-unsafe-finally error
no-unsafe-negation error
no-unsafe-optional-chaining error {"disallowArithmeticOperators":true}
no-unused-expressions error see Config
no-unused-labels error
no-unused-vars error {"vars":"all","args":"after-used","ignoreRestSiblings":true}
no-use-before-define error {"functions":true,"classes":true,"variables":true}
no-useless-backreference error
no-useless-catch error
no-useless-computed-key error
no-useless-concat error
no-useless-constructor error
no-useless-escape error
no-useless-rename error {"ignoreDestructuring":false,"ignoreImport":false,"ignoreExport":false}
no-useless-return error
no-void error
no-with error
object-shorthand error "methods"
one-var error "never"
operator-assignment error "always"
prefer-arrow-callback error {"allowNamedFunctions":false,"allowUnboundThis":true}
prefer-const error {"destructuring":"any","ignoreReadBeforeAssign":true}
prefer-destructuring error see Config
prefer-exponentiation-operator error
prefer-numeric-literals error
prefer-object-spread error
prefer-promise-reject-errors error {"allowEmptyReject":true}
prefer-regex-literals error {"disallowRedundantWrapping":true}
prefer-rest-params error
prefer-spread error
radix error
react-hooks/exhaustive-deps error
react-hooks/rules-of-hooks error
react/button-has-type error {"button":true,"submit":true,"reset":false}
react/default-props-match-prop-types error {"allowRequiredDefaults":false}
react/destructuring-assignment error "always"
react/forbid-foreign-prop-types warn {"allowInPropTypes":true}
react/forbid-prop-types error see Config
react/function-component-definition error see Config
react/jsx-curly-brace-presence error {"props":"never","children":"never"}
react/jsx-filename-extension error {"extensions":[".jsx"]}
react/jsx-fragments error "syntax"
react/jsx-no-comment-textnodes error
react/jsx-no-constructed-context-values error
react/jsx-no-duplicate-props error {"ignoreCase":true}
react/jsx-no-script-url error [{"name":"Link","props":["to"]}]
react/jsx-no-target-blank error {"enforceDynamicLinks":"always","links":true,"forms":false}
react/jsx-no-undef error
react/jsx-no-useless-fragment error
react/jsx-pascal-case error {"allowAllCaps":true,"ignore":[]}
react/jsx-props-no-spreading error see Config
react/jsx-uses-react error
react/jsx-uses-vars error
react/no-access-state-in-setstate error
react/no-array-index-key error
react/no-arrow-function-lifecycle error
react/no-children-prop error
react/no-danger warn
react/no-danger-with-children error
react/no-deprecated error
react/no-did-update-set-state error
react/no-find-dom-node error
react/no-invalid-html-attribute error
react/no-is-mounted error
react/no-namespace error
react/no-redundant-should-component-update error
react/no-render-return-value error
react/no-string-refs error
react/no-this-in-sfc error
react/no-typos error
react/no-unescaped-entities error
react/no-unknown-property error
react/no-unstable-nested-components error
react/no-unused-class-component-methods error
react/no-unused-prop-types error {"customValidators":[],"skipShapeProps":true}
react/no-unused-state error
react/no-will-update-set-state error
react/prefer-exact-props error
react/prefer-stateless-function error {"ignorePureComponents":true}
react/react-in-jsx-scope error
react/require-default-props error {"forbidDefaultForRequired":true}
react/require-render-return error
react/self-closing-comp error
react/state-in-constructor error "always"
react/static-property-placement error "property assignment"
react/style-prop-object error
react/void-dom-elements-no-children error
require-yield error
spaced-comment error see Config
strict error "never"
symbol-description error
unicode-bom error "never"
use-isnan error
valid-typeof error {"requireStringLiterals":true}
vars-on-top error
yoda error

Packages

No packages published

Languages

  • JavaScript 100.0%