facebook pixelCodiga Analysis JavaScript Rules, severity error , category best practice
BACK TO LIST

JavaScript rules

The Codiga Static Analysis engine checks JavaScript code and supports many popular libraries. If you are using React, NextJS, Vue or Angular: the engine will flag any issue in your codebase. Automate your code reviews with Codiga and merge with confidence.

@typescript-eslint/ban-ts-comment

Best practice
Error

Detect any '@ts-<directive>' comment as it can reduce the effectiveness of TypeScript overall.

Learn more

@typescript-eslint/ban-types

Best practice
Error

Bans specific types and can suggest alternatives (such as String).

@typescript-eslint/explicit-function-return-type

Best practice
Error

Ensure that the values returned from functions are of the expected type

@typescript-eslint/no-empty-function

Best practice
Error

Detect any empty methods, as in methods that do not have any logic

@typescript-eslint/no-unused-expressions

Best practice
Error

Disallow unused expressions. An unused expression which has no effect on the state of the program indicates a logic error.

@typescript-eslint/no-unused-vars

Best practice
Error

Disallow unused variables. Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring

@typescript-eslint/no-var-requires

Best practice
Error

Disallows the use of require statements except in import statements

compat/compat

Best practice
Error

This rule enables linting your code for browser compatibility.

constructor-super

Best practice
Error

Constructors of derived classes must call super()

eslint-comments/no-unused-disable

Best practice
Error

Disallow unused eslint-disable comments. Make sure all your rules are defined and are used correctly.

jsx-a11y/click-events-have-key-events

Best practice
Error

Enforce onClick is accompanied by at least one of the following: onKeyUp, onKeyDown, onKeyPress

jsx-a11y/no-static-element-interactions

Best practice
Error

Disallow interactions in static elements. Static HTML elements do not have semantic meaning.

max-statements

Best practice
Error

Check max number of statements for a function

no-empty-pattern

Best practice
Error

Disallow empty destructuring patterns

no-global-assign

Best practice
Error

Disallow assignment to native objects or read-only global variables

no-redeclare

Best practice
Error

Disallow variable redeclaration

no-self-assign

Best practice
Error

Detects self assignments as they have no effect, so probably those are an error due to incomplete refactoring.

no-unused-labels

Best practice
Error

Disallow unused labels. Labels that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring.

no-useless-catch

Best practice
Error

Disallow unnecessary catch clauses

no-useless-escape

Best practice
Error

Reports unnecessary escapes, as escaping non-special characters in strings, template literals, and regular expressions doesn't have any effect.

node/no-deprecated-api

Best practice
Error

Disallow deprecated APIs

react-hooks/rules-of-hooks

Best practice
Error

React: Detects when rules of hooks are not being followed

react-native/no-color-literals

Best practice
Error

React: Disallow color literals in styles

react/destructuring-assignment

Best practice
Error

React: Enforce consistent usage of destructuring assignment of props, state, and context

react/display-name

Best practice
Error

Prevent missing displayName in a React component definition

react/forbid-prop-types

Best practice
Error

React: By default this rule prevents vague prop types with more specific alternatives available (any, array, object), but any prop type can be disabled if desired.

react/jsx-no-target-blank

Best practice
Error

React: This rules requires that you accompany target='\_blank' attributes with rel='noreferrer'.

react/no-children-prop

Best practice
Error

React: Prevent passing of children as props. Children should always be actual children, not passed in as a prop.

react/no-deprecated

Best practice
Error

React: Prevent usage of deprecated methods

react/no-find-dom-node

Best practice
Error

React: Prevent usage of findDOMNode. Facebook will eventually deprecate findDOMNode as it blocks certain improvements in React in the future.

react/no-render-return-value

Best practice
Error

React: Prevent usage of the return value of ReactDOM.render

react/no-string-refs

Best practice
Error

React: Prevent using string references

react/prop-types

Best practice
Error

React: Prevent missing props validation in a React component definition

react/require-default-props

Best practice
Error

React: Enforce a defaultProps definition for every prop that is not a required prop

react/require-render-return

Best practice
Error

React: Enforce ES5 or ES6 class for returning value in render function

react/sort-comp

Best practice
Error

React: Enforce component methods order

react/style-prop-object

Best practice
Error

React: Enforce style prop value being an object

sonarjs/no-identical-functions

Best practice
Error

When two functions have the same implementation, either it was a mistake - something else was intended - or the duplication was intentional, but may be confusing to maintainers.

standard/no-callback-literal

Best practice
Error

When invoking a callback function which uses the Node.js error-first callback pattern, all of your errors should either use the Error class or a subclass of it. It is also acceptable to use undefined or null if there is no error.

unicorn/consistent-destructuring

Best practice
Error

Use destructured variables over properties

unicorn/prefer-exponentiation-operator

Best practice
Error

Disallow the use of Math.pow in favor of the ** operator

vue/no-reserved-keys

Best practice
Error

Vue: Disallow overwriting reserved keys in Vue

vue/no-side-effects-in-computed-properties

Best practice
Error

Vue: Disallow side effects in computed properties

xo/throw-new-error

Best practice
Error

Use the new keyword when throwing an error