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.
Rules
The following rules are currently configured.
Rule | Description | Link |
---|---|---|
vuejs-accessibility/tabindex-no-positive warn | Avoid positive tabindex property values to synchronize the flow of the page with keyboard tab order | Link |
vuejs-accessibility/role-has-required-aria-props warn | Elements with ARIA roles must have all required attributes for that role | Link |
vuejs-accessibility/no-redundant-roles warn | Do not add ARIA roles when the HTML element has native semantics that are already implemented by the browser | Link |
vuejs-accessibility/no-onchange warn | Enforce usage of @blur over/in parallel with @change on select menu elements for accessibility | Link |
vuejs-accessibility/no-distracting-elements warn | Enforces that no distracting elements are used | Link |
vuejs-accessibility/no-autofocus warn | Enforce that autofocus prop is not used on elements | Link |
vuejs-accessibility/no-access-key warn | Enforce no accesskey prop on element | Link |
vuejs-accessibility/mouse-events-have-key-events warn | Enforce @mouseenter/@mouseover/@mouseout/@mouseleave/@hover are accompanied by @focus/@blur | Link |
vuejs-accessibility/interactive-supports-focus warn | Elements with an interactive role and interaction handlers (mouse or key press) must be focusable | Link |
vuejs-accessibility/iframe-has-title warn | <iframe> elements must have a unique title property to indicate its content to the user | Link |
vuejs-accessibility/heading-has-content warn | Enforce that heading elements (h1, h2, etc.) have content and that the content is accessible to screen readers | Link |
vuejs-accessibility/form-control-has-label warn | Each form element must have a programmatically associated label element | Link |
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. | Link |
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-* props | Link |
vuejs-accessibility/aria-role warn | Elements with ARIA roles must use a valid, non-abstract ARIA role | Link |
vuejs-accessibility/aria-props warn | Elements cannot use an invalid ARIA attribute | Link |
vuejs-accessibility/anchor-has-content warn | Enforce that anchors have content and that the content is accessible to screen readers | Link |
vuejs-accessibility/alt-text warn | Enforce that all elements that require alternative text have meaningful information to relay back to the end user | Link |
vue/v-on-style warn | Enforce the shorthand v-on: syntax (@) | Link |
vue/v-on-function-call warn | Enforce or forbid parentheses after method calls without arguments in v-on directives | Link |
vue/v-bind-style warn | Enforce the shorthand v-bind: syntax (😃 | Link |
vue/this-in-template warn | Disallow using "this" in template form | Link |
vue/script-indent warn | Enforce consistent indentation in <script> | Link |
vue/return-in-computed-property warn | Enforce that a return statement is present in computed property | Link |
vue/require-prop-types warn | In committed code, prop definitions should always be as detailed as possible, specifying at least type(s). | Link |
vue/require-default-prop warn | This rule requires default value to be set for each props that are not marked as required. | Link |
vue/order-in-components warn | Enforce order in Vue component data | Link |
vue/object-curly-spacing warn | Enforce consistent spacing inside braces | Link |
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. | Link |
vue/no-unused-vars warn | Disallow unused variable definitions of v-for directives or scope attributes | Link |
vue/no-textarea-mustache warn | Disallows the use of mustaches within textareas | Link |
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. | Link |
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. | Link |
vue/no-multi-spaces warn | Remove multiple spaces in a row between attributes which are not used for indentation | Link |
vue/no-duplicate-attributes warn | When duplicate arguments exist, only the last one is valid | Link |
vue/no-dupe-keys warn | Disallow duplicate key names to avoid overwriting | Link |
vue/mustache-interpolation-spacing warn | Expect one space between expression and curly brackets. | Link |
vue/max-attributes-per-line warn | Limits the maximum number of attributes/properties per line to improve readability. | Link |
vue/match-component-file-name warn | Require component name property to match its file name | Link |
vue/key-spacing warn | Enforce consistent spacing between keys and values in object literal properties | Link |
vue/html-quotes warn | Force double quote style in html syntax | Link |
vue/html-indent warn | Enforce 4 space continuous indentation | Link |
vue/html-closing-bracket-spacing warn | This rule aims to enforce consistent spacing style before closing brackets > of tags. | Link |
vue/html-closing-bracket-newline warn | Require or disallow a line break before tag's closing brackets | Link |
vue/eqeqeq warn | Require the use of === and !== | Link |
vue/component-name-in-template-casing warn | Enforce specific casing for the component naming style in template | Link |
vue/component-definition-name-casing warn | Force kebab-case component names | Link |
vue/attribute-hyphenation warn | Force attributes to be hyphenated rather than camelCase | Link |
require-jsdoc-except/require-jsdoc warn | Exclude certain methods from requiring JSDoc definitions. | Link |
netsells/no-global-timeouts warn | Prevent setTimeout and related functions being used in Vue components | Link |
netsells/no-dom-listeners warn | Prevent DOM listeners being manually added/removed using addEventListener/removeEventListener | Link |
netsells/component-file-names warn | Force Vue file names to be PascalCase | Link |
jsdoc/valid-types warn | Requires all types to be valid JSDoc or Closure compiler types without syntax errors. | Link |
jsdoc/tag-lines warn | Enforces a consistent padding of the block description. | Link |
jsdoc/require-returns-type warn | Requires that @returns tag has type value. | Link |
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. | Link |
jsdoc/require-returns warn | Requires returns are documented. Will also report if multiple @returns tags are present. | Link |
jsdoc/require-param-type warn | Requires that each @param tag has a type value. | Link |
jsdoc/require-param-name warn | Requires that all function parameters have names. | Link |
jsdoc/require-param warn | Requires that all function parameters are documented. | Link |
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. | Link |
jsdoc/require-description warn | Requires that all functions have a description. | Link |
jsdoc/no-undefined-types warn | Checks that types in jsdoc comments are defined. This can be used to check unimported types. | Link |
jsdoc/match-description warn | Enforces a regular expression pattern on descriptions to match English sentences. | Link |
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. | Link |
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 - RegExp | Link |
jsdoc/check-tag-names warn | Reports invalid block tag names. Valid block tags are available here. | Link |
jsdoc/check-syntax warn | Reports against Google Closure Compiler syntax. | Link |
jsdoc/check-param-names warn | Ensures that parameter names in JSDoc match those in the function declaration. | Link |
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 * */ | Link |
jsdoc/check-alignment warn | Reports invalid alignment of JSDoc block asterisks. | Link |
import/extensions warn | Enforces consistency across file imports, and ensures extensions are never added. | Link |
yoda warn | Discourage code typed like yoda would speak | Link |
template-curly-spacing warn | Throw a warning when a regular string contains a text which looks like a template literal placeholder | Link |
space-before-function-paren warn | Require a space before function parenthesis | Link |
semi warn | Require a semi-colon at the end of every line | Link |
quotes warn | Enforce the use of single quotes when using JavaScript | Link |
prefer-template warn | Encourage using template literals instead of '+' operator on strings | Link |
prefer-const warn | Flags variables that are defined using 'let' but then never reassigned | Link |
prefer-arrow-callback warn | Forces use of ES6 arrow function expressions | Link |
operator-linebreak warn | Enforce consistent linebreak style for operators | Link |
no-var warn | Discourage using 'var' for creating variables - require using let/const instead | Link |
no-useless-return warn | Reports the use of redundant return statements | Link |
no-use-before-define warn | Prevents use of an identifier that has not yet been declared | Link |
no-unused-vars warn | Prevents leaving unused imports & vars in code | Link |
no-unneeded-ternary warn | Disallows ternary operators when simpler alternatives exist | Link |
no-template-curly-in-string warn | Throw a warning when a regular string contains a text which looks like a template literal placeholder | Link |
no-sparse-arrays warn | Disallows array literals with empty slots | Link |
no-restricted-imports error | Disallows importing specific libraries. We disallow lodash as a whole in favour of specific imports | Link |
no-multiple-empty-lines warn | Restricts the number of allowed empty lines | Link |
no-mixed-spaces-and-tabs warn | Disallow mixed spaces and tabs for indentation | Link |
no-lonely-if warn | Discourage if statements as the only statement in else blocks | Link |
no-implicit-coercion warn | Discourage using confusing and sometimes unreadable JS tricks to do simple functions. | Link |
no-floating-decimal warn | Disallow floating decimals. | Link |
no-eval error | Disallow the use of the eval() function | Link |
no-empty-function warn | Disallow empty functions | Link |
no-empty warn | Disallow empty block statements | Link |
no-else-return warn | Disallow else blocks after return statements in if statements | Link |
no-duplicate-imports warn | Disallow duplicate imports | Link |
no-debugger warn | Disallows debugger statements | Link |
no-console warn | Disallow using the console | Link |
no-cond-assign warn | Discourage conditional assignment of variables | Link |
no-alert warn | Disallow alert() function | Link |
key-spacing warn | Enforces spacing around the colon in object literal properties | Link |
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. | Link |
eqeqeq warn | Forces equality operators to be type-safe | Link |
eol-last warn | Force new lines at end of files | Link |
dot-notation warn | Forces using dot notation exclusively for getting object properties. | Link |
dot-location warn | Discourage placing the dot on the property rather than the property | Link |
curly warn | Forces formatting of curly brace conventions | Link |
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 } | Link |
arrow-spacing warn | Requires spacing before and after arrow functions arrow | Link |
arrow-parens warn | Requires parenthesis around all arrow function arguments. | Link |