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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.4
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.4
    0
  • 1.0.3
    0
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i eslint-plugin-no-explicit-unknown

Weekly Downloads

0

Version

1.0.4

License

ISC

Unpacked Size

3.9 kB

Total Files

8

Last publish

Collaborators

  • david-shibley-contentful