0.0.14 • Published 1 year ago

eslint-plugin-no-unused v0.0.14

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

eslint-plugin-no-unused

experimental, in early stage of development

Finds unused TypeScript code with no-unused.

Installation

Install eslint-plugin-no-unused & @typescript-eslint/parser:

npm install eslint-plugin-no-unused --save-dev
npm install @typescript-eslint/parser --save-dev

Usage

Make sure @typescript-eslint/parser is configured in your .eslintrc configuration file, and has parserOptions.project property.

{
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "project": "./tsconfig.json"
  }
}

Add eslint-plugin-no-unused to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": [
    "no-unused"
  ]
}

Then configure the rule under the rules section.

{
  "rules": {
    "no-unused/no-unused": ["warn", {
      "ignore": "**/*.spec.ts",
      "ignoreExports": "src/entrypoint.ts,src/**/*.otherEntrypoints.ts"
    }]
  }
}

Options

  • ignore (glob pattern) - pattern for ignored files. These files won't be analyzed. Hint: add **/*.spec.ts then identifiers that are used only in tests will be marked as unused.
  • ignoreExports (glob pattern) - pattern for files where exports are considered used. Hint: add here entrypoints to your app as exports there are meant to be used by external code.

CLI tool

See no-unused.

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago