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

deprecate utils #3476

Merged
merged 5 commits into from
Nov 28, 2017
Merged

deprecate utils #3476

merged 5 commits into from
Nov 28, 2017

Conversation

ajafff
Copy link
Contributor

@ajafff ajafff commented Nov 11, 2017

Deprecate most of the utility functions in src/language/utils.ts. Some of them are no longer used.
The other deprecated functions can be easily replaced by functions from tsutils.
I think we should get rid of these functions to avoid maintaining them. For example forEachToken (with skipTrivia false) and forEachComment will no longer function correctly with the newly added JsxFragment.

[deprecation] several utility functions have been deprecated

I'm in favor of making the remaining utilities in src/utils.ts and src/language/utils.ts internal in the next major version. Most of them are not meant to be exposed as public API. WDYT?

@adidahiya
Copy link
Contributor

I'm in favor of making the remaining utilities in src/utils.ts and src/language/utils.ts internal in the next major version. Most of them are not meant to be exposed as public API. WDYT?

Yeah, i'm generally on board. We can stop exporting them from the root of the package and use direct imports to the utils modules wherever necessary (instead of Lint.Utils).

@@ -107,6 +107,6 @@ export abstract class ScopeAwareRuleWalker<T> extends RuleWalker {
}

protected isScopeBoundary(node: ts.Node): boolean {
return isScopeBoundary(node);
return isScopeBoundary(node); // tslint:disable-line:deprecation
Copy link
Contributor

Choose a reason for hiding this comment

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

can you switch to using the tsutils function here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are some differences between the two that could break some custom rules. Since this is deprecated, I don't think we need to replace all deprecated utils.

@@ -21,13 +21,15 @@ import { IOptions } from "../rule/rule";
import { isBlockScopeBoundary } from "../utils";
import { ScopeAwareRuleWalker } from "./scopeAwareRuleWalker";

// tslint:disable:deprecation
Copy link
Contributor

Choose a reason for hiding this comment

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

can you comment here explaining why we're disabling the rule for the file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@adidahiya adidahiya merged commit e00a7f3 into palantir:master Nov 28, 2017
HyphnKnight pushed a commit to HyphnKnight/tslint that referenced this pull request Apr 9, 2018
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.

2 participants