eslint-plugin-no-explicit-unknown
v1.0.4
Published
A simple eslint rule that guards against the use of the `unknown` keyword
Downloads
7
Readme
Eslint Unknown Rule
A simple eslint rule that guards against the use of the unknown
keyword
The following example would trigger the rule:
const foo: unknown = 2
Note: this rule ignores unknown
s that are error parameters in try catch blocks. For instance, the following is considered valid:
try {
console.log('Eslint is cool')
} catch (e: unknown) {
console.log(e)
}
Getting started
Start by installing the plugin to your project:
npm i eslint-plugin-no-explicit-unknown
Add plugin to your .eslintrc
file:
{
...,
"plugins": [
"eslint-plugin-no-explicit-unknown"
],
"rules": {
"no-explicit-unknown/no-explicit-unknown": "warn"
},
}