我正在尝试创建我的第一个 Firestore Cloud Function,并完成了入门说明。但是当我尝试部署 Hello World 脚本时,出现以下错误:
=== Deploying to 'myproject-dev'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions@ lint /Users/nlam/Dropbox/dev/myproject/backend/functions
> tslint --project tsconfig.json
module.js:549
throw err;
^
Error: Cannot find module '../lib/tslint-cli'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/nlam/Dropbox/dev/myproject/backend/functions/node_modules/.bin/tslint:3:1)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! …Run Code Online (Sandbox Code Playgroud) 我经常使用模块来处理 TypeScript 文件和 JavaScript 文件。
我的 TS/ESLint 规则强制使用单引号,但 WebStorm 总是用双引号完成代码。有没有办法配置这个?
当我在我的代码上运行 tslint 时,我收到以下错误
functions that return promises must be async
Run Code Online (Sandbox Code Playgroud)
这是代码
private doSomething(): void {
fetch(myUrl)
.then((rsp: Response) => rsp.text()) // <-- gives error
.then(txt => this.txt = txt);
}
Run Code Online (Sandbox Code Playgroud)
现在不知道如何解决这个问题,因为代码运行得很好!有什么建议 ?
是否可以仅禁用从 tsLint 获得的最大行长度警告,但不使用:// tslint:disable-next-line:max-line-length。有没有办法永久关闭它。不是短绒只是那个功能。
所以我处于一种情况,我希望特定的类能够禁用每个文件的最大类。
但是我尝试添加规则 /* tslint:disable:max-classes-per-file: */
在文件的开头,但我仍然收到警告。
即使 "exclude": [ "src/modules/Utils/Utils.tsx" ]在我的 tsconfig.json 中做也行不通。
我还在
web_1 | /usr/app/web/src/modules/Utils/Utils.tsx
web_1 | /usr/app/web/src/modules/Utils/Utils.tsx(19,1) 中的错误:
web_1 | max-classes-per-file:每个文件最多允许 1 个类。
我错过了什么吗?
我正在将 tslint 用于我的打字稿代码。我想记录接口的属性。tsLint 给出错误JSDoc tag '@property' is redundant in TypeScript code. (no-redundant-jsdoc)tslint(1)
以下是我的评论
/**
* @property value - number with a unit as string
*/
Run Code Online (Sandbox Code Playgroud)
禁用下一行的 tslint 也不起作用。
我刚刚迁移到 Angular 8,然后开始收到错误
Module '"../../node_modules/@angular/router/router"' has no exported member 'NoPreloading'.
Run Code Online (Sandbox Code Playgroud)
该错误来自以下行:
import { NoPreloading, RouterModule, Routes } from '@angular/router';
Run Code Online (Sandbox Code Playgroud)
它发生在 的所有成员身上@angular/router。我究竟做错了什么?尽管出现错误,一切仍然正常。
最近在我们的项目中迁移到使用@typescript-eslint/parsertslint 来慢慢迁移。一切都很顺利,但我有一个小问题/问题我无法解决。
我是否需要在 tsconfig 排除数组以及导出对象上的ignorePatterns 中指定忽略文件/模式.eslintrc?有什么不同?
我们的src/lang目录中有一个 messages.js 文件,我试图忽略它,但目前在我们的 pre-commit 钩子上抛出了一个 lint 错误,这让我想知道这个问题以及这两个设置如何协同工作。
Parsing error: "parserOptions.project" has been set for '@typescript-eslint/parser'
The file does not match your project config: src/lang/messages.js. The file must be included in at least one of the projects provided
我认为我对这些交织的理解是关闭的,因为当 eslint 运行时,我认为 parserOptions 会从 tsconfig 中获取项目规则,其中排除了 js 文件。
目前,我在eslintrc 中谈论的部分如下所示:
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: path.resolve(__dirname, './tsconfig.json'),
tsconfigRootDir: __dirname,
useJSXTextNode: true,
sourceType: 'module', …Run Code Online (Sandbox Code Playgroud) 我在我的项目中使用 angular 所以我遇到了这个问题我试图将我的打字稿降级到 3.9.7 但在这里仍然没有工作是我的package.json dpendencies。
"private": true,
"dependencies": {
"@angular-devkit/core": "^10.1.3",
"@angular-devkit/schematics": "^10.1.3",
"@angular-material-components/datetime-picker": "^4.0.2",
"@angular/animations": "^10.1.3",
"@angular/cdk": "^10.0.0",
"@angular/common": "^10.1.3",
"@angular/compiler": "~10.1.3",
"@angular/core": "^10.1.3",
"@angular/forms": "^10.1.3",
"@angular/google-maps": "^10.0.1",
"@angular/material": "^10.0.0",
"@angular/platform-browser": "^10.1.3",
"@angular/platform-browser-dynamic": "~10.1.3",
"@angular/router": "^10.1.3",
"@angular/typescript": "^2.0.0-5d0e199",
"@auth0/angular-jwt": "^4.0.0",
Run Code Online (Sandbox Code Playgroud)
tslint ×10
typescript ×5
angular ×4
javascript ×4
angular-cli ×1
angular8 ×1
async-await ×1
asynchronous ×1
eslint ×1
jsdoc ×1
promise ×1
webstorm ×1