无法分辨jsx-a11y linter的实际错误

时间:2017-06-28 19:31:20

标签: reactjs eslint

我的.eslintrc文件如下所示:

  "extends": [
    "prettier",
    "prettier/flowtype",
    "prettier/react",
    "plugin:jsx-a11y/recommended"
  ],
  "plugins": [
    "prettier"
  ],

当我启动我的应用程序时,我收到这样的错误:

./src/index.js
  Line 1:  Definition for rule 'jsx-a11y/media-has-caption' was not found                              jsx-a11y/media-has-caption
  Line 1:  Definition for rule 'jsx-a11y/accessible-emoji' was not found                               jsx-a11y/accessible-emoji
  Line 1:  Definition for rule 'jsx-a11y/anchor-has-content' was not found                             jsx-a11y/anchor-has-content
  Line 1:  Definition for rule 'jsx-a11y/aria-activedescendant-has-tabindex' 
was not found             jsx-a11y/aria-activedescendant-has-tabindex
etc. etc.

他们都指向src/index.js的第1行,如下所示:

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import registerServiceWorker from './registerServiceWorker';

ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();

第1行是import React from 'react'

我完全不知道这些掉毛错误来自哪里。

1 个答案:

答案 0 :(得分:0)

eslint-loader正在尝试lint的第一个文件(在您的情况下是条目文件src/index.js

由于您的node_modules

未安装插件模块,因此发生了这种情况。