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

findConfigurationPath: search for tslint.json up to root #3309

Merged
merged 2 commits into from
Oct 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
}
}