Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
findConfigurationPath: search for tslint.json up to root (#3309)
Browse files Browse the repository at this point in the history
[bugfix] fixed regression where the lookup of `tslint.json` stopped at the current directory.
Fixes: #3050
  • Loading branch information
ajafff authored and adidahiya committed Oct 19, 2017
1 parent 6957a92 commit 2774fff
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/configuration.ts
Expand Up @@ -140,9 +140,9 @@ export function findConfigurationPath(suppliedConfigFilePath: string | null, inp
}

// search for tslint.json from input file location
let configFilePath = findup(CONFIG_FILENAME, inputFilePath!);
let configFilePath = findup(CONFIG_FILENAME, path.resolve(inputFilePath!));
if (configFilePath !== undefined) {
return path.resolve(configFilePath);
return configFilePath;
}

// search for tslint.json in home directory
Expand Down
14 changes: 14 additions & 0 deletions test/executable/executableTests.ts
Expand Up @@ -218,6 +218,20 @@ describe("Executable", function(this: Mocha.ISuiteCallbackContext) {
});
});

it("finds configuration above current directory", (done) => {
execCli(
["index.test.ts"],
{
cwd: "./test/files/config-findup/no-config",
},
(err) => {
assert.isNotNull(err, "process should exit with an error");
assert.equal(err.code, 2, "exit code should be 2");
done();
},
);
});

describe("--fix flag", () => {
it("fixes multiple rules without overwriting each other", (done) => {
const tempFile = path.relative(process.cwd(), createTempFile("ts"));
Expand Down
1 change: 1 addition & 0 deletions test/files/config-findup/no-config/index.test.ts
@@ -0,0 +1 @@
'';
6 changes: 5 additions & 1 deletion test/files/config-findup/tslint.json
@@ -1 +1,5 @@
{}
{
"rules": {
"quotemark": true
}
}

0 comments on commit 2774fff

Please sign in to comment.