-
Notifications
You must be signed in to change notification settings - Fork 13k
Update linting to avoid typechecking for booleanTriviaRule #15021
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
Conversation
scripts/tslint/booleanTriviaRule.ts
Outdated
|
||
const targetCallSignature = checker.getResolvedSignature(node); | ||
if (!targetCallSignature) { | ||
if (!node.arguments) { |
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.
Is it possible for CallExpression.arguments
to ever be undefined?
As long as you don't handle NewExpression
here you shouldn't need to worry about undefined
.
@@ -123,7 +123,7 @@ namespace ts { | |||
try { | |||
// trigger synchronization to make sure that LSHost will try to find 'f2' module on disk | |||
project.getLanguageService().getSemanticDiagnostics(imported.name); | |||
assert.isTrue(false, `should not find file '${imported.name}'`); | |||
assert.fail(false, `should not find file '${imported.name}'`); |
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.
assert.fail
takes actual
and expected
as parameters. Doesn't seem like there's an overload that just takes a message. assert(false, msg)
is probably best.
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.
Typescript you say? Why not named arguments?
🦀 👽
scripts/tslint/booleanTriviaRule.ts
Outdated
const current = currently ? ` (currently '${currently}')` : ""; | ||
return `Tag boolean argument as '${name}'${current}`; | ||
} | ||
|
||
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { | ||
// Cheat to get type checker |
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 don't think we're cheating OR getting a type checker any more.
I fell down a bit of a rabbit hole! 🐇
Our boolean trivia rule was... interesting
master
version of TS LintSo given all these things, the new boolean trivia rule
As well I fixed all the lint errors that the next version of TS Lint will give us on release since I was
npm link
'd anyway