Skip to content

[ban-ts-comment] add option to allow a ts-comment if there is a description with it #2093

@dimitropoulos

Description

@dimitropoulos

[Feature Request] @typescript-eslint/require-ts-comment-description

Rule Details

Examples of 👎 incorrect code for this rule:

// @ts-expect-error
const x: string = 1;

// @ts-ignore
const x: string = 1;

Examples of 👍 correct code for this rule:

// @ts-expect-error because this code is testing a compiler I'm writing
const x: string = 1;

// @ts-ignore: because this code is testing a compiler I'm writing
const x: string = 1;

Options

{
  "rules": {
    "@typescript-eslint/require-ts-comment-description": "error"
  }
}

The configuration looks like this:

interface Options {
  'ts-expect-error'?: boolean;
  'ts-ignore'?: boolean;
  'ts-nocheck'?: boolean;
  'ts-check'?: boolean;
}

const defaultOptions: Options = {
  'ts-expect-error': true,
  'ts-ignore': true,
  'ts-nocheck': true,
  'ts-check': true,
};

Additional Info

There is a similar rule in https://mysticatea.github.io/eslint-plugin-eslint-comments/rules/require-description.html.

I thought typescript-eslint had such a rule, but apparently not. My apologies if I just missed it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement: plugin rule optionNew rule option for an existing eslint-plugin rulegood first issueGood for newcomershas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy