Skip to content

Commit

Permalink
[microsoft#360] Use TypeScript config files for compilation
Browse files Browse the repository at this point in the history
  * Adding two TypeScript configuration files for compiling TypeScript
    files: tsconfig.json for files under "src" and
    tsconfig.testdata.config for files under "test-data".
  * Grunt will use these files in its "ts" tasks. Grunt file globbing is
    used to discover the files to compile, and will write the lists of
    files into the tsconfig files. This is used instead of the
    include/exclude support for tsconfigs because that feature does not
    behave as expected and will still include some other files that
    should not be compiled.
  * This also fixes a consistency issue when using VS Code, since the
    IDE will try to use a tsconfig in the root of the workspace;
    previously this would bring up inconsistent results since the true
    compilation options were in the grunt configuration.

closes microsoft#360
closes microsoft#361
  • Loading branch information
bgold09 authored and HamletDRC committed Apr 24, 2017
1 parent 051abda commit 4622450
Show file tree
Hide file tree
Showing 3 changed files with 437 additions and 35 deletions.
30 changes: 10 additions & 20 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,29 +200,19 @@ module.exports = function(grunt) {

ts: {
default: {
src: [
'./src/**/*.ts{,x}'
],
outDir: 'dist/src',
options: {
module: 'commonjs',
target: 'es5',
declaration: true,
failOnTypeErrors: true,
jsx: 'react'
tsconfig: {
tsconfig: './tsconfig.json',
passThrough: true,
updateFiles: true,
overwriteFiles: true
}
},
'test-data': {
src: [
'./test-data/**/*.ts{,x}'
],
outDir: 'dist/test-data',
options: {
module: 'commonjs',
target: 'es5',
declaration: false,
failOnTypeErrors: true,
jsx: 'react'
tsconfig: {
tsconfig: './tsconfig.testdata.json',
passThrough: true,
updateFiles: true,
overwriteFiles: true
}
}
},
Expand Down
286 changes: 271 additions & 15 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,273 @@
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "es5",
"outDir": "dist",
"noUnusedLocals": true,
"noUnusedParameters": true
},
"exclude": [
".tscache",
"dist",
"node_modules",
"templates",
"test-data"
]
"compilerOptions": {
"declaration": true,
"jsx": "react",
"module": "commonjs",
"outDir": "dist/src",
"removeComments": true,
"sourceMap": true,
"target": "es5"
},
"filesGlob": [
"src/**/*.ts{,x}"
],
"files": [
"src/chaiPreferContainsToIndexOfRule.ts",
"src/chaiVagueErrorsRule.ts",
"src/exportNameRule.ts",
"src/fixNoRequireImportsFormatter.ts",
"src/fixNoUnusedImportsFormatter.ts",
"src/fixNoVarKeywordFormatter.ts",
"src/functionNameRule.ts",
"src/importNameRule.ts",
"src/insecureRandomRule.ts",
"src/jqueryDeferredMustCompleteRule.ts",
"src/maxFuncBodyLengthRule.ts",
"src/missingJsdocRule.ts",
"src/missingOptionalAnnotationRule.ts",
"src/mochaAvoidOnlyRule.ts",
"src/mochaNoSideEffectCodeRule.ts",
"src/mochaUnneededDoneRule.ts",
"src/noBackboneGetSetOutsideModelRule.ts",
"src/noBannedTermsRule.ts",
"src/noConstantConditionRule.ts",
"src/noControlRegexRule.ts",
"src/noCookiesRule.ts",
"src/noDeleteExpressionRule.ts",
"src/noDisableAutoSanitizationRule.ts",
"src/noDocumentDomainRule.ts",
"src/noDocumentWriteRule.ts",
"src/noDuplicateCaseRule.ts",
"src/noDuplicateParameterNamesRule.ts",
"src/noEmptyInterfacesRule.ts",
"src/noEmptyLineAfterOpeningBraceRule.ts",
"src/noExecScriptRule.ts",
"src/noForInRule.ts",
"src/noFunctionConstructorWithStringArgsRule.ts",
"src/noFunctionExpressionRule.ts",
"src/noHttpStringRule.ts",
"src/noIncrementDecrementRule.ts",
"src/noInnerHtmlRule.ts",
"src/noInvalidRegexpRule.ts",
"src/noJqueryRawElementsRule.ts",
"src/noMissingVisibilityModifiersRule.ts",
"src/noMultilineStringRule.ts",
"src/noMultipleVarDeclRule.ts",
"src/noOctalLiteralRule.ts",
"src/noRegexSpacesRule.ts",
"src/noRelativeImportsRule.ts",
"src/noReservedKeywordsRule.ts",
"src/noSingleLineBlockCommentRule.ts",
"src/noSparseArraysRule.ts",
"src/noStatelessClassRule.ts",
"src/noStringBasedSetImmediateRule.ts",
"src/noStringBasedSetIntervalRule.ts",
"src/noStringBasedSetTimeoutRule.ts",
"src/noSuspiciousCommentRule.ts",
"src/noTypeofUndefinedRule.ts",
"src/noUnexternalizedStringsRule.ts",
"src/noUnnecessaryBindRule.ts",
"src/noUnnecessaryFieldInitializationRule.ts",
"src/noUnnecessaryLocalVariableRule.ts",
"src/noUnnecessaryOverrideRule.ts",
"src/noUnnecessarySemicolonsRule.ts",
"src/noUnsupportedBrowserCodeRule.ts",
"src/noUnusedImportsRule.ts",
"src/noUselessFilesRule.ts",
"src/noVarSelfRule.ts",
"src/noWithStatementRule.ts",
"src/nonLiteralRequireRule.ts",
"src/possibleTimingAttackRule.ts",
"src/preferArrayLiteralRule.ts",
"src/preferTypeCastRule.ts",
"src/promiseMustCompleteRule.ts",
"src/reactA11yAnchorsRule.ts",
"src/reactA11yAriaUnsupportedElementsRule.ts",
"src/reactA11yEventHasRoleRule.ts",
"src/reactA11yImageButtonHasAltRule.ts",
"src/reactA11yImgHasAltRule.ts",
"src/reactA11yLangRule.ts",
"src/reactA11yMetaRule.ts",
"src/reactA11yPropsRule.ts",
"src/reactA11yProptypesRule.ts",
"src/reactA11yRoleHasRequiredAriaPropsRule.ts",
"src/reactA11yRoleRule.ts",
"src/reactA11yRoleSupportsAriaPropsRule.ts",
"src/reactA11yTabindexNoPositiveRule.ts",
"src/reactA11yTitlesRule.ts",
"src/reactAnchorBlankNoopenerRule.ts",
"src/reactIframeMissingSandboxRule.ts",
"src/reactNoDangerousHtmlRule.ts",
"src/reactThisBindingIssueRule.ts",
"src/reactTsxCurlySpacingRule.ts",
"src/reactUnusedPropsAndStateRule.ts",
"src/tests/ChaiPreferContainsToIndexOfRuleTests.ts",
"src/tests/ChaiVagueErrorsRuleTests.ts",
"src/tests/ExportNameRuleTests.ts",
"src/tests/FixNoRequireImportsFormatterTests.ts",
"src/tests/FixNoUnusedImportsFormatterTests.ts",
"src/tests/FixNoVarKeywordFormatterTests.ts",
"src/tests/FunctionNameRuleTests.ts",
"src/tests/GetImplicitRoleTest.ts",
"src/tests/ImportNameRuleTests.ts",
"src/tests/InsecureRandomRuleTests.ts",
"src/tests/MaxFuncBodyLengthRuleTests.ts",
"src/tests/MissingJsdocRuleTests.ts",
"src/tests/MissingOptionalAnnotationTests.ts",
"src/tests/MochaAvoidOnlyRuleTests.ts",
"src/tests/MochaNoSideEffectCodeRuleTests.ts",
"src/tests/MochaUnneededDoneRuleTests.ts",
"src/tests/NoBackboneGetSetOutsideModelRuleTests.ts",
"src/tests/NoBannedTermsTests.ts",
"src/tests/NoConstantConditionRuleTests.ts",
"src/tests/NoControlRegexRuleTests.ts",
"src/tests/NoCookiesTests.ts",
"src/tests/NoDeleteExpressionTests.ts",
"src/tests/NoDisableAutoSanitizationTests.ts",
"src/tests/NoDocumentDomainRuleTests.ts",
"src/tests/NoDocumentWriteTests.ts",
"src/tests/NoDuplicateCaseRuleTests.ts",
"src/tests/NoDuplicateParameterNamesTests.ts",
"src/tests/NoEmptyInterfacesRuleTests.ts",
"src/tests/NoEmptyLineAfterOpeningBraceRuleTests.ts",
"src/tests/NoExecScriptTests.ts",
"src/tests/NoForInRuleTests.ts",
"src/tests/NoFunctionConstructorWithStringArgsTests.ts",
"src/tests/NoFunctionExpressionRuleTests.ts",
"src/tests/NoHttpStringRuleTests.ts",
"src/tests/NoIncrementDecrementTests.ts",
"src/tests/NoInnerHtmlRuleTests.ts",
"src/tests/NoInvalidRegexpRuleTests.ts",
"src/tests/NoJqueryRawElementsRuleTests.ts",
"src/tests/NoMissingVisibilityModifiersRuleTests.ts",
"src/tests/NoMultilineStringTests.ts",
"src/tests/NoMultipleVarDeclRuleTests.ts",
"src/tests/NoOctalLiteralTests.ts",
"src/tests/NoRegexSpacesRuleTests.ts",
"src/tests/NoRelativeImportsRuleTests.ts",
"src/tests/NoReservedKeywordsTests.ts",
"src/tests/NoSingleLineBlockCommentRuleTests.ts",
"src/tests/NoSparseArraysRuleTests.ts",
"src/tests/NoStatelessClassRuleTests.ts",
"src/tests/NoStringBasedSetImmediateTests.ts",
"src/tests/NoStringBasedSetIntervalTests.ts",
"src/tests/NoStringBasedSetTimeoutTests.ts",
"src/tests/NoSuspiciousCommentRuleTests.ts",
"src/tests/NoTypeofUndefinedRuleTests.ts",
"src/tests/NoUnexternalizedStringsRuleTests.ts",
"src/tests/NoUnnecessaryBindRuleTests.ts",
"src/tests/NoUnnecessaryOverrideRuleTests.ts",
"src/tests/NoUnnecessarySemicolonsTests.ts",
"src/tests/NoUnsupportedBrowserCodeRuleTests.ts",
"src/tests/NoUnusedImportsTests.ts",
"src/tests/NoUselessFilesRuleTests.ts",
"src/tests/NoVarSelfRuleTests.ts",
"src/tests/NoWithStatementTests.ts",
"src/tests/NonLiteralRequireRuleTests.ts",
"src/tests/PossibleTimingAttackRuleTests.ts",
"src/tests/PreferTypeCastRuleTests.ts",
"src/tests/PromiseMustCompleteRuleTests.ts",
"src/tests/ReactA11yAnchorsRuleTests.ts",
"src/tests/ReactA11yAriaUnsupportedElementsRuleTest.ts",
"src/tests/ReactA11yEventHasRoleRuleTest.ts",
"src/tests/ReactA11yImageButtonHasAltRuleTests.ts",
"src/tests/ReactA11yLangRuleTests.ts",
"src/tests/ReactA11yMetaRuleTests.ts",
"src/tests/ReactA11yProptypesRuleTest.ts",
"src/tests/ReactA11yTitlesRuleTests.ts",
"src/tests/ReactAnchorBlankNoopenerRuleTests.ts",
"src/tests/ReactIframeMissingSandboxRuleTests.ts",
"src/tests/ReactNoDangerousHtmlRuleTests.ts",
"src/tests/ReactThisBindingIssueRuleTests.ts",
"src/tests/ReactTsxCurlySpacingRuleTests.ts",
"src/tests/ReactUnusedPropsAndStateRuleTests.ts",
"src/tests/TestHelper.ts",
"src/tests/UnderscoreConsistentInvocationRuleTests.ts",
"src/tests/UnnecessaryLocalVariableRuleTests.ts",
"src/tests/UseIsnanRuleTests.ts",
"src/tests/UseNamedParameterRuleTests.ts",
"src/tests/UtilsTests.ts",
"src/tests/ValidTypeofRuleTests.ts",
"src/tests/jqueryDeferredMustCompleteRuleTests.ts",
"src/tests/noUnnecessaryFieldInitializationRuleTests.ts",
"src/tests/preferArrayLiteralRuleTests.ts",
"src/tests/reactA11yImgHasAltRuleTests.ts",
"src/tests/reactA11yPropsRuleTests.ts",
"src/tests/reactA11yRoleHasRequiredAriaPropsRuleTests.ts",
"src/tests/reactA11yRoleRuleTests.ts",
"src/tests/reactA11yRoleSupportsAriaPropsRuleTests.ts",
"src/tests/reactA11yTabindexNoPositiveRuleTests.ts",
"src/tests/references.ts",
"src/underscoreConsistentInvocationRule.ts",
"src/useIsnanRule.ts",
"src/useNamedParameterRule.ts",
"src/utils/AstUtils.ts",
"src/utils/BannedTermWalker.ts",
"src/utils/BaseFormatter.ts",
"src/utils/ChaiUtils.ts",
"src/utils/ErrorTolerantWalker.ts",
"src/utils/ExtendedMetadata.ts",
"src/utils/JsxAttribute.ts",
"src/utils/MochaUtils.ts",
"src/utils/NoStringParameterToFunctionCallWalker.ts",
"src/utils/Scope.ts",
"src/utils/ScopedSymbolTrackingWalker.ts",
"src/utils/TypeGuard.ts",
"src/utils/Utils.ts",
"src/utils/attributes/IAria.ts",
"src/utils/attributes/IDom.ts",
"src/utils/attributes/IRole.ts",
"src/utils/getImplicitRole.ts",
"src/utils/implicitRoles/a.ts",
"src/utils/implicitRoles/area.ts",
"src/utils/implicitRoles/article.ts",
"src/utils/implicitRoles/aside.ts",
"src/utils/implicitRoles/body.ts",
"src/utils/implicitRoles/button.ts",
"src/utils/implicitRoles/datalist.ts",
"src/utils/implicitRoles/dd.ts",
"src/utils/implicitRoles/details.ts",
"src/utils/implicitRoles/dialog.ts",
"src/utils/implicitRoles/dl.ts",
"src/utils/implicitRoles/dt.ts",
"src/utils/implicitRoles/footer.ts",
"src/utils/implicitRoles/form.ts",
"src/utils/implicitRoles/h1.ts",
"src/utils/implicitRoles/h2.ts",
"src/utils/implicitRoles/h3.ts",
"src/utils/implicitRoles/h4.ts",
"src/utils/implicitRoles/h5.ts",
"src/utils/implicitRoles/h6.ts",
"src/utils/implicitRoles/header.ts",
"src/utils/implicitRoles/hr.ts",
"src/utils/implicitRoles/img.ts",
"src/utils/implicitRoles/index.ts",
"src/utils/implicitRoles/input.ts",
"src/utils/implicitRoles/li.ts",
"src/utils/implicitRoles/link.ts",
"src/utils/implicitRoles/main.ts",
"src/utils/implicitRoles/math.ts",
"src/utils/implicitRoles/menu.ts",
"src/utils/implicitRoles/menuitem.ts",
"src/utils/implicitRoles/meter.ts",
"src/utils/implicitRoles/nav.ts",
"src/utils/implicitRoles/ol.ts",
"src/utils/implicitRoles/optgroup.ts",
"src/utils/implicitRoles/option.ts",
"src/utils/implicitRoles/output.ts",
"src/utils/implicitRoles/progress.ts",
"src/utils/implicitRoles/section.ts",
"src/utils/implicitRoles/select.ts",
"src/utils/implicitRoles/summary.ts",
"src/utils/implicitRoles/table.ts",
"src/utils/implicitRoles/tbody.ts",
"src/utils/implicitRoles/td.ts",
"src/utils/implicitRoles/textarea.ts",
"src/utils/implicitRoles/tfoot.ts",
"src/utils/implicitRoles/th.ts",
"src/utils/implicitRoles/thead.ts",
"src/utils/implicitRoles/tr.ts",
"src/utils/implicitRoles/ul.ts",
"src/validTypeofRule.ts"
]
}
Loading

0 comments on commit 4622450

Please sign in to comment.