ESLint not working for index.js file
See original GitHub issueTell us about your environment
- ESLint Version: 5.12.1
- Node Version: 10.11.0
- npm Version: 6.4.1
I’m using create-react-app to bootstrap my app.
What parser (default, Babel-ESLint, etc.) are you using? default Please show your full configuration:
{
"name": "react-complete-guide",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-scripts": "1.0.13"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {
"eslint": "^5.12.1",
"eslint-config-prettier": "^3.6.0",
"eslint-plugin-prettier": "^3.0.1",
"prettier": "^1.16.1",
"react-redux": "^5.1.1",
"redux": "^3.7.2"
}
}
eslintrc
{
"extends": ["react-app", "prettier", "prettier/babel", "prettier/react"],
"plugins": ["prettier"],
"rules": {
"quotes": [
2,
"single",
{
"avoidEscape": true
}
],
"prettier/prettier": [
"error",
{
"trailingcomma": "es5",
"singleQuote": true
}
]
}
}
Configuration
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
import { createStore, combineReducers } from 'redux';
import { Provider } from 'react-redux';
import rootReducer from
ReactDOM.render(
<Provider>
<App />
</Provider>,
document.getElementById('root'));
registerServiceWorker();
What did you expect to happen? I set Prettier up to cater the html’s and css’s style and use ESLint for JavaScript style. However, the ESLint works for every file else except my index.js file. For example, in the rules, I said
"rules": {
"quotes": [
2,
"single",
ESLint automatically correct all the quotation marks in other files except index.js. In the sidebar, ESLint also doesn’t show any warnings for index.js.
Are you willing to submit a pull request to fix this bug?
I wish I could, but I’m a beginner in web development area and don’t know where to start.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Thank you all!!
Closing this issue as it looks like the question has been answered. Please feel free to visit us in the ESLint Gitter if you have any other issues!