1.0.1 • Published 11 months ago

eslint-plugin-no-specific-type-assertion v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

No Specific type assertion ESlint plugin

Eslint plugin that disallow the usage of a type assertion in your typescript code.

Motivation

You might need to prevent your team from adding unwanted type assertion that can be harmful on the long run, you can use this plugin to specify the type assertion you want to disallow.

Installation

yarn add -D eslint-plugin-no-specific-type-assertion

Usage

Using the new Eslint Flat Config

import NoTypeAssertionEslint from 'eslint-plugin-no-specific-type-assertion';

export default [{
    plugins: {
      'no-specific-type-assertion': NoTypeAssertionEslint,
    },
    'no-specific-type-assertion/no-specific-type-assertion': [
        'error',
        {
          disallowedTypes: ['FormatIntlKeys'],
        },
    ],
}]

Rules

no-specific-type-assertion

Will disallow the usage of the specified type assertion.

Example that will trigger error for this rule:

    <FormattedMessage id={title as FormatIntlKeys} />
1.0.1

11 months ago

1.0.0

11 months ago