Rob*_*erd 5 typescript tsconfig atom-editor tslint
如何从被转译中排除打字稿文件,但仍确保它们与 Atom 编辑器中的 linter 一起正常工作?
我在我的*.spec.ts文件中收到此错误:
ES5/ES3 中的异步函数或方法需要“Promise”构造函数。确保您有“Promise”构造函数的声明或在您的
--lib选项中包含“ES2015” 。
出现问题是因为我明确排除了包含所有测试文件的目录(请参阅下面的 tsconfig 文件),因为我不希望在构建项目时将这些文件转换为 JavaScript。但是,当我在 Atom 编辑器中查看它们时,我确实希望 tslint 插件正确地对这些文件进行检查。
我的设置:
我的tsconfig.json文件:
{
"compileOnSave": false,
"compilerOptions": {
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"baseUrl": ".",
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"inlineSourceMap": true,
"inlineSources": true,
"lib": [
"es2017",
"dom"
],
"moduleResolution": "node",
"newLine": "lf",
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"outDir": "./dist",
"target": "es5",
"typeRoots": [
"node_modules/@types"
]
},
"exclude": [
"./spec",
"./dist"
]
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1973 次 |
| 最近记录: |