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 Configuration Issue

See original GitHub issue

Per ESLint documentation (https://eslint.org/docs/user-guide/configuring), it is possible to either use a .eslintrc.json to define the configuration structure or create an eslintConfig property in your package.json file and define your configuration there.

If there are multiple configuration files in the same directory, ESLint will only use one. In the priority order, a .eslintrc.json is higher than a package.json and if those files are found in the same directory, a .eslintrc.json will take a priority and package.json file will not be used.

React-with-Redux project template contains a .eslintrc.json and package.json file in the same directory. This means that the following ESLint configuration setting in a package.json will not be used:

"eslintConfig": {
    "extends": "react-app"
  }

The above prioritizing behavior is probably worth to be mentioned in the article to prevent the user of React-with-Redux project template from concluding that configuration settings from both of the mentioned files complement each other.

I would also suggest moving the “extends”: “react-app” setting to .eslintrc.json file and add other settings for ESLint plugins included in package.json file (“eslint-plugin-react” and “eslint-plugin-jsx-a11y”), which would make .eslintrc.json file to look as follows:

{
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaVersion": 6,
    "sourceType": "module"
  },
  "plugins": [
    "react",
    "jsx-a11y"
  ],
  "extends": [
    "react-app",
    "plugin:react/recommended",
    "plugin:jsx-a11y/recommended"
  ]
}

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
volodymyr-karpenkocommented, Apr 15, 2020

@mkArtakMSFT I attach App.tsx and Layout.tsx files for reference. App_and_Layout.zip

1reaction
volodymyr-karpenkocommented, Apr 15, 2020

@mkArtakMSFT thanks for informing me.

In case you decide to add “plugin:react/recommended” setting to .eslintrc.json file, as I suggested, you will also have to change the content of App.tsx and Layout.tsx files in React-with-Redux project template. Otherwise, ESLint will signal the react/display-name rule violation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

eslint-config-problems
eslint-config-problems is an ESLint config that doesn't regulate your code style. It only catches actual problems with your code.
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 >
VSCode doesn't run ESLint Server with eslint.config.js flat ...
I have the following setup: The app is a Vite + Svelte + TS starter The issue happens in a monorepo (pnpm workspace)...
Read more >
Error: ESLint configuration in --config is invalid
I am facing the error while using the command npm run start: Error: ESLint configuration in --config is invalid:- Unexpected top-level property ......
Read more >
ESLint not working in VSCode? Help build a ...
Open the command palette by pressing Ctrl / Cmd + Shift + P and select 'ESLint: Show Output Channel'. If ESLint throws any...
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