facebook pixelCodiga Analysis TypeScript Rules, severity error
BACK TO LIST

TypeScript rules

The Codiga Static Analysis engine checks TypeScript 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.

@angular-eslint/component-class-suffix

Code style
Error

Detect if component doesn't have a descriptive suffix depending on its use, such as Component, Directive, Module, Pipe, or Service

Learn more

@angular-eslint/component-selector

Unknown
Error

Detect if component selector isn't a hyphenated, lowercase value or doesn't have a descriptive prefix to represent the feature area or the application itself.

@angular-eslint/directive-selector

Best practice
Error

Detect if directive selector isn't a hyphenated, lowercase value or doesn't have a descriptive prefix to represent the feature area or the application itself.

@angular-eslint/no-empty-lifecycle-method

Design
Error

Detect empty lifecycle methods

@angular-eslint/no-output-on-prefix

Best practice
Error

Prevent any Output values with prefix 'on' as this prefix should be used only for event handler methods to follow web conventions

@angular-eslint/prefer-on-push-component-change-detection

Design
Error

Prefer ChangeDetectionStrategy.OnPush as the changeDetection strategy for your @Component

@angular-eslint/use-component-view-encapsulation

Design
Error

Detect any component encapsulation that is ViewEncapsulation.None. It should be either ViewEncapsulation.ShadowDom or ViewEncapsulation.Emulated

@angular-eslint/use-lifecycle-interface

Design
Error

Detect if there are missing any implements keyword for every lifecycle hook you use (e.g if using the lifecycle method ngAfterViewInit, the AfterViewInit interface should be implemented)

@next/next/link-passhref

Best practice
Error

Detect any <Link> without an <a> child, they should have passHref=true parameter

@next/next/no-img-element

Best practice
Error

Detect any native <img> element, it should be replaced by the <Image /> component

@no-var-requires

Best practice
Error

Detect the assignation of a require import to a var such as 'var module = require("module")'.

@typescript-eslint/adjacent-overload-signatures

Best practice
Error

Require that member overloads be consecutive.

@typescript-eslint/ban-types

Best practice
Error

Detect any types that are banned (such as String).

@typescript-eslint/no-empty-function

Best practice
Error

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

@typescript-eslint/no-extra-non-null-assertion

Best practice
Error

Detect extra null assertions, there should be just a single null assertion in a expression

@typescript-eslint/no-inferrable-types

Best practice
Error

Detect any explicit types that can easily be inferred by the compiler

@typescript-eslint/no-misused-new

Best practice
Error

Detect any interfaces that are being initialized with "new", as only classes should be initialized with "new"

@typescript-eslint/no-namespace

Best practice
Error

Disallow the use of custom TypeScript modules and namespaces

@typescript-eslint/no-non-null-asserted-optional-chain

Error prone
Error

Disallows using a non-null assertion after an optional chain expression

@typescript-eslint/no-this-alias

Best practice
Error

Disallow aliasing this

fp/no-mutating-assign

Best practice
Error

Forbid the use of Object.assign() with a variable as first argument

fp/no-mutation

Best practice
Error

Forbid the use of mutating operators

fp/no-rest-parameters

Best practice
Error

Forbid the use of rest parameters

fp/no-throw

Best practice
Error

Forbid the use of throw

import/dynamic-import-chunkname

Best practice
Error

Detect missing webpackChunkName in any dynamic imports

import/export

Best practice
Error

Detect any error with your imports and exports, like more than one default export or redundant imports.

import/first

Best practice
Error

Detect non-import statements before an import statement

import/max-dependencies

Design
Error

Detect if there are too many dependencies in one module according to settings

import/no-cycle

Error prone
Error

Detect dependency cycles from your project as in two modules depending on each other

import/no-named-as-default

Best practice
Error

Reports use of an exported name as the locally imported name of a default export.

import/no-named-default

Best practice
Error

Reports use of a default export as a locally named import.

import/no-namespace

Code style
Error

Enforce a convention of not using namespace (a.k.a. "wildcard" *) imports.

jest/no-disabled-tests

Best practice
Error

Disallow disabled tests

jest/no-done-callback

Best practice
Error

Avoid using a callback in asynchronous tests and hooks (no-done-callback)

jest/no-restricted-matchers

Best practice
Error

Disallow specific matchers & modifiers.

jest/prefer-called-with

Best practice
Error

Suggest using toBeCalledWith() or toHaveBeenCalledWith()

jest/require-top-level-describe

Best practice
Error

Require test cases and hooks to be inside a describe block

jsx-a11y/aria-proptypes

Best practice
Error

ARIA state and property values must be valid.

jsx-a11y/no-autofocus

Best practice
Error

Enforce that autoFocus prop is not used on elements. Autofocusing elements can cause usability issues for sighted and non-sighted users, alike.

jsx-a11y/role-supports-aria-props

Best practice
Error

Enforce that elements with explicit or implicit roles defined contain only aria-* properties supported by that role.

no-async-promise-executor

Error prone
Error

Promise executor functions should not be async.

no-case-declarations

Best practice
Error

Disallows lexical declarations (let, const, function and class) in case/default clauses.

no-compare-neg-zero

Error prone
Error

Detect the use of operator (e.g <=, <, ===, etc) to compare against -0.

no-constant-condition

Error prone
Error

Disallows constant expressions in the test condition of: if, for, while, do...while, or ternary operations (?:)

no-control-regex

Error prone
Error

Disallow control characters in regular expressions.

no-debugger

Error prone
Error

Detects any debugger statement

no-empty

Error prone
Error

Disallow empty block statements.

no-empty-pattern

Best practice
Error

Disallow empty destructuring patterns

no-extra-boolean-cast

Error prone
Error

Disallows unnecessary boolean casts.

no-mixed-spaces-and-tabs

Code style
Error

Detects when there are mixed spaces and tabs in a module definition

no-prototype-builtins

Error prone
Error

Disallows calling some Object.prototype methods directly on object instances.

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-sparse-arrays

Error prone
Error

Disallows sparse array literals which have "holes" where commas are not preceded by elements.

no-useless-catch

Best practice
Error

Reports catch clauses that only throw the caught error.

no-useless-escape

Best practice
Error

Disallow unnecessary escape usage

no-var

Code style
Error

Disallows var definition

prefer-const

Code style
Error

Suggest using const instead of var or let

prefer-rest-params

Code style
Error

Suggest using the rest parameters instead of arguments

prefer-spread

Code style
Error

Suggest using spread syntax instead of .apply()

react-hooks/exhaustive-deps

Best practice
Error

Incorrect use of hooks

react-native/no-raw-text

Best practice
Error

Detect raw text outside of Text component

react/display-name

Best practice
Error

Component definition is missing display name

react/forbid-component-props

Best practice
Error

By default this rule prevents passing of props that add lots of complexity (className, style) to Components.

react/jsx-boolean-value

Best practice
Error

Enforce boolean attributes notation in JSX

react/jsx-key

Error prone
Error

Detect missing key prop

react/jsx-no-bind

Performance
Error

Disallows .bind() or Arrow Functions in JSX Props as it can be bad for performance

react/jsx-no-comment-textnodes

Error prone
Error

Prevents comment strings (e.g. beginning with // or /*) from being accidentally injected as a text node in JSX statements.

react/jsx-no-literals

Best practice
Error

Disallow the usage of string literals inside JSX components

react/jsx-no-undef

Error prone
Error

Disallow undeclared variables in JSX

react/jsx-no-useless-fragment

Performance
Error

Disallow unnecessary fragments

react/jsx-props-no-spreading

Best practice
Error

Disallow JSX props spreading

react/no-children-prop

Best practice
Error

Prevent passing of children as props

react/no-did-update-set-state

Performance
Error

Prevent usage of setState in componentDidUpdate

react/no-multi-comp

Best practice
Error

Prevent multiple component definition per file. Declaring only one component per file improves readability and reusability of components.

react/no-unescaped-entities

Error prone
Error

Prevent invalid characters from appearing in markup

react/no-unknown-property

Safety
Error

Prevent usage of unknown DOM property

react/prop-types

Best practice
Error

Prevent missing props validation in a React component definition

react/react-in-jsx-scope

Error prone
Error

Prevent missing React when using JSX

unicorn/no-array-reduce

Performance
Error

Disallow Array#reduce() and Array#reduceRight() as usually result in hard-to-read and less performant code.

unicorn/no-null

Best practice
Error

Disallow the use of the null literal.

no-fallthrough

Error prone
Error

Incorrect handling of switch

vue/no-deprecated-data-object-declaration

Best practice
Error

Disallow using deprecated object declaration on data

jsx-a11y/alt-text

Best practice
Error

Image elements must have an alt prop, either with meaningful text, or an empty string for decorative images.

@typescript-eslint/no-loss-of-precision

Error prone
Error

Disallows literal numbers that lose precision.

@next/next/no-sync-scripts

Performance
Error

Synchronous scripts should not be used

@next/next/inline-script-id

Best practice
Error

`next/script` components with inline content must specify an `id` attribute.

vue/require-default-prop

Best practice
Error

This rule requires default value to be set for each props that are not marked as required.

vue/require-prop-types

Best practice
Error

This rule enforces that a props statement contains type definition.

vue/no-deprecated-destroyed-lifecycle

Safety
Error

This rule reports use of deprecated destroyed and beforeDestroy lifecycle hooks