Skip to content

Commit

Permalink
feat: add no-unused-exports rule
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Feb 7, 2023
1 parent 2f6fcb4 commit 87b9799
Show file tree
Hide file tree
Showing 13 changed files with 308 additions and 19 deletions.
1 change: 1 addition & 0 deletions .README/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ See [ESLint documentation](https://eslint.org/docs/user-guide/configuring/config
{"gitdown": "include", "file": "./rules/id-match.md"}
{"gitdown": "include", "file": "./rules/import-specifier-newline.md"}
{"gitdown": "include", "file": "./rules/no-restricted-strings.md"}
{"gitdown": "include", "file": "./rules/no-unused-exports.md"}
{"gitdown": "include", "file": "./rules/no-use-extend-native.md"}
{"gitdown": "include", "file": "./rules/prefer-import-alias.md"}
{"gitdown": "include", "file": "./rules/prefer-inline-type-import.md"}
Expand Down
13 changes: 13 additions & 0 deletions .README/rules/no-unused-exports.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### `no-unused-exports`

Identifies unused exports.

> **Note** This rule uses [`ts-unused-exports`](https://github.com/pzavolinsky/ts-unused-exports) program behind the scenes.
#### Options

|Config|Type|Description|
|---|---|---|
|`tsConfigPath`|string|Path to [tsconfig.json](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html)]

<!-- assertions noUnusedExports -->
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,24 @@ Disallow specified strings.

The 1st option is an array of strings that cannot be contained in the codebase.

<a name="user-content-eslint-plugin-canonical-rules-no-unused-exports"></a>
<a name="eslint-plugin-canonical-rules-no-unused-exports"></a>
### <code>no-unused-exports</code>

Identifies unused exports.

> **Note** This rule uses [`ts-unused-exports`](https://github.com/pzavolinsky/ts-unused-exports) program behind the scenes.
<a name="user-content-eslint-plugin-canonical-rules-no-unused-exports-options-2"></a>
<a name="eslint-plugin-canonical-rules-no-unused-exports-options-2"></a>
#### Options

|Config|Type|Description|
|---|---|---|
|`tsConfigPath`|string|Path to [tsconfig.json](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html)]



<a name="user-content-eslint-plugin-canonical-rules-no-use-extend-native"></a>
<a name="eslint-plugin-canonical-rules-no-use-extend-native"></a>
### <code>no-use-extend-native</code>
Expand Down Expand Up @@ -382,8 +400,8 @@ Note: This rule is equivalent to [`sort-keys`](https://eslint.org/docs/rules/sor

This rule requires identifiers in assignments and `function` definitions to match a specified regular expression.

<a name="user-content-eslint-plugin-canonical-rules-sort-keys-options-2"></a>
<a name="eslint-plugin-canonical-rules-sort-keys-options-2"></a>
<a name="user-content-eslint-plugin-canonical-rules-sort-keys-options-3"></a>
<a name="eslint-plugin-canonical-rules-sort-keys-options-3"></a>
#### Options

The 1st option is "asc" or "desc".
Expand Down
164 changes: 147 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"is-proto-prop": "^2.0.0",
"lodash": "^4.17.21",
"natural-compare": "^1.4.0",
"ts-unused-exports": "^9.0.3",
"xregexp": "^5.1.1"
},
"description": "Canonical linting rules for ESLint.",
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import filenameNoIndex from './rules/filenameNoIndex';
import idMatch from './rules/idMatch';
import importSpecifierNewline from './rules/importSpecifierNewline';
import noRestrictedStrings from './rules/noRestrictedStrings';
import noUnusedExports from './rules/noUnusedExports';
import noUseExtendNative from './rules/noUseExtendNative';
import preferImportAlias from './rules/preferImportAlias';
import preferInlineTypeImport from './rules/preferInlineTypeImport';
Expand All @@ -26,6 +27,7 @@ export = {
'id-match': idMatch,
'import-specifier-newline': importSpecifierNewline,
'no-restricted-strings': noRestrictedStrings,
'no-unused-exports': noUnusedExports,
'no-use-extend-native': noUseExtendNative,
'prefer-import-alias': preferImportAlias,
'prefer-inline-type-import': preferInlineTypeImport,
Expand Down
Loading

0 comments on commit 87b9799

Please sign in to comment.