I am trying to integrate ESLint on our react-native project by defining the very basic rules. I started with defining semi
rule. Everything seems ok so far except for the .js files which has a class declaration. semi
rule doesn't throw warning or error if I don't use semi-colon for import statements.
.eslintrc.json
{
"plugins":["react", "react-native"],
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"rules":{
"jsx-quotes": [
"error",
"prefer-double"
],
"semi": [
"error",
"always"]
}
}
Example .js file.
import React, { Component } from 'react';
import { Easing, View, StyleSheet, Animated } from 'react-native'
import { connect } from 'react-redux'
import { NavigationActions } from 'react-navigation'
import { updateLicense } from '../actions'
class SomeContainer extends Component {
somefunction() {}
}
On the other hand, if there is no class declaration (just import
and export
statements) it complains about lacking semi-colons.
Any ideas? Thanks a lot for your help!
.js
file – quartaela