ESLint无法解析模块&react-router-dom'的路径。 (进口/无未解决)

时间:2017-07-12 22:46:08

标签: javascript eslint

我今天收到此错误。奇怪的是,它以前从未发生过,同样的错误也存在于相对路径中。 给出错误的Header.js文件

import React from 'react';
import PropTypes from 'prop-types';
import { Meteor } from 'meteor/meteor';
import { Link } from 'react-router-dom';
import Logout from './User/Logout';

const Header = ({ title }) => (
  <div className="title-bar">
    <div className="wrapper">
      <h1>{title}</h1>
    </div>
    {Meteor.userId() ? <Logout /> :
    <div className="dropdown">
      <Link to="/login" className="button header__navigation">Login</Link>
      <Link to="/signup" className="button header__navigation">Signup</Link>
      <Link to="/about" className="button header__navigation">About</Link>
      <Link to="/How" className="button header__navigation">How it Works</Link>
      <Link to="/tos" className="button header__navigation">Terms of Service</Link>
    </div>
  }
  </div>
);

Header.propTypes = {
  title: PropTypes.string.isRequired
};

export default Header;

这是我的.eslintrc.js文件。

module.exports = {
  extends: 'airbnb',
  plugins: [
    'react',
    'jsx-a11y',
    'import',
    'meteor'
  ],
  rules: {
    'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
    'react/require-extension': 'off',
    'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
    'react/forbid-prop-types': 0,
    'comma-dangle': ['error', { functions: 'ignore' }],
    'import/prefer-default-export': 'off'
  },
  settings: {
    'import/core-modules': ['meteor/meteor', 'meteor/tracker', 'meteor/mongo', 'meteor/react-meteor-data', 'meteor/accounts-base']
  },
  env: {
    mocha: true,
    browser: true
  }
};

0 个答案:

没有答案