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
9
votes
1 answer

change all eslint errors to warning instead of error using .eslintrc.js

Is there a way to change all eslint errors to warnings using eslintrc.js file? I just hate it at the moment, especially when it stops the entire program because I added an extra space. I was wondering is there a way to turn all errors off and let…
fafa.mnzm
  • 561
  • 7
  • 17
9
votes
1 answer

ESLint with TypeScript parser/plugin: how to include .spec.ts, that is excluded from tsconfig.json?

I'm using the awesome typescript-eslint together with ESLint. Problem description: the TypeScript ESLint parser complains about src/module.spec.ts not being part of the project, and this is correct. I'm excluding all spec.ts files from TypeScript…
gremo
  • 47,186
  • 75
  • 257
  • 421
9
votes
2 answers

Force Prettier to place inner text on new line without trailing >

I am using VScode for Vue development using Prettier and Eslint. Currently, Prettier is formatting my code like this: What I'd like is to force the following If I manually change it to my wanted format it won't mark it as incorrect, but it also…
Tim Titus
  • 379
  • 3
  • 18
9
votes
0 answers

Linting to detect unused exported variables

I'm trying to figure out how to detect when a exported variable (const, function, ...) is not used and therefore could be deleted. I have a React App with ESLint configured. In the following example, MAGIC_NUMBER is exported and used in file2.js…
EverydayLearner
  • 302
  • 1
  • 10
9
votes
3 answers

Firebase cloud functions spread operator fails eslint check and upload fails

Can anyone please figure out how do i solve the linter error. This code is tested and works perfectly. Only thing is i am unable to deploy it on cloud functions infrastructure. I am sure somethings wrong with .eslintrc file. Can anyone please help…
8
votes
1 answer

Different ESLint results when building React app

I'm a beginner in React development. I'm trying to solve all the errors/warnings of my project but I get different results between development environment and production environment. I didn't make any difference between them in the…
Tom Combet
  • 83
  • 1
  • 5
8
votes
4 answers

What is causing Error: .eslintrc.js: Environment key "vue/setup-compiler-macros" is unknown

I am developing a sample app using Vue 3 and Typescript. Specifically, I am using the new Vue v3.2 setup option in the section of the Vue SFC. Vue docs advise me to add "vue/setup-compiler-macros" to the env secyion of the eslintrc.js file which…
maxweld
  • 229
  • 2
  • 15
8
votes
1 answer

Why do developers occasionally add "SharedArrayBuffer" & "Atomics", to the ".eslintrc.json" "globals" property?

        What is the purpose of SharedArrayBuffer, and Atomics, being added to the .eslintrc.json configuration file's "globals" property? Example of what I have seen people do: /** @file "./.eslintrc.json" */ "globals": { …
R. Gurung
  • 1,356
  • 1
  • 14
  • 34
8
votes
4 answers

Detect missing await in JavaScript methods in VSCode

I'm searching for some eslint option, or some other way to detect missing the 'await' keyword before calling async methods inside a class. Consider the following code: const externalService = require('./external.service'); class TestClass…
Or Assayag
  • 5,662
  • 13
  • 57
  • 93
8
votes
7 answers

VSCode prettier/vue formatting settings don't work properly

I have read about 10-15 other answers now and none of the solutions (which are all the same minus 3 or 4) have worked for me. I am using Prettier and Vetur and I have the ESLint extension in VSCode installed as well. I have looked over the settings…
PhilosophOtter
  • 183
  • 1
  • 2
  • 12
8
votes
1 answer

Visual Studio 2019 - Use project specific ESLint config .eslintrc

I have followed this guide to set up .eslintrc configuration. https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/README.md I have also enabled ESLint in Visual Studio by following this…
Ogglas
  • 62,132
  • 37
  • 328
  • 418
8
votes
4 answers

eslint + jsconfig + nextjs module path aliases (absolue path import - @)

I am trying to import the files using custom aliases following the nextjs documentation. My current approach is from import Header from '../../../components/Header'; to import Header from '@components/Header'; I am getting the expected result. But…
gayathrithedev
  • 327
  • 2
  • 10
8
votes
2 answers

React native - eslintrc - prettierrc: how to prevent removing of parentheses around one element in JSX

I just created new react-native app and the eslint change this: return ( ); to return ; I tried to change the .eslintrc and .prettierrc files and nothing worked.
Bokris Itzhak
  • 911
  • 9
  • 30
8
votes
1 answer

eslint - vue/script-indent to ignore object fields

I have the following ESLint rule setup: "vue/script-indent": [ "error", 4, { "baseIndent": 1, "switchCase": 1, "ignores": [ "[init.type=\"ObjectExpression\"]", …
A. L
  • 11,695
  • 23
  • 85
  • 163
8
votes
3 answers

How to add new line after and before method declarations in classes using prettier?

What settings need to be configured to add a new line before and after method declaration in classes in typescript files using prettier plugin in vs code editor? How can we achieve by writing any rule in .prettierrc or tslint.json file? current…
xkeshav
  • 53,360
  • 44
  • 177
  • 245