@@ -10,10 +10,12 @@ module ESLint {
1010 */
1111 abstract class Configuration extends Locatable {
1212 /** Gets the folder in which this configuration file is located. */
13- private Folder getEnclosingFolder ( ) { result = getFile ( ) .getParentContainer ( ) }
13+ private Folder getEnclosingFolder ( ) { result = this . getFile ( ) .getParentContainer ( ) }
1414
1515 /** Holds if this configuration file applies to the code in `tl`. */
16- predicate appliesTo ( TopLevel tl ) { tl .getFile ( ) .getParentContainer + ( ) = getEnclosingFolder ( ) }
16+ predicate appliesTo ( TopLevel tl ) {
17+ tl .getFile ( ) .getParentContainer + ( ) = this .getEnclosingFolder ( )
18+ }
1719
1820 /** Gets the `globals` configuration object of this file, if any. */
1921 abstract ConfigurationObject getGlobals ( ) ;
@@ -39,19 +41,19 @@ module ESLint {
3941 /** An `.eslintrc.json` file. */
4042 private class EslintrcJson extends JsonConfiguration {
4143 EslintrcJson ( ) {
42- isTopLevel ( ) and
43- exists ( string n | n = getFile ( ) .getBaseName ( ) | n = ".eslintrc.json" or n = ".eslintrc" )
44+ this . isTopLevel ( ) and
45+ exists ( string n | n = this . getFile ( ) .getBaseName ( ) | n = ".eslintrc.json" or n = ".eslintrc" )
4446 }
4547
46- override ConfigurationObject getGlobals ( ) { result = getPropValue ( "globals" ) }
48+ override ConfigurationObject getGlobals ( ) { result = this . getPropValue ( "globals" ) }
4749 }
4850
4951 /** An ESLint configuration object in JSON format. */
5052 private class JsonConfigurationObject extends ConfigurationObject , JsonObject {
5153 override Configuration getConfiguration ( ) { this = result .( JsonConfiguration ) .getPropValue ( _) }
5254
5355 override boolean getBooleanProperty ( string p ) {
54- exists ( string v | v = getPropValue ( p ) .( JsonBoolean ) .getValue ( ) |
56+ exists ( string v | v = this . getPropValue ( p ) .( JsonBoolean ) .getValue ( ) |
5557 v = "true" and result = true
5658 or
5759 v = "false" and result = false
@@ -62,7 +64,7 @@ module ESLint {
6264 /** An `.eslintrc.yaml` file. */
6365 private class EslintrcYaml extends Configuration instanceof YamlMapping , YamlDocument {
6466 EslintrcYaml ( ) {
65- exists ( string n | n = getFile ( ) .getBaseName ( ) |
67+ exists ( string n | n = this . ( Locatable ) . getFile ( ) .getBaseName ( ) |
6668 n = ".eslintrc.yaml" or n = ".eslintrc.yml" or n = ".eslintrc"
6769 )
6870 }
@@ -91,18 +93,20 @@ module ESLint {
9193 exists ( PackageJson pkg | this = pkg .getPropValue ( "eslintConfig" ) )
9294 }
9395
94- override ConfigurationObject getGlobals ( ) { result = getPropValue ( "globals" ) }
96+ override ConfigurationObject getGlobals ( ) { result = this . getPropValue ( "globals" ) }
9597 }
9698
9799 /** An ESLint `globals` configuration object. */
98100 class GlobalsConfigurationObject extends Linting:: GlobalDeclaration , ConfigurationObject {
99101 GlobalsConfigurationObject ( ) { this = any ( Configuration cfg ) .getGlobals ( ) }
100102
101103 override predicate declaresGlobal ( string name , boolean writable ) {
102- getBooleanProperty ( name ) = writable
104+ this . getBooleanProperty ( name ) = writable
103105 }
104106
105- override predicate appliesTo ( ExprOrStmt s ) { getConfiguration ( ) .appliesTo ( s .getTopLevel ( ) ) }
107+ override predicate appliesTo ( ExprOrStmt s ) {
108+ this .getConfiguration ( ) .appliesTo ( s .getTopLevel ( ) )
109+ }
106110
107111 abstract override Configuration getConfiguration ( ) ;
108112
0 commit comments