for-of
loop for array JS-0361A for-of
loop is recommended when the loop index is only used to read from the collection.
Found non-compliant syntax. Confirm that there are no syntax errors before committing your code to a version control system.
path
option JS-0809When defining a route, it's not necessary to specify the path
option if it matches the route name.
In an effort to prevent further confusion between custom TypeScript modules and the new ES2015 modules, starting with TypeScript v1.5
the keyword namespace is now the preferred way to declare custom TypeScript modules. Use the namespace keyword instead of the module keyword to declare custom TypeScript modules.
javascript:
URLs JS-0421URLs 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.
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.
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.
head
property in component as a function JS-W1013It is recommended to use head
as a function as it provides access to more data through this
.
Name property in a SFC module is mostly a convenience for debugging. It's also helpful for recursion.
Re-assigning a variable that was declared with the const
keyword can lead to a TypeError
.
$slots
should be used as a function JS-0658this.$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.
There should not be name collisions between Vue components, standard HTML elements and built-in components.
Unused properties should be eliminated.
v-bind
directives JS-0717The v-bind
with a string literal value can be changed to a static attribute definition.
$cookieStore
JS-0530The $cookieStore
service has been deprecated since Angular 1.4.
Use the $cookies
service instead.
Comparing a variable against itself is usually an error, either a typo or refactoring error. It is confusing to the reader and may potentially introduce a runtime error. The only time you would compare a variable against itself is when you are testing for NaN
.
Create clearer code by disallowing the bad practice of creating a label that shares a name with a variable that is in scope.
needs
to load other controllers JS-0770Avoid using needs
to load other controllers. Inject the required controller instead. needs
was deprecated in ember 1.x and removed in 2.0.
Having empty functions hurts readability, and is considered a code-smell. There's almost always a way to avoid using them. If you must use one, consider adding a comment to inform the reader of its purpose.
This rule prevents passing of props to elements. This rule only applies to DOM Nodes (e.g. <div />
) and not Components (e.g. <Component />
). The list of forbidden props can be customized with the forbid option.