1
votes

Eslint works with setup below but causes few errors I do not understand.

  1. As you can see when I run meteor npm run lint npm throws error below. It completes the lint and then says it failed to complete? --UPDATE-- I fixed this issue by adding exit 0 attribute to gracefully exit the eslit process. If you run into the same issue look at my package.json line "lint": "eslint .;exit 0", to fix this. Leaving this for reference

  2. Problem is that I am not sure how to make eslint ignore imports from the meteor. I have tried with eslint-plugin-meteor and turning on import resolver meteor, but that does not seem to work. --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

    /Users/kimmo/Documents/carecity/server/main.js 1:1 error 'meteor' should be listed in the project's dependencies. 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

    ✖ 2 problems (2 errors, 0 warnings)

    npm ERR! Darwin 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! node v4.5.0 npm ERR! npm v3.10.6 npm ERR! code ELIFECYCLE npm ERR! carecity@ lint: eslint . npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the carecity@ lint script 'eslint .'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the carecity package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! eslint . npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs carecity npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls carecity npm ERR! There is likely additional logging output above.

    npm ERR! Please include the following file with any support request: npm ERR! /Users/kimmo/Documents/carecity/npm-debug.log

My package.json file below >

{
  "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 >

// 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" ]
  }
}
1
Just to update I fixed one of the problems myself see aboveKimmo Hintikka

1 Answers

1
votes

See my updated on the above question.

Error one can be fixed simply by adding "lint": "eslint .;exit 0" on the package.json file

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.