简体   繁体   English

eslint 脚本失败,流星运行 npm eslint

[英]eslint script fails with meteor run npm eslint

Eslint works with setup below but causes few errors I do not understand. Eslint 可以使用下面的设置,但会导致一些我不明白的错误。

  1. As you can see when I run meteor npm run lint npm throws error below.正如你所看到的,当我运行meteor npm run lint npm 在下面抛出错误。 It completes the lint and then says it failed to complete?它完成了 lint,然后说它未能完成? --UPDATE-- I fixed this issue by adding exit 0 attribute to gracefully exit the eslit process. --UPDATE-- 我通过添加 exit 0 属性来优雅地退出 eslit 进程来解决这个问题。 If you run into the same issue look at my package.json line "lint": "eslint .;exit 0", to fix this.如果您遇到同样的问题,请查看我的 package.json 行"lint": "eslint .;exit 0",以解决此问题。 Leaving this for reference留下这个供参考

  2. Problem is that I am not sure how to make eslint ignore imports from the meteor.问题是我不确定如何让 eslint 忽略来自流星的导入。 I have tried with eslint-plugin-meteor and turning on import resolver meteor, but that does not seem to work.我已经尝试过使用eslint-plugin-meteor并打开导入解析器流星,但这似乎不起作用。 --UPDATE-- I silenced errors in .eslintrc file in below question, until issue described below is fixed [ https://github.com/clayne11/eslint-import-resolver-meteor/issues/11] Leaving this for reference --UPDATE--我在下面的问题中消除了 .eslintrc 文件中的错误,直到下面描述的问题得到解决 [ https://github.com/clayne11/eslint-import-resolver-meteor/issues/11]留作参考

    /Users/kimmo/Documents/carecity/server/main.js 1:1 error 'meteor' should be listed in the project's dependencies. /Users/kimmo/Documents/carecity/server/main.js 1:1 错误 'meteor' 应该列在项目的依赖项中。 Run 'npm i -S meteor' to add it import/no-extraneous-dependencies 1:24 error Unable to resolve path to module 'meteor/meteor' import/no-unresolved运行'npm i -Smeteor'以添加它导入/无外部依赖1:24错误无法解析模块'流星/流星'导入/无未解析的路径

    ✖ 2 problems (2 errors, 0 warnings) ✖ 2个问题(2个错误,0个警告)

    npm ERR! npm 错误! Darwin 14.5.0 npm ERR!达尔文 14.5.0 npm ERR! argv "/Users/kimmo/.meteor/packages/meteor-tool/.1.4.1_1.1ugzqvs++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/node" "/Users/kimmo/.meteor/packages/meteor-tool/.1.4.1_1.1ugzqvs++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/npm" "run" "lint" npm ERR! argv "/Users/kimmo/.meteor/packages/meteor-tool/.1.4.1_1.1ugzqvs++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin/节点"""/Users/kimmo/.meteor/packages/meteor-tool/.1.4.1_1.1ugzqvs++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/bin /npm" "run" "lint" npm ERR! node v4.5.0 npm ERR! node v4.5.0 npm ERR! npm v3.10.6 npm ERR! npm v3.10.6 npm ERR! code ELIFECYCLE npm ERR!代码 ELIFECYCLE npm ERR! carecity@ lint: eslint . carecity@lint: eslint . npm ERR! npm 错误! Exit status 1 npm ERR!退出状态 1 npm ERR! npm ERR! npm 错误! Failed at the carecity@ lint script 'eslint .'.在 carecity@ lint 脚本 'eslint .' 中失败。 npm ERR! npm 错误! Make sure you have the latest version of node.js and npm installed.确保您安装了最新版本的 node.js 和 npm。 npm ERR! npm 错误! If you do, this is most likely a problem with the carecity package, npm ERR!如果你这样做了,这很可能是 carecity 包 npm ERR 的问题! not with npm itself.不是 npm 本身。 npm ERR! npm 错误! Tell the author that this fails on your system: npm ERR!告诉作者这在你的系统上失败了:npm ERR! eslint .埃斯林特。 npm ERR! npm 错误! You can get information on how to open an issue for this project with: npm ERR!您可以通过以下方式获取有关如何为此项目打开问题的信息:npm ERR! npm bugs carecity npm ERR! npm bugs carecity npm ERR! Or if that isn't available, you can get their info via: npm ERR!或者,如果这不可用,您可以通过以下方式获取他们的信息:npm ERR! npm owner ls carecity npm ERR! npm 所有者 ls carecity npm ERR! There is likely additional logging output above.上面可能有额外的日志输出。

    npm ERR! npm 错误! Please include the following file with any support request: npm ERR!请在任何支持请求中包含以下文件:npm ERR! /Users/kimmo/Documents/carecity/npm-debug.log /Users/kimmo/Documents/carecity/npm-debug.log

My package.json file below >我的 package.json 文件如下 >

{
  "name": "carecity",
  "private": true,
  "scripts": {
    "start": "meteor run",
    "lint": "eslint .;exit 0",
    "pretest": "npm run lint --silent"
  },
  "eslintConfig": {
    "parser": "babel-eslint",
    "parserOptions": {
      "allowImportExportEverywhere": true
    },
    "plugins": [
      "meteor"
    ],
    "extends": [
      "airbnb",
      "plugin:meteor/recommended"
    ],
    "settings": {
      "import/resolver": "meteor"
    },
    "rules": {}
  },
  "dependencies": {
    "algoliasearch": "^3.18.1",
    "instantsearch.js": "^1.8.5",
    "material-icons": "^0.1.0",
    "material-ui": "^0.15.4",
    "meteor-node-stubs": "~0.2.0",
    "react": "^15.3.1",
    "react-addons-pure-render-mixin": "^15.3.1",
    "react-dom": "^15.3.1",
    "react-router": "^2.8.0",
    "react-tap-event-plugin": "^1.0.0",
    "roboto-fontface": "^0.6.0"
  },
  "devDependencies": {
    "babel-eslint": "^6.1.2",
    "eslint": "^3.5.0",
    "eslint-config-airbnb": "^11.1.0",
    "eslint-import-resolver-meteor": "^0.3.3",
    "eslint-plugin-import": "^1.14.0",
    "eslint-plugin-jsx-a11y": "^2.2.1",
    "eslint-plugin-meteor": "^4.0.0",
    "eslint-plugin-react": "^6.2.0",
    "faker": "^3.1.0",
    "getstorybook": "^1.4.5"
  }
}

My .eslintrc file >我的 .eslintrc 文件 >

// Temporary fix for errors caused by airbnb rules https://github.com/airbnb/javascript/issues/978

// "import/no-extraneous-dependencies": "off" and "settings": { "import/core-modules": [ "meteor/meteor" ] }
// added temperatery to to silence meteor import warning see issue > https://github.com/clayne11/eslint-import-resolver-meteor/issues/11

{
  "extends": "airbnb",
  "rules": {
    "react/require-extension": "off",
    "import/no-extraneous-dependencies": "off"
  },
  "settings": {
    "import/core-modules": [ "meteor/meteor" ]
  }
}

See my updated on the above question.请参阅我对上述问题的更新。

Error one can be fixed simply by adding "lint": "eslint .;exit 0" on the package.json file错误一可以通过在 package.json 文件中添加"lint": "eslint .;exit 0"来修复

Error 2 is currently been worked on in Github issue https://github.com/clayne11/eslint-import-resolver-meteor/issues/11 To temporarily silence the issues you can use .eslintrc in my example above.错误 2 目前正在 Github 问题中解决https://github.com/clayne11/eslint-import-resolver-meteor/issues/11要暂时消除问题,您可以在上面的示例中使用 .eslintrc。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM