-
Notifications
You must be signed in to change notification settings - Fork 235
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
refactor: replace/remove deprecated method calls #587
refactor: replace/remove deprecated method calls #587
Conversation
@mgechev There are two leftovers that I was not able to change because definitely broke some tests: 1st.: codelyzer/src/angular/templates/basicTemplateAstVisitor.ts Lines 182 to 187 in d4bf62d
Changing this:
to:
... broke 16 tests. 2nd.: codelyzer/src/angular/sourceMappingVisitor.ts Lines 105 to 108 in d4bf62d
Remove this deprecate call broke 66 tests. Could you give me a hand on that? |
methods.forEach(m => { | ||
let n = (<any>m.name).text; | ||
if (n && this.isMethodValidHook(m, interfaces)) { | ||
let hookName = n.substr(2, n.lenght); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun fact: lengHt
was mispelled (2 times in this class) :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh!
@rafaelss95 thanks for the cleanup! Would you check why the build is failing? |
@mgechev so... that was what I asked above, if I change in these 2 places I mentioned, the tests break, I really don't know why. |
I guess we should not use deprecated methods. |
I think you don't understand what I mean. I'm trying to say that if I change these leftovers deprecated calls it break some tests. See #587 (comment) |
@mgechev I've pushed the changes for those leftovers. Now you can see the full log error in travis. |
@mgechev After many unsuccessful attempts trying to replace the two problematic places, I think the best choice for now is to disable the rule for 2 calls: That said, this PR is ready for review. |
bump @mgechev. |
@rafaelss95 will take a look in a few minutes. |
@@ -8,7 +8,7 @@ | |||
"format:base": "prettier --config ./.prettierrc \"*.{json,md}\" \"src/**/*.{css,scss,ts}\" \"test/**/*.{css,scss,ts}\"", | |||
"format:check": "npm run format:base -- --list-different", | |||
"format:fix": "npm run format:base -- --write", | |||
"lint": "tslint -c tslint.json \"src/**/*.ts\" \"test/**/*.ts\"", | |||
"lint": "tslint -p . -c tslint.json \"src/**/*.ts\" \"test/**/*.ts\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need -p
? Are we using any rules with type checking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that's required because of the deprecation
rule?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, deprecation
rule requires type information.
@@ -104,6 +104,7 @@ export class SourceMappingVisitor extends RuleWalker { | |||
|
|||
createFailure(s: number, l: number, message: string, fix?: Fix): RuleFailure { | |||
const { start, length } = this.getMappedInterval(s, l); | |||
// tslint:disable-next-line:deprecation | |||
return super.createFailure(start, length, message, fix); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createFailure
is deprecated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it has been deprecated for over an year. PR palantir/tslint#1952
@@ -16,39 +16,41 @@ class TemplateToNgTemplateVisitor extends RecursiveAngularExpressionVisitor { | |||
return super.visitBinary(expr, context); | |||
} | |||
|
|||
const operator = this.codeWithMap.code.slice(expr.left.span.end, expr.right.span.start); | |||
const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use less of these assignments. A bit hard to follow :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! LGTM.
This:
deprecation
rule to thetslint.json
;tslint
methods);