facebook pixelJavaScript Static Analysis Rules
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
      High

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

      Learn more

      @typescript-eslint/ban-types

      Best practice
      High

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

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

      Best practice
      High

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

      @typescript-eslint/no-empty-function

      Best practice
      High

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

      @typescript-eslint/no-unused-expressions

      Best practice
      High

      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
      High

      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
      High

      Disallows the use of require statements except in import statements

      compat/compat

      Best practice
      High

      This rule enables linting your code for browser compatibility.

      constructor-super

      Best practice
      High

      Constructors of derived classes must call super()

      eslint-comments/no-unused-disable

      Best practice
      High

      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
      High

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

      jsx-a11y/no-static-element-interactions

      Best practice
      High

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

      max-statements

      Best practice
      High

      Check max number of statements for a function

      no-empty-pattern

      Best practice
      High

      Disallow empty destructuring patterns

      no-global-assign

      Best practice
      High

      Disallow assignment to native objects or read-only global variables

      no-redeclare

      Best practice
      High

      Disallow variable redeclaration

      no-self-assign

      Best practice
      High

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

      no-unused-labels

      Best practice
      High

      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
      High

      Disallow unnecessary catch clauses

      no-useless-escape

      Best practice
      High

      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
      High

      Disallow deprecated APIs

      react-hooks/rules-of-hooks

      Best practice
      High

      React: Detects when rules of hooks are not being followed

      react-native/no-color-literals

      Best practice
      High

      React: Disallow color literals in styles

      react/destructuring-assignment

      Best practice
      High

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

      react/display-name

      Best practice
      High

      Prevent missing displayName in a React component definition

      react/forbid-prop-types

      Best practice
      High

      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
      High

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

      react/no-children-prop

      Best practice
      High

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

      react/no-deprecated

      Best practice
      High

      React: Prevent usage of deprecated methods

      react/no-find-dom-node

      Best practice
      High

      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
      High

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

      react/no-string-refs

      Best practice
      High

      React: Prevent using string references

      react/prop-types

      Best practice
      High

      React: Prevent missing props validation in a React component definition

      react/require-default-props

      Best practice
      High

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

      react/require-render-return

      Best practice
      High

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

      react/sort-comp

      Best practice
      High

      React: Enforce component methods order

      react/style-prop-object

      Best practice
      High

      React: Enforce style prop value being an object

      sonarjs/no-identical-functions

      Best practice
      High

      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
      High

      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
      High

      Use destructured variables over properties

      unicorn/prefer-exponentiation-operator

      Best practice
      High

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

      vue/no-reserved-keys

      Best practice
      High

      Vue: Disallow overwriting reserved keys in Vue

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

      Best practice
      High

      Vue: Disallow side effects in computed properties

      xo/throw-new-error

      Best practice
      High

      Use the new keyword when throwing an error