Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat(eslint-plugin): Add unified-signature rule #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f44e75f
Added tslint unified-signatures rule
Feb 1, 2019
ce97e17
Added unified-signatures documentation
Feb 1, 2019
04a4d8f
Merge branch 'master' into AddTypeScriptUnifiedSignatureRule
Feb 1, 2019
ccabfcf
Merge branch 'master' into AddTypeScriptUnifiedSignatureRule
Feb 1, 2019
a4d6425
Fixes to unified-signatures rule
Feb 2, 2019
c89abbd
Merge branch 'AddTypeScriptUnifiedSignatureRule' of https://github.co…
Feb 2, 2019
97c33d9
Fixed formatting on unified-signatures rule
Feb 2, 2019
be3cbc5
Merge branch 'master' into AddTypeScriptUnifiedSignatureRule
armano2 Feb 10, 2019
1f4c7fe
docs(eslint-plugin): fix merge conflict
armano2 Feb 10, 2019
2c85da6
Merge remote-tracking branch 'upstream/master' into AddTypeScriptUnif…
Feb 26, 2019
f36a9c3
Merge remote-tracking branch 'upstream/master' into AddTypeScriptUnif…
Mar 8, 2019
aa24eda
feat(unified-signature): migrated to ts, used messageId
Mar 11, 2019
5361fa1
Merge remote-tracking branch 'upstream/master' into AddTypeScriptUnif…
Mar 11, 2019
8ddc74f
Merge branch 'AddTypeScriptUnifiedSignatureRule' of https://github.co…
Mar 11, 2019
312a182
fix(eslint-plugin): fixed case block lint issue
Mar 11, 2019
2fd63d1
fix(unified-signatures): improved types
Mar 14, 2019
f2a0d9d
fix(unified-signatures): improved tests
Mar 14, 2019
13a26e5
fix(unified-signatures): fixed link in roadmap
Mar 14, 2019
c73f278
fix(unified-signatures): fixed lint break
Mar 14, 2019
e634646
Merge branch 'master' into AddTypeScriptUnifiedSignatureRule
Mar 14, 2019
95f88f8
fix(unified-signatures): more tests improvements
Mar 14, 2019
d66539c
Merge branch 'AddTypeScriptUnifiedSignatureRule' of https://github.co…
Mar 14, 2019
e755f3b
fix(unified-signatures): even more tests improvements
Mar 14, 2019
6bc8f5a
Merge branch 'master' into AddTypeScriptUnifiedSignatureRule
JamesHenry Mar 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 packages/eslint-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,6 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e
| [`@typescript-eslint/promise-function-async`](./docs/rules/promise-function-async.md) | Requires any function or method that returns a Promise to be marked async. (`promise-function-async` from TSLint) | :heavy_check_mark: | |
| [`@typescript-eslint/restrict-plus-operands`](./docs/rules/restrict-plus-operands.md) | When adding two variables, operands must both be of type number or of type string. (`restrict-plus-operands` from TSLint) | | |
| [`@typescript-eslint/type-annotation-spacing`](./docs/rules/type-annotation-spacing.md) | Require consistent spacing around type annotations (`typedef-whitespace` from TSLint) | :heavy_check_mark: | :wrench: |
| [`@typescript-eslint/unified-signatures`](./docs/rules/unified-signatures.md) | Warns for any two overloads that could be unified into one. (`unified-signatures` from TSLint) | | |

<!-- end rule list -->
3 changes: 2 additions & 1 deletion 3 packages/eslint-plugin/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
| [`promise-function-async`] | ✅ | [`@typescript-eslint/promise-function-async`] |
| [`typedef`] | 🛑 | N/A |
| [`typedef-whitespace`] | ✅ | [`@typescript-eslint/type-annotation-spacing`] |
| [`unified-signatures`] | 🛑 | N/A |
| [`unified-signatures`] | | [`@typescript-eslint/unified-signatures`] |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to add the link at the bottom of the file or else this won't work

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


### Functionality

Expand Down Expand Up @@ -589,6 +589,7 @@ Relevant plugins: [`chai-expect-keywords`](https://github.com/gavinaiken/eslint-
[`@typescript-eslint/no-unnecessary-type-assertion`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md
[`@typescript-eslint/no-var-requires`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-var-requires.md
[`@typescript-eslint/type-annotation-spacing`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/type-annotation-spacing.md
[`@typescript-eslint/unified-signatures`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/unified-signatures.md
[`@typescript-eslint/no-misused-new`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-misused-new.md
[`@typescript-eslint/no-object-literal-type-assertion`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-object-literal-type-assertion.md
[`@typescript-eslint/no-this-alias`]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-this-alias.md
Expand Down
33 changes: 33 additions & 0 deletions 33 packages/eslint-plugin/docs/rules/unified-signatures.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter. (unified-signatures)

Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter.

## Rule Details

This rule aims to keep the source code as maintanable as posible by reducing the amount of overloads.

Examples of **incorrect** code for this rule:

```ts
function f(x: number): void;
function f(x: string): void;
```

```ts
f(): void;
f(...x: number[]): void;
```

Examples of **correct** code for this rule:

```ts
function f(x: number | string): void;
```

```ts
function f(x?: ...number[]): void;
```

## Related to

- TSLint: ['unified-signatures`](https://palantir.github.io/tslint/rules/unified-signatures/)
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.