JavaScript

JavaScript

Made by DeepSource
Syntax error JS-0833
Bug risk
Minor

Found non-compliant syntax. Confirm that there are no syntax errors before committing your code to a version control system.

Disallow unnecessary route path option JS-0809
Bug risk
Minor
Autofix

When defining a route, it's not necessary to specify the path option if it matches the route name.

Found usage of deprecated javascript: URLs JS-0421
Bug risk
Critical

URLs starting with javascript: are a dangerous attack surface because it's easy to accidentally include the unsanitized output in a tag like <a href> and create a security hole for XSS. The developers can use the React event handlers e.g. onChange, onClick etc.

Found control characters in regular expressions JS-0004
Bug risk
Major

Control characters are special, invisible characters in the ASCII range 0-31. These characters are rarely used in JavaScript strings, so a regular expression containing these characters is most likely a mistake.

Invalid regular expression strings present in RegExp constructors JS-0017
Bug risk
Major

An invalid pattern in a regular expression literal results in a SyntaxError when the code is parsed, but an invalid string in a RegExp constructor throws a SyntaxError only when the code is executed.

Use head property in component as a function JS-W1013
Bug risk
Major
Autofix

It is recommended to use head as a function as it provides access to more data through this.

Found reassigning const variables JS-0230
Bug risk
Major

Re-assigning a variable that was declared with the const keyword can lead to a TypeError.

Properties of $slots should be used as a function JS-0658
Bug risk
Major

this.$slots.default was an array of VNode in Vue.js 2.x, but changed to a function that returns an array of VNode in Vue.js 3.x.

Disallow the use of reserved names in component definitions JS-0707
Bug risk
Minor

There should not be name collisions between Vue components, standard HTML elements and built-in components.

Disallow unused properties JS-0715
Bug risk
Minor

Unused properties should be eliminated.

Use of deprecated $cookieStore JS-0530
Bug risk
Major
Autofix

The $cookieStore service has been deprecated since Angular 1.4. Use the $cookies service instead.

Prefer not to use labels that share a name with a variable JS-0121
Bug risk
Minor

Create clearer code by disallowing the bad practice of creating a label that shares a name with a variable that is in scope.

Should not use needs to load other controllers JS-0770
Bug risk
Minor

Avoid using needs to load other controllers. Inject the required controller instead. needs was deprecated in ember 1.x and removed in 2.0.

Avoid direct mutation of this.state JS-0444
Bug risk
Major

The only good place to assign this.state is in an ES6 class component constructor.

It is not recommended to mutate this.state directly, as calling setState() afterward may replace the mutation. You should treat this.state as if it were immutable.

Found duplicate arguments in function definitions JS-0006
Bug risk
Major

If more than one parameter in the function definition has the same name, the last occurrence "shadows" the preceding occurrences. A duplicated name might be a typo, and may confuse anyone reading the code.

Race condition in compound assignment JS-0040
Bug risk
Major

When writing asynchronous code, it is possible to create subtle race condition bugs. Consider the following example:

function or var declarations in nested blocks is not preferred JS-0016
Bug risk
Major

Function declarations (with the function keyword) and variable declarations should preferably be in the root of a program or the body of a function. Having nested function declarations inside blocks may have unexpected results at runtime due to hoisting.

Detected the assignment to exports JS-0256
Bug risk
Major

This rule is aimed at disallowing exports = {}, but allows module.exports = exports = {} to avoid conflict with node/exports-style rule's allowBatchAssign option.

Found redeclared variables JS-0085
Bug risk
Minor

The var keyword is soft-deprecated, and should not be used to redeclare existing variables.

Found unused expressions JS-0093
Bug risk
Minor
Autofix

An unused expression that does not affect the state of the program indicates a logic error.