Skip to content

Commit 652e8b4

Browse files
authored
Merge pull request github#5586 from asgerf/js/tsconfig-file-inclusion-handling
Approved by esbena
2 parents c9c4c06 + ee13ff7 commit 652e8b4

File tree

14 files changed

+44
-12
lines changed

14 files changed

+44
-12
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
lgtm,codescanning
2+
* Fixed a bug which caused some imports to be resolved incorrectly
3+
for projects containing multiple `tsconfig.json` files.
4+
* Fixed a bug which could cause some files in the `node_modules` folder
5+
to be extracted even though they should be excluded.

javascript/extractor/src/com/semmle/js/parser/ParsedProject.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public File getTsConfigFile() {
2121

2222
/** Absolute paths to the files included in this project. */
2323
public Set<File> getOwnFiles() {
24-
return allFiles;
24+
return ownFiles;
2525
}
2626

2727
/** Absolute paths to the files included in or referenced by this project. */
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @name Import graph
3+
* @description An edge in the import graph.
4+
* @kind problem
5+
* @problem.severity recommendation
6+
* @id js/meta/alerts/import-graph
7+
* @tags meta
8+
* @precision very-low
9+
*/
10+
11+
import javascript
12+
13+
from Import imprt, Module target
14+
where target = imprt.getImportedModule()
15+
select imprt, "Import targeting $@", target, target.getFile().getRelativePath()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import { Foo } from "../B/src/foo";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"include": ["."]
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Bar } from "lib/bar";
2+
3+
export class Foo {}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Foo } from "foo";
2+
3+
export class Bar {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"include": ["."],
3+
"compilerOptions": {
4+
"baseUrl": "./src"
5+
}
6+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
| A/index.ts:1:1:1:35 | import ... c/foo"; | B/src/foo.ts:1:1:4:0 | <toplevel> |
2+
| B/src/foo.ts:1:1:1:30 | import ... b/bar"; | B/src/lib/bar.ts:1:1:4:0 | <toplevel> |
3+
| B/src/lib/bar.ts:1:1:1:26 | import ... "foo"; | B/src/foo.ts:1:1:4:0 | <toplevel> |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import javascript
2+
3+
query Module getImportedModule(Import imprt) { result = imprt.getImportedModule() }

0 commit comments

Comments
 (0)