我的 npm-lint 抛出错误“缺少脚本:lint”

新手上路,请多包涵

我正在尝试在本地运行 npm run,并运行创建 package.json 的 npm init。这是我的 package.json

     "name": "ironic-ui",
    "version": "1.0.0",
    "description": "======================== Team and repository tags    ========================",
    "main": "test-shim.js",
    "directories": {
    "doc": "doc"
   },
    "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
   },
    "repository": {
    "type": "git",
    "url": "https://git.openstack.org/openstack/ironic-ui"
  },
    "author": "",
    "license": "ISC"
 }

有什么遗漏吗?还是我需要安装更多的东西?我收到错误“缺少脚本:lint”谢谢

原文由 user3339691 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 701
1 个回答

您需要设置 linter 并在 package.json 中添加 lint 命令 许多 linter 都可用。假设你设置了 eslint https://www.npmjs.com/package/eslint

它看起来像这样

// package.json
{
  //...
  "scripts": {
    "lint": "eslint.js"
  }
}

原文由 roxxypoxxy 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题