question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ESLint not working for index.js file

See original GitHub issue

Tell 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:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Tony1120commented, Jan 26, 2019

Thank you all!!

0reactions
kaicataldocommented, Jan 25, 2019

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ESLint not working in VS Code? - Stack Overflow
To verify, press Ctrl + Shift + U in VSCode to open the Output panel after opening a JavaScript file with a known...
Read more >
Configuration Files - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
React JavaScript Tutorial in Visual Studio Code
Once you save the index.js file, the running instance of the server will update the web page and you'll see "Hello World!" when...
Read more >
Basic Features: ESLint - Next.js
Next.js provides an ESLint plugin, eslint-plugin-next , already bundled within the base configuration that makes it possible to catch common issues and ...
Read more >
How To Enable Linting on Save with Visual Studio Code and ...
To address the other issues, we will have to add rules. Step 3 – Adding Rules. eslint --init created a file called eslintrc.js...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found