After looking at the documentation for the import/no-named-as-default eslint rule, I'm still confused about what exactly I'm doing wrong.
I have the following file structure
.
├── ButtonBack.css
├── ButtonBack.jsx
├── __tests__
│ └── ButtonBack.test.jsx
└── index.js
The ButtonBack.jsx contains the following code
import React from 'react';
import PropTypes from 'prop-types';
export default class ButtonBack extends React.Component {
... code removed to keep example short ...
}
__tests__/ButtonBack.test.jsx contains the following code
import React from 'react';
import { shallow } from 'enzyme';
import ButtonBack from '../ButtonBack'; // <== this line has an eslint warning
... code removed to keep example short ...
The problem is, my linter says that import ButtonBack from '../ButtonBack
violates the following lint rules:
I can't figure out why my import statement violates the lint rule. Removing the name of the class in ButtonBack.jsx (export default class extends React.Component
) does not solve the issue either.
question from:
https://stackoverflow.com/questions/44437203/how-do-i-resolve-eslint-import-no-named-as-default 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…