Questions tagged [eslintrc]

For issues relating to .eslintrc.* configuration files.

Files of type .eslintrc.* are used to configure eslint.
Supported file formats are JavaScript (*.js), JSON (*.json) and YAML (*.yaml or *.yml).

Note that the config file .eslintrc (without extension) is deprecated in favor of .eslintrc.* files.
See: .eslintrc without file extension is deprecated.

[For] configuration files - use a JavaScript, JSON, or YAML file to specify configuration information for an entire directory and all of its subdirectories.

480 questions
43
votes
4 answers

ESLint broken: Rules with suggestions must set the `meta.hasSuggestions` property to `true`

I am using VSCode, and when I add the line 'react-hooks/exhaustive-deps': 'warn' to my .eslintrc.js, I get the following in the ESLint output: Rules with suggestions must set the `meta.hasSuggestions` property to `true`. Occurred while…
Flobbinhood
  • 630
  • 1
  • 8
  • 15
42
votes
8 answers

Enable eslint only for edited files

Recently, I configured eslint one of my projects. This project was consisting of hundreds of files, as soon as I configured eslint starts showing errors in all files. IMO, eslint traverses through all js files, which is not required currently. Is…
shekhardtu
  • 4,335
  • 7
  • 27
  • 34
40
votes
11 answers

How to disable vue/multi-word-component-names eslint rule for just one .vue file?

I am using the Vue ESLint plugin and it has a rule for not allowing single word component names. However, I am also using Nuxt, and to set a default Layout in Nuxt you need a .vue component named default.vue which throws the ES Lint rule errors. I…
Carson Wood
  • 1,174
  • 3
  • 14
  • 23
36
votes
4 answers

ESLint only target a specific directory (eslintrc, create-react-app)

I have a folder structure similar to this: /root .eslintrc.json package.json /someFolder /sub /sub /anotherFolder /src /containers /components /oneMoreFolder /sub /sub I'm working with create-react-app and am applying airbnb…
Dustwise
  • 557
  • 1
  • 6
  • 10
34
votes
6 answers

Allow debugger; statements in certain files, using ESLint

Say I want to use this rule: https://eslint.org/docs/rules/no-debugger however, I have about 15 files where I want to keep debugger; statements. Is there something I can add at the top of the .ts/.js files, that can tell ESLint to ignore the…
user7898461
30
votes
1 answer

How do I configure eslint rules to ignore react-hooks/exhaustive-deps globally?

I have a react component with a useEffect hook that looks like this: const LocationEditor: React.FC = (props) => { const [section, setSection] = useState({...(props.section as Location)}); useEffect(() => { …
master_chef
  • 345
  • 1
  • 3
  • 9
27
votes
3 answers

eslint resolve error on imports using with path mapping configured jsconfig.json

Here's my project structure: -src --assets --components --constants --helpers --pages --routes eslintrc.json jsconfig.json App.js index.js I was tired of: import SomeComponent from '../../../../../components/SomeComponent'; And I wanted to…
cbdeveloper
  • 27,898
  • 37
  • 155
  • 336
24
votes
6 answers

Failed to load config "next/babel" to extend from eslintrc.json

When I'm trying to build the Next.Js app then the below error is coming with a successful build. This error is showing when I deploy the app in Vercel. error - ESLint: Failed to load config "next/babel" to extend from. Referenced from:…
DCodeMania
  • 1,027
  • 2
  • 7
  • 19
23
votes
3 answers

.eslintrc.js 'module' is not defined

I'm getting 'module' is not defined error from the eslint in .eslintrc.js file. What does this mean and how do I fix it?
lotaquestions
  • 241
  • 2
  • 3
21
votes
3 answers

Eslint is working from terminal, but not showing error in the editor UI (VSCode)

I've installed the ESlint by following these steps: https://travishorn.com/setting-up-eslint-on-vs-code-with-airbnb-javascript-style-guide-6eb78a535ba6 Now, my ESlint is working from the terminal, but errors/warnings are not displaying in the code…
Karen
  • 1,249
  • 4
  • 23
  • 46
21
votes
4 answers

eslint "parsing error: Unexpected token {" in JSX

const title = 'My Minimal React Webpack Babel Setups'; const App = () => (
{title}
) This code occurs an error "ESLint Parsing Error: Unexpected token {" my .eslintrc.js file is like that module.exports = { …
YouHoGeon
  • 405
  • 1
  • 3
  • 15
20
votes
6 answers

VSCode failed to load plugin cannot find module 'eslint-plugin-prettier'

I'm installing eslint and Prettier in my project and trying to get automatic code formatting to work through VSCode. When I go to a React file, I see that ESLint is in error so I open up the ESLint console where I see: Failed to load plugin…
Brady Dowling
  • 4,920
  • 3
  • 32
  • 62
19
votes
8 answers

Parsing error: Cannot find module '@babel/preset-react'

I have a React project. In the first line in every .js file where I import React, I am getting this error: Parsing error: Cannot find module '@babel/preset-react'. package.json { "name": "admin", "version": "2.0.0", "description": "", …
Matt
  • 8,195
  • 31
  • 115
  • 225
19
votes
1 answer

how to support inline comments when using eslint-prettier/prettier?

i want to turn off the rule in prettier where it newlines an inline comment. my ESLint rule no-inline-comments is set to off or warn, so that is taken care of and works. turns out Prettier still wants to newline and inline comment: i have a setup…
1
2
3
31 32