eslint-plugin-no-specific-type-assertion
v1.0.1
Published
Disallow the usage of one or few type assertion in your typescript code
Downloads
68
Maintainers
Readme
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} />