eslint-plugin-no-explicit-unknown

1.0.4 • Public • Published

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 unknowns 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"
  },
}

Readme

Keywords

none

Package Sidebar

Install

npm i eslint-plugin-no-explicit-unknown

Weekly Downloads

1

Version

1.0.4

License

ISC

Unpacked Size

3.9 kB

Total Files

8

Last publish

Collaborators

  • david-shibley-contentful