小编ANK*_*DAR的帖子

自动修复TSLint警告

    [64, 1]: space indentation expected
    [15, 27]: Missing semicolon
    [109, 36]: missing whitespace
    [111, 24]: missing whitespace
    [70, 1]: Consecutive blank lines are forbidden
Run Code Online (Sandbox Code Playgroud)

我一直在收到TSLint的警告.有大量的警告,手动修复它将非常困难.

我正在寻找一种可以自动修复大多数警告的方法.

warnings typescript tslint angular

53
推荐指数
4
解决办法
3万
查看次数

运行heroku本地网络时无法识别babel-node

我尝试在 Heroku 上部署 Node.js API,但显示应用程序错误。

所以,使用“ heroku local web ”命令来测试任何错误..并得到一个错误,说'babel-node'不是内部或外部命令,也不是可运行的程序或批处理文件。

另一方面,当我运行命令“npm start”时,我没有收到任何错误并且服务器开始运行。

包.json

 {
      "name": "apollo-starter-kit",
      "version": "0.1.0",
      "description": "Minimal set of code to write a GraphQL server with Apollo graphql-tools",
      "scripts": {
        "start": "nodemon ./server.js --exec babel-node",
        "test": "echo \"Error: no test specified\" && exit 1",
        "lint": "eslint ."
      },
      "repository": {
        "type": "git",
        "url": "git+https://github.com/apollostack/apollo-starter-kit.git"
      },
      "keywords": [
        "Node.js",
        "Javascript",
        "GraphQL",
        "Express",
        "Apollo",
        "Meteor"
      ],
      "author": "Jonas Helfer <jonas@helfer.email>",
      "license": "MIT",
      "bugs": {
        "url": "https://github.com/apollostack/apollo-starter-kit/issues" …
Run Code Online (Sandbox Code Playgroud)

heroku node.js ecmascript-6 babeljs

5
推荐指数
1
解决办法
2698
查看次数

Promise/async-await with mongoose,返回空数组

最后的控制台返回空数组.控制台在ids.map函数完成之前运行

var ids = [];
var allLync = []
var user = await User.findOne(args.user)
ids.push(user._id)
user.following.map(x => {
    ids.push(x)
})
ids.map(async x => {
    var lync = await Lync.find({ "author": x })
    lync.map(u => {
        allLync.push[u]
    })
})

console.log(allLync)
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

javascript mongoose node.js promise async-await

3
推荐指数
1
解决办法
1470
查看次数