Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

fix(noUnusedVariableRule): remove warning #3227

Merged
merged 1 commit into from Sep 20, 2017
Merged

fix(noUnusedVariableRule): remove warning #3227

merged 1 commit into from Sep 20, 2017

Conversation

ghost
Copy link

@ghost ghost commented Sep 14, 2017

Remove warning printed to console when a user of tslint is using the
no-unused-variable rule while also using the TypeScript compiler
with the noUnusedLocals and noUnusedParameters options set.

While it's not technically necessary to use the noUnusedVariableRule
rule with the TypeScript compiler options set, using this rule
is still useful when using the --fix option in tslint to
automatically remove unused variables.

Fixes #3219

@palantirtech
Copy link
Member

Thanks for your interest in palantir/tslint, @destroyerofbuilds! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

@@ -30,6 +30,10 @@ export class Rule extends Lint.Rules.TypedRule {
description: Lint.Utils.dedent`Disallows unused imports, variables, functions and
private class members. Similar to tsc's --noUnusedParameters and --noUnusedLocals
options, but does not interrupt code compilation.`,
descriptionDetails: Lint.Utils.dedent`If addition to avoiding compilation errors,
Copy link
Contributor

Choose a reason for hiding this comment

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

"In addition ..."

Copy link
Contributor

Choose a reason for hiding this comment

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

Also you can add a newline + indentation before "If"

Copy link
Author

Choose a reason for hiding this comment

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

Fixed if, and moved the start of the sentence to a newline.

descriptionDetails: Lint.Utils.dedent`If addition to avoiding compilation errors,
this rule may still be useful if you wish to have \`tslint\` automatically
remove unused imports, variables, functions, and private class members, when
using \`tslint\`'s \`--fix\` option.`,
Copy link
Contributor

Choose a reason for hiding this comment

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

"... TSLint's `--fix` option."

Copy link
Author

Choose a reason for hiding this comment

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

Fixed TSLint name.

Remove warning printed to console when a user of `tslint` is using the
`no-unused-variable` rule while also using the TypeScript compiler
with the `noUnusedLocals` and `noUnusedParameters` options set.

While it's not technically necessary to use the `noUnusedVariableRule`
rule with the TypeScript compiler options set, using this rule
is still useful when using the `--fix` option in `tslint` to
automatically remove unused variables.

Fixes #3219
@ghost
Copy link
Author

ghost commented Sep 15, 2017

I'm waiting on approval to sign the CLA.

In the meantime, please keep in mind that (And that I am not a lawyer): Many of the provisions of the Palantir CLA are covered by the Apache license itself.

Please see the Lowering the Barriers to Participation section of https://blog.openshift.com/keep-calm-and-merge-on-lowering-barriers-to-open-source-contributions-with-apache-v2/.

@ghost
Copy link
Author

ghost commented Sep 20, 2017

I've been approved to sign the CLA.

I'm not sure why my modification has caused several of the tests to fail. The output messages aren't even related to this change.

Is there anything I can do to correct the issue?

@ajafff
Copy link
Contributor

ajafff commented Sep 20, 2017

The CI failures are not related to your changes.
That's already fixed on master, so you just need to merge

@adidahiya
Copy link
Contributor

CI should be fixed when this lands on master.

@adidahiya adidahiya merged commit d16f7be into palantir:master Sep 20, 2017
@adidahiya
Copy link
Contributor

thanks @destroyerofbuilds!

@ghost ghost deleted the fix/noUnusedVariableRule/warning branch September 20, 2017 18:24
@jensbodal
Copy link

Really look forward to this in the next release -- thank you

We set rules like noUnusedParameters: true in our tsconfig.json, but then disable them in our tsconfig.app.json. This allows tslint-language-service to provide as-you-type warnings for unused parameters. Our pre-commit hooks run linting with type-checking enabled to fail commits that don't pass no-unused-variable. And the our builds work with 3rd party libraries that don't enforce things like noUnusedParameters or noImplicitAny.

HyphnKnight pushed a commit to HyphnKnight/tslint that referenced this pull request Apr 9, 2018
Remove warning printed to console when a user of `tslint` is using the
`no-unused-variable` rule while also using the TypeScript compiler
with the `noUnusedLocals` and `noUnusedParameters` options set.

While it's not technically necessary to use the `noUnusedVariableRule`
rule with the TypeScript compiler options set, using this rule
is still useful when using the `--fix` option in `tslint` to
automatically remove unused variables.

Fixes palantir#3219
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warning Displayed For Supported no-unused-variable Rule
5 participants