Skip to content

Commit 347acf3

Browse files
committed
JS: Implement babel-plugin-root-import as a PathMapping
1 parent 5f1ae2c commit 347acf3

File tree

1 file changed

+9
-0
lines changed
  • javascript/ql/lib/semmle/javascript/frameworks

1 file changed

+9
-0
lines changed

javascript/ql/lib/semmle/javascript/frameworks/Babel.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*/
44

55
import javascript
6+
private import semmle.javascript.internal.paths.PathMapping
67

78
module Babel {
89
/**
@@ -202,4 +203,12 @@ module Babel {
202203
)
203204
}
204205
}
206+
207+
private class BabelPathMapping extends PathMapping, RootImportConfig {
208+
override File getAnAffectedFile() { result = this.getConfig().getAContainerInScope() }
209+
210+
override predicate hasPrefixPathMapping(string pattern, Container newContext, string newPath) {
211+
newPath = this.getRoot(pattern) and newContext = this.getFolder()
212+
}
213+
}
205214
}

0 commit comments

Comments
 (0)