Eslint

We make use of an automated approach of enforcing JavaScript code standards. These standards are constantly evolving to ensure we are making use of the best methods, and in order to catch more edge cases ensuring our code is consistent across the board.

Documentationopen in new window

Rules

The following rules are currently configured.

RuleDescriptionLink
vuejs-accessibility/tabindex-no-positive
warn
Avoid positive tabindex property values to synchronize the flow of the page with keyboard tab orderLinkopen in new window
vuejs-accessibility/role-has-required-aria-props
warn
Elements with ARIA roles must have all required attributes for that roleLinkopen in new window
vuejs-accessibility/no-redundant-roles
warn
Do not add ARIA roles when the HTML element has native semantics that are already implemented by the browserLinkopen in new window
vuejs-accessibility/no-onchange
warn
Enforce usage of @blur over/in parallel with @change on select menu elements for accessibilityLinkopen in new window
vuejs-accessibility/no-distracting-elements
warn
Enforces that no distracting elements are usedLinkopen in new window
vuejs-accessibility/no-autofocus
warn
Enforce that autofocus prop is not used on elementsLinkopen in new window
vuejs-accessibility/no-access-key
warn
Enforce no accesskey prop on elementLinkopen in new window
vuejs-accessibility/mouse-events-have-key-events
warn
Enforce @mouseenter/@mouseover/@mouseout/@mouseleave/@hover are accompanied by @focus/@blurLinkopen in new window
vuejs-accessibility/interactive-supports-focus
warn
Elements with an interactive role and interaction handlers (mouse or key press) must be focusableLinkopen in new window
vuejs-accessibility/iframe-has-title
warn
<iframe> elements must have a unique title property to indicate its content to the userLinkopen in new window
vuejs-accessibility/heading-has-content
warn
Enforce that heading elements (h1, h2, etc.) have content and that the content is accessible to screen readersLinkopen in new window
vuejs-accessibility/form-control-has-label
warn
Each form element must have a programmatically associated label elementLinkopen in new window
vuejs-accessibility/click-events-have-key-events
warn
Enforce @click on non-interactive elements is accompanied by at least one of the following: @keyup, @keydown, @keypress.Linkopen in new window
vuejs-accessibility/aria-unsupported-elements
warn
Enforces that certain reserved DOM elements do not support ARIA roles, states, and properties do not contain the role and/or aria-* propsLinkopen in new window
vuejs-accessibility/aria-role
warn
Elements with ARIA roles must use a valid, non-abstract ARIA roleLinkopen in new window
vuejs-accessibility/aria-props
warn
Elements cannot use an invalid ARIA attributeLinkopen in new window
vuejs-accessibility/anchor-has-content
warn
Enforce that anchors have content and that the content is accessible to screen readersLinkopen in new window
vuejs-accessibility/alt-text
warn
Enforce that all elements that require alternative text have meaningful information to relay back to the end userLinkopen in new window
vue/v-on-style
warn
Enforce the shorthand v-on: syntax (@)Linkopen in new window
vue/v-on-function-call
warn
Enforce or forbid parentheses after method calls without arguments in v-on directivesLinkopen in new window
vue/v-bind-style
warn
Enforce the shorthand v-bind: syntax (😃Linkopen in new window
vue/this-in-template
warn
Disallow using "this" in template formLinkopen in new window
vue/script-indent
warn
Enforce consistent indentation in <script>Linkopen in new window
vue/return-in-computed-property
warn
Enforce that a return statement is present in computed propertyLinkopen in new window
vue/require-prop-types
warn
In committed code, prop definitions should always be as detailed as possible, specifying at least type(s).Linkopen in new window
vue/require-default-prop
warn
This rule requires default value to be set for each props that are not marked as required.Linkopen in new window
vue/order-in-components
warn
Enforce order in Vue component dataLinkopen in new window
vue/object-curly-spacing
warn
Enforce consistent spacing inside bracesLinkopen in new window
vue/no-v-html
ignore
This rule reports all uses of v-html directive in order to reduce the risk of injecting potentially unsafe / unescaped html into the browser leading to Cross-Site Scripting (XSS) attacks.Linkopen in new window
vue/no-unused-vars
warn
Disallow unused variable definitions of v-for directives or scope attributesLinkopen in new window
vue/no-textarea-mustache
warn
Disallows the use of mustaches within textareasLinkopen in new window
vue/no-side-effects-in-computed-properties
warn
It is considered a very bad practice to introduce side effects inside computed properties. It makes the code unpredictable and hard to understand.Linkopen in new window
vue/no-shared-component-data
warn
When using the data property on a component (i.e. anywhere except on new Vue), the value must be a function that returns an object.Linkopen in new window
vue/no-multi-spaces
warn
Remove multiple spaces in a row between attributes which are not used for indentationLinkopen in new window
vue/no-duplicate-attributes
warn
When duplicate arguments exist, only the last one is validLinkopen in new window
vue/no-dupe-keys
warn
Disallow duplicate key names to avoid overwritingLinkopen in new window
vue/mustache-interpolation-spacing
warn
Expect one space between expression and curly brackets.Linkopen in new window
vue/max-attributes-per-line
warn
Limits the maximum number of attributes/properties per line to improve readability.Linkopen in new window
vue/match-component-file-name
warn
Require component name property to match its file nameLinkopen in new window
vue/key-spacing
warn
Enforce consistent spacing between keys and values in object literal propertiesLinkopen in new window
vue/html-quotes
warn
Force double quote style in html syntaxLinkopen in new window
vue/html-indent
warn
Enforce 4 space continuous indentationLinkopen in new window
vue/html-closing-bracket-spacing
warn
This rule aims to enforce consistent spacing style before closing brackets > of tags.Linkopen in new window
vue/html-closing-bracket-newline
warn
Require or disallow a line break before tag's closing bracketsLinkopen in new window
vue/eqeqeq
warn
Require the use of === and !==Linkopen in new window
vue/component-name-in-template-casing
warn
Enforce specific casing for the component naming style in templateLinkopen in new window
vue/component-definition-name-casing
warn
Force kebab-case component namesLinkopen in new window
vue/attribute-hyphenation
warn
Force attributes to be hyphenated rather than camelCaseLinkopen in new window
require-jsdoc-except/require-jsdoc
warn
Exclude certain methods from requiring JSDoc definitions.Linkopen in new window
netsells/no-global-timeouts
warn
Prevent setTimeout and related functions being used in Vue componentsLinkopen in new window
netsells/no-dom-listeners
warn
Prevent DOM listeners being manually added/removed using addEventListener/removeEventListenerLinkopen in new window
netsells/component-file-names
warn
Force Vue file names to be PascalCaseLinkopen in new window
jsdoc/valid-types
warn
Requires all types to be valid JSDoc or Closure compiler types without syntax errors.Linkopen in new window
jsdoc/tag-lines
warn
Enforces a consistent padding of the block description.Linkopen in new window
jsdoc/require-returns-type
warn
Requires that @returns tag has type value.Linkopen in new window
jsdoc/require-returns-check
warn
Requires a return statement in function body if a @returns tag is specified in jsdoc comment. Will also report if multiple @returns tags are present.Linkopen in new window
jsdoc/require-returns
warn
Requires returns are documented. Will also report if multiple @returns tags are present.Linkopen in new window
jsdoc/require-param-type
warn
Requires that each @param tag has a type value.Linkopen in new window
jsdoc/require-param-name
warn
Requires that all function parameters have names.Linkopen in new window
jsdoc/require-param
warn
Requires that all function parameters are documented.Linkopen in new window
jsdoc/require-description-complete-sentence
warn
Requires that block description, explicit @description, and @param/@returns tag descriptions are written in complete sentences, i.e., - Description must start with an uppercase alphabetical character. - Paragraphs must start with an uppercase alphabetical character. - Sentences must end with a period. - Every line in a paragraph (except the first) which starts with an uppercase character must be preceded by a line ending with a period. - A colon or semi-colon followed by two line breaks is still part of the containing paragraph (unlike normal dual line breaks). - Text within inline tags {...} are not checked for sentence divisions. - Periods after items within the abbreviations option array are not treated as sentence endings.Linkopen in new window
jsdoc/require-description
warn
Requires that all functions have a description.Linkopen in new window
jsdoc/no-undefined-types
warn
Checks that types in jsdoc comments are defined. This can be used to check unimported types.Linkopen in new window
jsdoc/match-description
warn
Enforces a regular expression pattern on descriptions to match English sentences.Linkopen in new window
jsdoc/implements-on-classes
warn
Reports an issue with any non-constructor function using @implements. Constructor functions, whether marked with @class, @constructs, or being an ES6 class constructor, will not be flagged. To indicate that a function follows another function's signature, one might instead use @type to indicate the @function or @callback to which the function is adhering.Linkopen in new window
jsdoc/check-types
warn
Reports invalid types. By default, ensures that the casing of native types is the same as in this list: - undefined - null - boolean - number - bigint - string - symbol - object - Array - Function - Date - RegExpLinkopen in new window
jsdoc/check-tag-names
warn
Reports invalid block tag names. Valid block tags are available hereopen in new window.Linkopen in new window
jsdoc/check-syntax
warn
Reports against Google Closure Compiler syntax.Linkopen in new window
jsdoc/check-param-names
warn
Ensures that parameter names in JSDoc match those in the function declaration.Linkopen in new window
jsdoc/check-indentation
warn
Reports invalid padding inside JSDoc blocks. Ignores parts enclosed in Markdown "code block"'s. For example, the following description is not reported: js /** * Some description: * html *
* test *
* */
Linkopen in new window
jsdoc/check-alignment
warn
Reports invalid alignment of JSDoc block asterisks.Linkopen in new window
import/extensions
warn
Enforces consistency across file imports, and ensures extensions are never added.Linkopen in new window
yoda
warn
Discourage code typed like yoda would speakLinkopen in new window
template-curly-spacing
warn
Throw a warning when a regular string contains a text which looks like a template literal placeholderLinkopen in new window
space-before-function-paren
warn
Require a space before function parenthesisLinkopen in new window
semi
warn
Require a semi-colon at the end of every lineLinkopen in new window
quotes
warn
Enforce the use of single quotes when using JavaScriptLinkopen in new window
prefer-template
warn
Encourage using template literals instead of '+' operator on stringsLinkopen in new window
prefer-const
warn
Flags variables that are defined using 'let' but then never reassignedLinkopen in new window
prefer-arrow-callback
warn
Forces use of ES6 arrow function expressionsLinkopen in new window
operator-linebreak
warn
Enforce consistent linebreak style for operatorsLinkopen in new window
no-var
warn
Discourage using 'var' for creating variables - require using let/const insteadLinkopen in new window
no-useless-return
warn
Reports the use of redundant return statementsLinkopen in new window
no-use-before-define
warn
Prevents use of an identifier that has not yet been declaredLinkopen in new window
no-unused-vars
warn
Prevents leaving unused imports & vars in codeLinkopen in new window
no-unneeded-ternary
warn
Disallows ternary operators when simpler alternatives existLinkopen in new window
no-template-curly-in-string
warn
Throw a warning when a regular string contains a text which looks like a template literal placeholderLinkopen in new window
no-sparse-arrays
warn
Disallows array literals with empty slotsLinkopen in new window
no-restricted-imports
error
Disallows importing specific libraries. We disallow lodash as a whole in favour of specific importsLinkopen in new window
no-multiple-empty-lines
warn
Restricts the number of allowed empty linesLinkopen in new window
no-mixed-spaces-and-tabs
warn
Disallow mixed spaces and tabs for indentationLinkopen in new window
no-lonely-if
warn
Discourage if statements as the only statement in else blocksLinkopen in new window
no-implicit-coercion
warn
Discourage using confusing and sometimes unreadable JS tricks to do simple functions.Linkopen in new window
no-floating-decimal
warn
Disallow floating decimals.Linkopen in new window
no-eval
error
Disallow the use of the eval() functionLinkopen in new window
no-empty-function
warn
Disallow empty functionsLinkopen in new window
no-empty
warn
Disallow empty block statementsLinkopen in new window
no-else-return
warn
Disallow else blocks after return statements in if statementsLinkopen in new window
no-duplicate-imports
warn
Disallow duplicate importsLinkopen in new window
no-debugger
warn
Disallows debugger statementsLinkopen in new window
no-console
warn
Disallow using the consoleLinkopen in new window
no-cond-assign
warn
Discourage conditional assignment of variablesLinkopen in new window
no-alert
warn
Disallow alert() functionLinkopen in new window
key-spacing
warn
Enforces spacing around the colon in object literal propertiesLinkopen in new window
indent
warn
This rule enforces a consistent indentation style. It is turned off for *.vue files as the indentation for these is governed by vue/script-indent.Linkopen in new window
eqeqeq
warn
Forces equality operators to be type-safeLinkopen in new window
eol-last
warn
Force new lines at end of filesLinkopen in new window
dot-notation
warn
Forces using dot notation exclusively for getting object properties.Linkopen in new window
dot-location
warn
Discourage placing the dot on the property rather than the propertyLinkopen in new window
curly
warn
Forces formatting of curly brace conventionsLinkopen in new window
comma-dangle
warn
Requires trailing commas when the last element or property is in a different line than the closing ] or } and disallows trailing commas when the last element or property is on the same line as the closing ] or }Linkopen in new window
arrow-spacing
warn
Requires spacing before and after arrow functions arrowLinkopen in new window
arrow-parens
warn
Requires parenthesis around all arrow function arguments.Linkopen in new window