This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 889
Add exclude section to configuration files. #2409
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
4449db0
Add cliOptions section to configuration files.
e9e5be1
Add exclude to linter options object in IConfigurationFile
31a083b
Revert "Add cliOptions section to configuration files."
824014a
Merge branch 'master' into json-cli-options
d99a589
Merge branch 'master' into json-cli-options
mmkal 9cae08b
Use commander properly
92ded4e
combine linterOptions.exclude with command line exclusions
719366a
move reading of config file to runner
415b898
whitespace tweaks
2fa9827
Add documentation
2834735
refactor: move check for if file is excluded to just before linting
5ea6f1c
Merge remote-tracking branch 'palantir/master' into json-cli-options
mmkal d5b1335
chore: specify encoding explicitly when writing file
mmkal bd1a2ec
immutable isFileExcluded filter function
adidahiya beb7fd4
Fix code docs for IConfigurationFile#linterOptions
adidahiya 8f11c8c
remove typeCheck from linterOptions
mmkal d6982e1
add test for extending with empty linterOptions
mmkal File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"rules": { | ||
"semicolon": [ | ||
true, | ||
"always" | ||
] | ||
}, | ||
"linterOptions": { | ||
"exclude": [ | ||
"**/*excluded1.ts", | ||
"**/*excluded2.ts" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"rules": { | ||
"semicolon": [ | ||
true, | ||
"always" | ||
] | ||
}, | ||
"linterOptions": { | ||
"exclude": [ | ||
"**/*excluded.ts" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,7 +140,7 @@ describe("Configuration", () => { | |
config.jsRules.set("row", { ruleArguments: ["oar", "column"], ruleSeverity: "error" }); | ||
config.rules.set("foo", { ruleArguments: ["bar"], ruleSeverity: "off" }); | ||
config.rulesDirectory = ["foo"]; | ||
config.linterOptions = { typeCheck: true }; | ||
config.linterOptions = { exclude: ["foo"] }; | ||
assertConfigEquals(extendConfigurationFile(EMPTY_CONFIG, config), config); | ||
}); | ||
|
||
|
@@ -193,6 +193,50 @@ describe("Configuration", () => { | |
const actualConfig = extendConfigurationFile(baseConfig, extendingConfig); | ||
assertConfigEquals(actualConfig, expectedConfig); | ||
}); | ||
|
||
it("replaces exclude option", () => { | ||
const baseConfig = getEmptyConfig(); | ||
baseConfig.linterOptions = { | ||
exclude: ["src"], | ||
}; | ||
|
||
const extendingConfig = getEmptyConfig(); | ||
extendingConfig.linterOptions = { | ||
exclude: [ | ||
"lib", | ||
"bin", | ||
], | ||
}; | ||
|
||
const expectedConfig = getEmptyConfig(); | ||
expectedConfig.linterOptions = { | ||
exclude: [ | ||
"lib", | ||
"bin", | ||
], | ||
}; | ||
|
||
const actualConfig = extendConfigurationFile(baseConfig, extendingConfig); | ||
assertConfigEquals(actualConfig, expectedConfig); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. out of curiosity: what happens if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, only if |
||
}); | ||
|
||
it("empty linter options does not replace exclude", () => { | ||
const baseConfig = getEmptyConfig(); | ||
baseConfig.linterOptions = { | ||
exclude: ["src"], | ||
}; | ||
|
||
const extendingConfig = getEmptyConfig(); | ||
extendingConfig.linterOptions = {}; | ||
|
||
const expectedConfig = getEmptyConfig(); | ||
expectedConfig.linterOptions = { | ||
exclude: ["src"], | ||
}; | ||
|
||
const actualConfig = extendConfigurationFile(baseConfig, extendingConfig); | ||
assertConfigEquals(actualConfig, expectedConfig); | ||
}); | ||
}); | ||
|
||
describe("findConfigurationPath", () => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The excluded paths should probably be resolved relative to the location of
tslint.json
.If
/foo/tslint.json
excludesbaz.ts
we should only exclude/foo/baz.ts
and still lint/foo/bar/baz.ts
.That will only work when
filepath
is an absolute path.