-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: files are not excluded when using user-provided tsconfig (and va…
…rious other fixes and improvements) (#969) When using a user-provided tsconfig, the `exclude` and `include` options were incorrectly dropped and instead all `*.ts` files were always included in the build. This change also improves on the compile test which previously actually didn't compile anything. Also added a bunch of additional configurable options to make many more common tsconfigs pass the the strict validation. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
- Loading branch information
Showing
14 changed files
with
176 additions
and
74 deletions.
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,22 @@ | ||
import jsiiConfiguredOptions from './jsii-configured-options'; | ||
import { Match, RuleSet } from '../validator'; | ||
|
||
// A rule set defining all compilerOptions that can be configured by users with or without constraints. | ||
// These are options jsii doesn't have a particular opinion about | ||
// This is an internal rule set, that may be used by other rule sets. | ||
|
||
const configurableOptions = new RuleSet(); | ||
|
||
// import all options that are configurable via jsii settings | ||
configurableOptions.import(jsiiConfiguredOptions); | ||
|
||
// options jsii allows to be configured | ||
configurableOptions.shouldPass('incremental', Match.ANY); | ||
configurableOptions.shouldPass('noImplicitReturns', Match.ANY); | ||
configurableOptions.shouldPass('noUnusedLocals', Match.ANY); | ||
configurableOptions.shouldPass('noUnusedParameters', Match.ANY); | ||
configurableOptions.shouldPass('resolveJsonModule', Match.ANY); | ||
configurableOptions.shouldPass('experimentalDecorators', Match.ANY); | ||
configurableOptions.shouldPass('noFallthroughCasesInSwitch', Match.ANY); | ||
|
||
export default configurableOptions; |
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
import { Match, RuleSet } from '../validator'; | ||
|
||
// A rule set for deprecated compilerOptions that should not be used with jsii | ||
// This is an internal rule set, that may be used by other rule sets. | ||
const deprecatedOptions = new RuleSet(); | ||
deprecatedOptions.shouldPass('prepend', Match.MISSING); | ||
|
||
export default deprecatedOptions; |
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,20 @@ | ||
import { Match, RuleSet } from '../validator'; | ||
|
||
// A rule set defining all compilerOptions that are configurable via the jsii field in package.json | ||
// This is an internal rule set, that may be used by other rule sets. | ||
// We accept all value for these | ||
const jsiiConfiguredOptions = new RuleSet(); | ||
jsiiConfiguredOptions.shouldPass('outdir', Match.ANY); | ||
jsiiConfiguredOptions.shouldPass('rootDir', Match.ANY); | ||
jsiiConfiguredOptions.shouldPass('forceConsistentCasingInFileNames', Match.ANY); | ||
jsiiConfiguredOptions.shouldPass('declarationMap', Match.ANY); | ||
jsiiConfiguredOptions.shouldPass('inlineSourceMap', Match.ANY); | ||
jsiiConfiguredOptions.shouldPass('inlineSources', Match.ANY); | ||
jsiiConfiguredOptions.shouldPass('sourceMap', Match.ANY); | ||
jsiiConfiguredOptions.shouldPass('types', Match.ANY); | ||
jsiiConfiguredOptions.shouldPass('baseUrl', Match.ANY); | ||
jsiiConfiguredOptions.shouldPass('paths', Match.ANY); | ||
jsiiConfiguredOptions.shouldPass('composite', Match.ANY); // configured via projectReferences | ||
jsiiConfiguredOptions.shouldPass('tsBuildInfoFile', Match.ANY); | ||
|
||
export default jsiiConfiguredOptions; |
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import incompatible from './incompatible-options'; | ||
import incompatibleOptions from './incompatible-options'; | ||
import { RuleSet } from '../validator'; | ||
|
||
// The public rule set used for the "minimal" tsconfig validation setting | ||
// To goal of this rule set is to only prevent obvious misconfigurations, | ||
// while leaving everything else up to the user. | ||
const minimal = new RuleSet(); | ||
minimal.import(incompatible); | ||
minimal.import(incompatibleOptions); | ||
|
||
export default minimal; |
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,17 @@ | ||
import { Match, RuleSet } from '../validator'; | ||
|
||
// A rule set for the compilerOptions of the strict family. | ||
// The rule set enforces strict, but allows the defining options that are implied by strict | ||
|
||
const strictFamilyOptions = new RuleSet(); | ||
strictFamilyOptions.shouldPass('strict', Match.eq(true)); | ||
strictFamilyOptions.shouldPass('alwaysStrict', Match.optional(Match.eq(true))); | ||
strictFamilyOptions.shouldPass('noImplicitAny', Match.optional(Match.eq(true))); | ||
strictFamilyOptions.shouldPass('noImplicitThis', Match.optional(Match.eq(true))); | ||
strictFamilyOptions.shouldPass('strictBindCallApply', Match.optional(Match.eq(true))); | ||
strictFamilyOptions.shouldPass('strictFunctionTypes', Match.optional(Match.eq(true))); | ||
strictFamilyOptions.shouldPass('strictNullChecks', Match.optional(Match.eq(true))); | ||
strictFamilyOptions.shouldPass('strictPropertyInitialization', Match.optional(Match.eq(true))); | ||
strictFamilyOptions.shouldPass('useUnknownInCatchVariables', Match.optional(Match.eq(true))); | ||
|
||
export default strictFamilyOptions; |
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
Oops, something went wrong.