在将“ react-ga”导入主要组件后,我的项目向我展示了很多ESlint错误
我这样安装react-ga:
npm install react-ga --save
错误看起来像这样:
✘ http://eslint.org/docs/rules/comma-dangle Missing trailing comma
src/components/main/dashboard/index.js:3:12
✘ http://eslint.org/docs/rules/comma-dangle Missing trailing comma
src/components/main/dashboard/index.js:14:13
✘ http://eslint.org/docs/rules/comma-dangle Missing trailing comma
src/components/main/dashboard/index.js:61:22
✘ http://eslint.org/docs/rules/comma-dangle Missing trailing comma
src/components/main/dashboard/index.js:93:33
✘ http://eslint.org/docs/rules/comma-dangle Missing trailing comma
src/components/main/dashboard/index.js:110:29
✘ http://eslint.org/docs/rules/comma-dangle Missing trailing comma
src/components/main/dashboard/index.js:115:34
✘ http://eslint.org/docs/rules/comma-dangle Missing trailing comma
src/components/main/dashboard/index.js:130:28
✘ http://eslint.org/docs/rules/comma-dangle Missing trailing comma
src/components/main/dashboard/index.js:134:29
somecomponent.js中的代码
import TimeAgo from 'javascript-time-ago'
import en from 'javascript-time-ago/locale/en'
import axios from 'axios'
import _ from 'lodash'
import {
ReactGA
} from 'react-ga'
TimeAgo.locale(en)
const timeAgo = new TimeAgo('en-US')
const styles = theme => {
return {
progress: {
margin: theme.spacing.unit * 2,
},
root: {
width: '100%',
},
title: {
marginBottom: '20px',
},
}
}
class Dashboard extends Component {
constructor(props) {
super(props)
}
}
但是如果我推荐import {
ReactGA
} from 'react-ga'
然后一切正常。导入ReactGA有什么问题吗?(我也尝试过
import
ReactGA
from 'react-ga'
),结果相同。我应该更新ESlint或其他措施来解决此问题吗?