Eslint common errors

I’ve been looking for a solution for awhile now with no luck. I’ve tried many different eslintrc setups but nothing seems to work. Can someone please tell me why eslinter underlines this as an error. What am I missing?

import { Meteor } from 'meteor/meteor';
error provided - [eslint] Missing file extension for "meteor/meteor"

My .eslintrc.js file setup is:

module.exports = {
  "parser": "babel-eslint",
  "parserOptions": {
    "allowImportExportEverywhere": true
  },
  "plugins": [
      "meteor",
      "react",
      "jsx-a11y",
      "import"
  ],
  "extends": [
    'airbnb',
    'plugin:meteor/recommended'
  ],
  "settings": {
      'import/resolver': 'meteor'
  },
  "rules": {
      "react/jsx-filename-extension": 0,
      "no-use-before-define": 0,
      "no-underscore-dangle": 0,
      "import/no-named-as-default": 0,
      "import/no-named-as-default-member": 0,
      "prefer-destructuring": ["error", {"object": false, "array": false}],
      "react/jsx-filename-extension": [
        1,
        {
          "extensions": [
            ".js",
            ".jsx"
          ]
        }
      ],
      "no-underscore-dangle": [
        "error",
        {
          "allow": [
            "_id"
          ]
        }
      ],
      "import/no-extraneous-dependencies": 0
  }
};

Have you installed eslint-import-resolver-meteor and eslint-plugin-meteor as devDependencies?

2 Likes

Yep. They’re both installed. Still doesn’t work.

Which editor / linter?
Where is your .eslintrc.js file located?
Are there any other eslint config files between the correct one and the file that gives you errors?

ESLint 1.4.8 in VS code.

.eslintrc.js is located in the root directory of the app.

ESlint is working. The other rules are being applied correctly, the only issue is;
import { Meteor } from 'meteor/meteor';
error provided - [eslint] Missing file extension for "meteor/meteor"

Obviously, this isn’t critical it’s just really irritating.

I just found this solution which works, however, I’m not sure if it’s recommended.

"rules": { "import/extensions": ["off", "never"] }

That shuts the import/extensions rule off, which to be honest I do on every project anyways, so this sounds like a good solution to me! :slight_smile:

2 Likes