Skip to content

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

Closed
@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