4409 shaares
Voici ma configuration pour le compilateur TypeScript à mettre dans le fichier tsconfig.json. La première à destination de la production (avec beaucoup de check et de contraintes) et la seconde à destination du mode développeur (qui autorise plus de chose afin d'exécuter les tests en continue) :
PROD configuration :
{
"compilerOptions": {
// BUILD GLOBAL OPTIONS :
"module": "commonjs",
"outDir": "./target/js",
"sourceMap": true,
"target": "ES5", // The aimed JS version (ES5, ES2016, ES2017 or ESNext
// BUILD OUTPUT :
"diagnostics": true,
"pretty": true,
// ENCODING
"charset": "utf8", // The targeted file encoding
"newLine": "lf", // File will use Line Feed as EOL character (Unix format)
// COMPILER BEHAVIOR :
"allowJs" : false, // Allow JS syntax
"preserveConstEnums": true, // 'const enum' are kept in generated code
"removeComments": true, // Comment removed from transpiled code
// COMPILER ENFORCING :
"noImplicitAny": true, // 'any' type is mandatory
"noImplicitThis": true, // Forbien to mix 'any' and 'this' in the same expression
"noImplicitReturns": true, // Raise error is a 'return' is missing in part of a function
"noUnusedLocals": true, // Report errors on unused locals
"noUnusedParameters": true // Report error on unused parameters
},
"include": [
"./src/main/**/*"
]
}
DEV configuration :
{
"compilerOptions": {
// BUILD GLOBAL OPTIONS :
"module": "commonjs",
"outDir": "./target/js",
"sourceMap": true,
"target": "ES5", // The aimed JS version (ES5, ES2016, ES2017 or ESNext
// BUILD OUTPUT :
"diagnostics": true,
"pretty": true,
// ENCODING
"charset": "utf8", // The targeted file encoding
"newLine": "lf", // File will use Line Feed as EOL character (Unix format)
// COMPILER BEHAVIOR :
"allowJs" : false, // Allow JS syntax
"preserveConstEnums": true, // 'const enum' are kept in generated code
"removeComments": true, // Comment removed from transpiled code
// COMPILER ENFORCING :
"noImplicitAny": true, // 'any' type is mandatory
"noImplicitThis": true, // Forbien to mix 'any' and 'this' in the same expression
"noImplicitReturns": true // Raise error is a 'return' is missing in part of a function
},
"include": [
"./src/main/js/**/*"
]
}