Description
Dear TypeScript community,
Various communities have been trying to solve the same problem: a way to persist the settings passed to a command-line compiler, that is also easily readable by an IDE.
The Less.js discussion: less/less.js#1893
The TypeScript discussion: #1667
I'm sure there are more. TypeScript recently decided to use a tsconfig.json file to serve this need. But, rather than have proprietary / competing config.json formats which litter the root directory of a project, I propose two things, for this community, Less.js's and others:
- Define a generic config.json format (much like the generic package.json format), that can be expanded with settings for any project (maybe using the package.json name as the key to identify the library?).
- Define, as a standard, that any config files can be found in the root, OR, secondarily, in a
.config
folder. Everyone is putting their own "project start" files in root, and our repos are getting cluttered.
For the TypeScript community, it might make sense to support both config.json and tsconfig.json, since the latter is already implemented. The former could simply look like:
{
"typescript": {
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"out": "../../built/local/tsc.js",
"sourceMap": true,
},
"files": [
"core.ts",
"sys.ts",
"types.ts",
"scanner.ts",
"parser.ts",
"utilities.ts",
"binder.ts",
"checker.ts",
"emitter.ts",
"program.ts",
"commandLineParser.ts",
"tsc.ts",
"diagnosticInformationMap.generated.ts"
]
},
"less": { whatever makes sense }
"sass": { ditto }
}
Note: I'm not sure if config.json
is too generic a name to use on a widespread basis, but certainly tsconfig.json
is too specific to be co-opted by other libraries in an effort for simplicity (and not, by spec, expandable anyway).
What do you think?