Skip to content

Commit 79625e3

Browse files
committed
use tslintConfig.findConfiguration to retrieve local config
1 parent bc7f5b6 commit 79625e3

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

index.js

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,10 @@ function loadRelativeConfig() {
1919
var options = {
2020
formatter: "custom",
2121
formattersDirectory: __dirname + '/formatters/',
22-
configuration: {}
22+
configuration: tslintConfig.findConfiguration(null, this.resourcePath)
2323
};
24-
25-
var configPath = locateConfigFile("tslint.json", path.dirname(this.resourcePath));
26-
if(typeof configPath == "string") {
27-
this.addDependency(configPath);
28-
var file = fs.readFileSync(configPath, "utf8");
29-
var config = JSON.parse(stripJsonComments(file));
30-
options.configuration = config;
31-
if(config.rulesDirectory) {
32-
var resolvedDirectories = tslintConfig.getRulesDirectories(config.rulesDirectory, path.dirname(configPath));
33-
options.rulesDirectory = resolvedDirectories;
34-
}
35-
}
36-
37-
return options;
38-
}
3924

40-
function locateConfigFile(filename, startingPath) {
41-
var filePath = path.join(startingPath, filename);
42-
if(typescript.sys.fileExists(filePath)){
43-
return filePath;
44-
}
45-
var parentPath = path.dirname(startingPath);
46-
if(parentPath === startingPath)
47-
return undefined;
48-
return locateConfigFile(filename,parentPath);
25+
return options;
4926
}
5027

5128
function lint(input, options) {

0 commit comments

Comments
 (0)