Skip to content

Commit ae07ea7

Browse files
astorijeikatyang
authored andcommitted
feat(checker): Do not output anything if there are no conflicting rules (#134)
1 parent b5d8504 commit ae07ea7

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

tools/__snapshots__/checker.test.ts.snap

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ exports[`should be able to check multiple config files 1`] = `
2424
[error] trailing-comma
2525
[error] typedef-whitespace
2626
[error] whitespace
27-
[log] No conflict rule detected in <cwd>/fixtures/tslint.empty.json
2827
[error] Unexpected number in JSON at position 1 in <cwd>/fixtures/tslint.error.json"
2928
`;
3029
31-
exports[`should show success message for conflict rules that is disabled 1`] = `"[log] No conflict rule detected in <cwd>/fixtures/tslint.false.json"`;
30+
exports[`should show nothing for conflict rules that is disabled 1`] = `""`;
3231
33-
exports[`should show success message for non-conflict rules 1`] = `"[log] No conflict rule detected in <cwd>/fixtures/tslint.empty.json"`;
32+
exports[`should show nothing for non-conflict rules 1`] = `""`;
3433
3534
exports[`should show usage if there is no filePath 1`] = `"[log] Usage: tslint-config-prettier-check <pathToConfigFile> ..."`;
3635

tools/checker.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ it("should throw parsing error for invalid config", () => {
3434
expect(process.exitCode).toBe(1);
3535
});
3636

37-
it("should show success message for non-conflict rules", () => {
37+
it("should show nothing for non-conflict rules", () => {
3838
checkFixture("empty");
3939
expect(getMessage()).toMatchSnapshot();
4040
expect(process.exitCode).toBe(0);
4141
});
4242

43-
it("should show success message for conflict rules that is disabled", () => {
43+
it("should show nothing for conflict rules that is disabled", () => {
4444
checkFixture("false");
4545
expect(getMessage()).toMatchSnapshot();
4646
expect(process.exitCode).toBe(0);

tools/checker.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ export const check = (configFilePaths: string[]) => {
1414
configFilePaths.forEach((configFilePath) => {
1515
try {
1616
const conflictRules = getConflictRules(configFilePath);
17-
if (conflictRules.length === 0) {
18-
// tslint:disable-next-line:no-console
19-
console.log(`No conflict rule detected in ${configFilePath}`);
20-
} else {
17+
if (conflictRules.length) {
2118
// tslint:disable-next-line:no-console
2219
console.error(
2320
`Conflict rule(s) detected in ${configFilePath}:\n${conflictRules

0 commit comments

Comments
 (0)