Skip to content

Commit b5e9048

Browse files
committed
improve the ESLint model to avoid overriding Yaml classes
1 parent 4fca4b6 commit b5e9048

File tree

1 file changed

+5
-13
lines changed
  • javascript/ql/lib/semmle/javascript/linters

1 file changed

+5
-13
lines changed

javascript/ql/lib/semmle/javascript/linters/ESLint.qll

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,31 +59,23 @@ module ESLint {
5959
}
6060
}
6161

62-
private class LocatableYamlMapping extends YamlMapping, Locatable {
63-
override Location getLocation() { result = YamlMapping.super.getLocation() }
64-
65-
override string getAPrimaryQlClass() { result = YamlMapping.super.getAPrimaryQlClass() }
66-
67-
override string toString() { result = YamlMapping.super.toString() }
68-
}
69-
7062
/** An `.eslintrc.yaml` file. */
71-
private class EslintrcYaml extends LocatableYamlMapping, Configuration instanceof YamlDocument {
63+
private class EslintrcYaml extends Configuration instanceof YamlMapping {
7264
EslintrcYaml() {
7365
exists(string n | n = this.getFile().getBaseName() |
7466
n = ".eslintrc.yaml" or n = ".eslintrc.yml" or n = ".eslintrc"
7567
)
7668
}
7769

78-
override ConfigurationObject getGlobals() { result = lookup("globals") }
70+
override ConfigurationObject getGlobals() { result = super.lookup("globals") }
7971
}
8072

8173
/** An ESLint configuration object in YAML format. */
82-
private class YamlConfigurationObject extends ConfigurationObject, LocatableYamlMapping {
83-
override Configuration getConfiguration() { this = result.(EslintrcYaml).getValue(_) }
74+
private class YamlConfigurationObject extends ConfigurationObject instanceof YamlMapping {
75+
override Configuration getConfiguration() { this = result.(YamlMapping).getValue(_) }
8476

8577
override boolean getBooleanProperty(string p) {
86-
exists(string v | v = lookup(p).(YamlBool).getValue() |
78+
exists(string v | v = super.lookup(p).(YamlBool).getValue() |
8779
v = "true" and result = true
8880
or
8981
v = "false" and result = false

0 commit comments

Comments
 (0)