Running Airbnb's Eslint Config and running into an issue using the .jsx
extension.
index.jsx
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter } from 'react-router-dom';
import App from './components/App.jsx'; <<<<<<<<< Unexpected use of file extension "jsx"...
require('./index.scss');
ReactDOM.render(
<BrowserRouter>
<App />
</BrowserRouter>,
document.getElementById('root'),
);
So looked this up and found another SO which is in conjunction with Restrict file extensions that may contain JSX
Ok, so updated my .eslintrc
to reflect this in my rules
.eslintrc
{
"extends": "airbnb",
"env":{
"browser": true
},
"plugins": [
"react",
"jsx-a11y",
"import"
],
"rules": {
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"indent": [2, "tab", { "SwitchCase": 1, "VariableDeclarator": 1 }],
"no-tabs": 0,
"react/prop-types": 0,
"react/jsx-indent": [2, "tab"],
"react/jsx-indent-props": [2, "tab"]
}
}
However still getting the same error. Is there something else that I'm missing?
Dependencies
- "eslint": "^4.10.0",
- "eslint-config-airbnb": "^16.1.0",
- "eslint-plugin-import": "^2.8.0",
- "eslint-plugin-jsx-a11y": "^6.0.2",
- "eslint-plugin-react": "^7.4.0",