Skip to content

JS: Deprecate type extraction #19640

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

Draft
wants to merge 70 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
5064cd5
JS: Exclude externs from CallGraph meta-query
asgerf Apr 11, 2025
9fc0b8c
JS: Add ImportSpecifier.getImportDeclaration()
asgerf Mar 11, 2025
50e4ac8
JS: Do not ignore variables from ambient declarations
asgerf Apr 11, 2025
b5a4fc0
JS: Make Closure concepts based on AST instead
asgerf Apr 11, 2025
4cd6f45
JS: Avoid accidental recursion with API graphs
asgerf Apr 11, 2025
9566265
JS: Add helper for getting local type names
asgerf Apr 11, 2025
4bfb048
JS: Resolve JSDocLocalTypeAccess to a variable in scope
asgerf Apr 11, 2025
1051136
JS: Add test
asgerf Apr 11, 2025
1533e13
JS: Add NameResolution.qll
asgerf Apr 11, 2025
d61f576
JS: Add UnderlyingTypes.qll
asgerf Apr 11, 2025
fc580a5
JS: Add TypeResolution.qll
asgerf Apr 11, 2025
b923eac
JS: Use underlying types in DataFlow::Node
asgerf Apr 11, 2025
cca48c0
JS: Use in TypeAnnotation.getClass and hasUnderlyingType predicates
asgerf Apr 11, 2025
9fd85c9
JS: Update jQuery model
asgerf Apr 11, 2025
2d21074
JS: Use sanitizing primitive types in ViewComponentInput
asgerf Apr 11, 2025
6fdd7fe
JS: Use sanitizing primitive type in Nest model
asgerf Apr 11, 2025
4e44fda
JS: Use hasUnderlyingStringOrAnyType in Nest model
asgerf Apr 11, 2025
6ac35f1
JS: Use in MissingAwait
asgerf Apr 11, 2025
989402d
JS: Remove some dependencies on type extraction
asgerf Apr 11, 2025
57811ed
JS: Some test updates
asgerf Apr 11, 2025
307715a
JS: Use type resolution for CG augmentation
asgerf Apr 22, 2025
f06b9a9
JS: Add call graph test with types
asgerf Apr 30, 2025
500291d
JS: Hide shadowed inherited members
asgerf Apr 30, 2025
167f752
JS: Also propagate through promise types
asgerf Apr 30, 2025
6e82b6e
JS: Add failing test for assigning a non-SourceNode to a type annotat…
asgerf Apr 30, 2025
e07a036
JS: Mark type-annotated nodes as SourceNode
asgerf Apr 14, 2025
fbafd6f
JS: Update to avoid deprecations after import resolution change
asgerf May 2, 2025
b8dc1b3
JS: Remove redundant casts
asgerf May 2, 2025
bba872a
JS: Make jump-to-def behave nicer
asgerf May 12, 2025
de7d851
JS: Update output of old HasUnderlyingType test
asgerf May 12, 2025
22a4114
JS: Accept regression in overload resolution
asgerf May 12, 2025
b610e10
JS: Accept change in handling of variable resolution in face of ambie…
asgerf May 12, 2025
27979c6
JS: Add regression tests for declared globals
asgerf May 13, 2025
9bcc620
JS: Fix regression from global declare vars
asgerf May 13, 2025
11607e5
JS: Update TRAP after extractor change
asgerf May 19, 2025
b698b4e
JS: Add test for missing type flow through generics
asgerf May 20, 2025
d644f80
JS: Remove obsolete meta query
asgerf May 20, 2025
853ba49
Update javascript/ql/lib/semmle/javascript/internal/TypeResolution.qll
asgerf Jun 4, 2025
79101fd
JS: Add test with type casts
asgerf Jun 4, 2025
57fad7e
JS: Add SatisfiesExpr
asgerf Jun 4, 2025
691fdb1
JS: Nicer jump-to-def for function declarations
asgerf Jun 4, 2025
42f762a
JS: Update test output now that 'satisfies' is a SourceNode
asgerf Jun 9, 2025
a6488cb
Update javascript/ql/lib/semmle/javascript/internal/NameResolution.qll
asgerf Jun 10, 2025
18f9133
JS: Rename and clarify comment for trackFunctionType
asgerf Jun 10, 2025
72cc439
JS: Normalize a few more extensions
asgerf Jun 10, 2025
2aa5fa1
JS: Add comment and examples in FlowImpl doc
asgerf Jun 11, 2025
e848aa7
JS: Clarifying comment on commonStep
asgerf Jun 11, 2025
1c283b7
JS: Move some predicates into NameResolution
asgerf Jun 4, 2025
4cb3200
JS: Add classHasGlobalName into NameResolution
asgerf Jun 4, 2025
18d93d2
JS: Add public API
asgerf Jun 4, 2025
eeb1ff1
JS: Update type usage in Nest library model
asgerf Jun 2, 2025
20d2a65
JS: Update type usage in definitions.qll
asgerf Jun 3, 2025
633a94b
JS: Update type usage in ClassValidator.qll
asgerf Jun 11, 2025
443a2b9
JS: Update type usage in Electron model
asgerf Jun 2, 2025
b796f3e
JS: Update type usage use in Express model
asgerf Jun 2, 2025
5119c14
JS: Update type usage in UnreachableMethodOverloads
asgerf Jun 2, 2025
d733dd3
JS: Update API usage in ViewComponentInput
asgerf Jun 4, 2025
31d66b5
JS: Update API usage in MissingAwait
asgerf Jun 4, 2025
48645a0
JS: Update an outdated QLDoc comment
asgerf Jun 2, 2025
257473e
JS: Remove old metric-meta query TypedExprs.ql
asgerf Jun 3, 2025
120acf8
JS: Deprecate everything that depends on type extraction
asgerf Jun 2, 2025
4c8f807
JS: Delete or simplify TypeScript type-specific tests
asgerf Jun 2, 2025
b017c4c
JS: Remove unneeded integration test
asgerf Jun 2, 2025
190741d
JS: Remove an unnecessary import
asgerf Jun 4, 2025
100372d
JS: Fix qldoc coverage
asgerf Jun 4, 2025
4135a3e
JS: Change default TypeScript extraction mode to basic
asgerf Jun 4, 2025
9adf72c
JS: Add deprecation comment to qldoc
asgerf Jun 4, 2025
8f27aa3
JS: Add test for dynamic imports
asgerf Jun 10, 2025
2035925
JS: Handle name resolution through dynamic imports
asgerf Jun 10, 2025
4ba014d
JS: Add support for index expressions
asgerf Jun 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public AutoBuild() {
this.outputConfig = new ExtractorOutputConfig(LegacyLanguage.JAVASCRIPT);
this.trapCache = ITrapCache.fromExtractorOptions();
this.typeScriptMode =
getEnumFromEnvVar("LGTM_INDEX_TYPESCRIPT", TypeScriptMode.class, TypeScriptMode.FULL);
getEnumFromEnvVar("LGTM_INDEX_TYPESCRIPT", TypeScriptMode.class, TypeScriptMode.BASIC);
this.defaultEncoding = getEnvVar("LGTM_INDEX_DEFAULT_ENCODING");
this.installDependencies = Boolean.valueOf(getEnvVar("LGTM_INDEX_TYPESCRIPT_INSTALL_DEPS"));
this.virtualSourceRoot = makeVirtualSourceRoot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,15 +426,13 @@ public Void visit(Identifier nd, Void v) {
// cases where we turn on the 'declKind' flags
@Override
public Void visit(FunctionDeclaration nd, Void v) {
if (nd.hasDeclareKeyword() && !isInTypeScriptDeclarationFile()) return null;
// strict mode functions are block-scoped, non-strict mode ones aren't
if (blockscope == isStrict) visit(nd.getId(), DeclKind.var);
return null;
}

@Override
public Void visit(ClassDeclaration nd, Void c) {
if (nd.hasDeclareKeyword() && !isInTypeScriptDeclarationFile()) return null;
if (blockscope) visit(nd.getClassDef().getId(), DeclKind.varAndType);
return null;
}
Expand Down Expand Up @@ -483,7 +481,6 @@ public Void visit(EnhancedForStatement nd, Void v) {

@Override
public Void visit(VariableDeclaration nd, Void v) {
if (nd.hasDeclareKeyword() && !isInTypeScriptDeclarationFile()) return null;
// in block scoping mode, only process 'let'; in non-block scoping
// mode, only process non-'let'
if (blockscope == nd.isBlockScoped(ecmaVersion)) visit(nd.getDeclarations());
Expand Down Expand Up @@ -518,8 +515,7 @@ public Void visit(ClassBody nd, Void c) {
@Override
public Void visit(NamespaceDeclaration nd, Void c) {
if (blockscope) return null;
boolean isAmbientOutsideDtsFile = nd.hasDeclareKeyword() && !isInTypeScriptDeclarationFile();
boolean hasVariable = nd.isInstantiated() && !isAmbientOutsideDtsFile;
boolean hasVariable = nd.isInstantiated();
visit(nd.getName(), hasVariable ? DeclKind.varAndNamespace : DeclKind.namespace);
return null;
}
Expand Down
Loading