This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 887
sourceFile duplication for TypedRule #1969
Comments
Is the AST different or are the sourceFile objects different references? |
Looks like they're completely separate. Added this to the top of const langSvcSourceFile = langSvc.getProgram().getSourceFile(sourceFile.fileName);
console.log(sourceFile === langSvcSourceFile);
console.log(sourceFile.statements[0] === langSvcSourceFile.statements[0]);
process.exit(0); Both lines print |
But the |
Since it's the same file being parsed twice, the two separate source files should have identical contents. |
ghost
mentioned this issue
Feb 24, 2017
4 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Bug Report
master
2.1.4
(the one inpackage.json
)./bin/tslint --test test/rules/my-rule
TypeScript code
being lintedActual behavior
Prints
false
.Expected behavior
Prints
true
. The source file used for linting should be the same as the one used for the program.I want to write a rule that uses the type checker to get information about nodes as I recurse. I can't do that if it uses a different AST.
The text was updated successfully, but these errors were encountered: