Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
f44e75f
ce97e17
04a4d8f
ccabfcf
a4d6425
c89abbd
97c33d9
be3cbc5
1f4c7fe
2c85da6
f36a9c3
aa24eda
5361fa1
8ddc74f
312a182
2fd63d1
f2a0d9d
13a26e5
c73f278
e634646
95f88f8
d66539c
e755f3b
6bc8f5a
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -34,7 +34,7 @@ | ||
| [`promise-function-async`] | ✅ | [`@typescript-eslint/promise-function-async`] | | ||
| [`typedef`] | 🛑 | N/A | | ||
| [`typedef-whitespace`] | ✅ | [`@typescript-eslint/type-annotation-spacing`] | | ||
| [`unified-signatures`] |✅ |[`@typescript-eslint/unified-signatures`] | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Fixed. | ||
### Functionality | ||
@@ -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 | ||
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/) |
Uh oh!
There was an error while loading.Please reload this page.