我刚刚开始使用一个新的 Ruby on rails 应用程序,并使用 webpacker
gem 进行反应。我也使用material-ui
和eslint-config-airbnb
。运行 linter 后,我收到此错误:
Missing file extension "css" for "typeface-roboto" import/extensions
.
eslintrc.json
module.exports = {
"extends": "airbnb",
"env": {
"browser": true,
},
};
索引.jsx
import 'typeface-roboto'; // this is the import causing the issue
import React from 'react';
import ReactDOM from 'react-dom';
import Application from './app';
ReactDOM.render(<Application />, document.getElementById('root'));
也不知道为什么会发生这种情况,但您可以尝试禁用 eslint 的行:
import 'typeface-roboto'; // eslint-disable-line