Questions tagged [eslint]

The pluggable linting utility for JavaScript and related frameworks.

ESLint is a JavaScript linting tool.

It differs from other linters in that every rule is a separate plugin and you can add more during runtime.

User interface

ESLint is a CLI tool and runs directly from a terminal/command prompt. It may be used as a standalone tool or integrated with an automated task runner such as Grunt (through plugins such as eslint-grunt and grunt-eslint). It can also be integrated with majority of modern editors that support JavaScript. For the list of integrations see ESLint site

Resources


See also

6637 questions
4
votes
0 answers

How to configure ESlint for JS application that imports TypeScript modules

The goal I have an application that I'd like to migrate to TypeScript progressively. I'd like to be able to: import *.ts files in Vue single file components import *.ts files in regular *.js files. import *.js files in *.ts files My setup The app…
wube
  • 923
  • 2
  • 10
  • 22
4
votes
1 answer

How to set up Airbnb ESLint in VS Code?

I've tried for hours to set up ESLint using the Airbnb linter in Visual Studio Code. I ran the commands found here: https://www.npmjs.com/package/eslint-config-airbnb and set the peer dependencies to the correct versions, but still no luck. I always…
4
votes
2 answers

AirBnB Linter multiple currying in same line making it too long

I seem to have run into an AirBnB linting paradox. I have the following line: const pagePromiseGenerator = (graphql, createPage) => (gqlNodeName, pageComponent) => new Promise((resolve, reject) => { which is over 100 characters long. So I can…
Luke Schlangen
  • 3,722
  • 4
  • 34
  • 69
4
votes
2 answers

Why is ESlint happy for me to modify object properties as long as the object is reassigned? no-param-reassign

In ESLint, the no-param-reassign rule as documented here, forbids you from assigning the value of a function param. This is to avoid having a function's arguments object be modified. The correct way to code is to reassign the param to a local var…
Christie
  • 57
  • 5
4
votes
0 answers

Formatting Markdown and CSS files using Prettier through ESLint?

Currently, I've got Prettier set up through ESLint using the following .eslintrc.json: { "extends": ["react-app", "plugin:prettier/recommended"] } This works fine for linting and formatting JavaScript files. However, when I'm trying to run…
Willem-Aart
  • 2,200
  • 2
  • 19
  • 27
4
votes
1 answer

Tslint/eslint vs prettier

Tslint (probably as well as eslint) has a --fix param, that fixes style errors. Is there any reason I should also consider using prettier, other than "prettier has more style rules"?
Nurbol Alpysbayev
  • 19,522
  • 3
  • 54
  • 89
4
votes
0 answers

Do Sonar have disable nosonar for next line?

from the question above I need to know that can we close sonar for next line same in eslint? example from eslint // eslint-disable-next-line while(true) { now I have to disable both of eslint and sonar like this // eslint-disable-next-line while…
ppppp
  • 199
  • 1
  • 2
  • 15
4
votes
0 answers

Does anyone know why I getting this eslint error message when installing airbnb

I'm been trying to get airbnb installed in my eslint config for the last day or so. Currently, I'm using vscode with the eslint plugin installed, also I have eslint install locally on my machine using npm. I previous had it installed globally and…
sme3750
  • 41
  • 2
4
votes
2 answers

How to configure package.json to run eslint on js and jsx files

This post works for linting all .js files in a project. How do I lint all .jsx files in addition to all .js files? I've gotten this to work: "lint": "./node_modules/.bin/eslint \"./**/*.js\" \"./**/*.jsx\"" However, I think that there is a…
SeanPlusPlus
  • 8,663
  • 18
  • 59
  • 84
4
votes
1 answer

How to get VueJS + ESLint (Airbnb) + Prettier working together? (VSCode)

I've been pulling my hair out at trying to get this to work for the past few days and have had no luck, so I hope someone here can perhaps provide some help! Essentially, I'm using VueJS and I really like the ESLint rules that Airbnb use, but I also…
user5113508
4
votes
3 answers

why is "typeof v === 'string'" considered invalid by eslint

I'm using eslint on my angularjs project and I prefer using vanillajs the more I can. With that being said, I don't get the reason of why eslint consideres the following expression as invalid and refuses it. Is using typeof considered a bad…
A. Gille
  • 912
  • 6
  • 23
4
votes
2 answers

ESLint found too many warnings (maximum: 0) and i cant deploy on firebase function

i am not sure what is preventing me to deploy on firebase Its prevent me from deploying to firebase function. firebase deploy --only functions Can anyone help me to see what is the problem 174:75 warning Unexpected function expression …
phongyewtong
  • 5,085
  • 13
  • 56
  • 81
4
votes
0 answers

ESlint - Parsing error: Unexpected token for class private function

I got Parsing error: Unexpected token for below class's _processMessage (private function). i am using babel and eslint ("babel-eslint", "babel-cli", "babel-core", "babel-preset-env", "babel-plugin-add-module-exports", "eslint", …
Gopi
  • 163
  • 1
  • 13
4
votes
1 answer

eslint with prettier: line break after "="

I have an issue with the eslint + prettier. For some reason I have some "line breaks" like this: var err = "jqxhr: " + jqxhr + ". Status: " + textStatus + ", " + error; Will be beautified by tool as: var err = "jqxhr: " + jqxhr + ". Status: "…
name
  • 73
  • 1
  • 6
4
votes
1 answer

Forbid folder1 to import anything from folder2

Is there a simple way to prevent folder1 to import anything from folder2 in modern JS? My context is a ReactNative/Expo detached app which somehow contain 2 distinct apps in one (think Uber customer and Uber driver, in a single native app). I want…
Sebastien Lorber
  • 89,644
  • 67
  • 288
  • 419
1 2 3
99
100