[英]eslint script fails with meteor run npm eslint
Eslint 可以使用下面的設置,但會導致一些我不明白的錯誤。
正如你所看到的,當我運行meteor npm run lint
npm 在下面拋出錯誤。 它完成了 lint,然后說它未能完成? --UPDATE-- 我通過添加 exit 0 屬性來優雅地退出 eslit 進程來解決這個問題。 如果您遇到同樣的問題,請查看我的 package.json 行"lint": "eslint .;exit 0",
以解決此問題。 留下這個供參考
問題是我不確定如何讓 eslint 忽略來自流星的導入。 我已經嘗試過使用eslint-plugin-meteor
並打開導入解析器流星,但這似乎不起作用。 --UPDATE--我在下面的問題中消除了 .eslintrc 文件中的錯誤,直到下面描述的問題得到解決 [ https://github.com/clayne11/eslint-import-resolver-meteor/issues/11]留作參考
/Users/kimmo/Documents/carecity/server/main.js 1:1 錯誤 'meteor' 應該列在項目的依賴項中。 運行'npm i -Smeteor'以添加它導入/無外部依賴1:24錯誤無法解析模塊'流星/流星'導入/無未解析的路徑
✖ 2個問題(2個錯誤,0個警告)
npm 錯誤! 達爾文 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/節點"""/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! npm v3.10.6 npm ERR! 代碼 ELIFECYCLE npm ERR! carecity@lint: eslint .
npm 錯誤! 退出狀態 1 npm ERR! npm 錯誤! 在 carecity@ lint 腳本 'eslint .' 中失敗。 npm 錯誤! 確保您安裝了最新版本的 node.js 和 npm。 npm 錯誤! 如果你這樣做了,這很可能是 carecity 包 npm ERR 的問題! 不是 npm 本身。 npm 錯誤! 告訴作者這在你的系統上失敗了:npm ERR! 埃斯林特。 npm 錯誤! 您可以通過以下方式獲取有關如何為此項目打開問題的信息:npm ERR! npm bugs carecity npm ERR! 或者,如果這不可用,您可以通過以下方式獲取他們的信息:npm ERR! npm 所有者 ls carecity npm ERR! 上面可能有額外的日志輸出。
npm 錯誤! 請在任何支持請求中包含以下文件:npm ERR! /Users/kimmo/Documents/carecity/npm-debug.log
我的 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"
}
}
我的 .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" ]
}
}
請參閱我對上述問題的更新。
錯誤一可以通過在 package.json 文件中添加"lint": "eslint .;exit 0"
來修復
錯誤 2 目前正在 Github 問題中解決https://github.com/clayne11/eslint-import-resolver-meteor/issues/11要暫時消除問題,您可以在上面的示例中使用 .eslintrc。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.