Questions tagged [eslint-config-airbnb]

Use this tag for the NPM package that provides Airbnb's .eslintrc as an extensible shared config

Relevant links

https://www.npmjs.com/package/eslint-config-airbnb

https://github.com/airbnb/javascript

https://eslint.org/docs/rules/

288 questions
0
votes
1 answer

ESLint: spacing inside parenthesis with react

Does anyone know which ESLint configuration rule is causing my jsx inside parenthesis to be 4 more spaces on the left then I expect? import React from 'react'; import './styles.scss'; const TableWrapper = ({ children, }) => (
AndrewHipp
  • 379
  • 2
  • 6
0
votes
1 answer

ESLint Espected an assignment or function call and instead saw an expression on void function

Issue Description: I've begun working on a project with typescript and eslint. Issue is, eslint gives me an unexpected error on what seems to be a properly declared function Code: import React, { useState } from 'react'; type Props = { options:…
0
votes
1 answer

Prevent using this.state within a this.setState (react/no-access-state-in-setstate)

For this piece of code, !this.state.dark I am getting an ESlint (airbnb config) error: Use callback in setState when referencing the previous state. I tried refactoring the code using following the ESlint documentation. But I'm having a hard time…
user12394010
0
votes
2 answers

eslint errors on .js files

My codebase is full of .js files and I am running eslint on a particular file. I get below errors: 1:8 error 'React' is defined but never used no-unused-vars 1:27 error Trailing spaces not allowed …
Prabhat Mishra
  • 951
  • 2
  • 12
  • 33
0
votes
1 answer

ESLint complaining over props validation even with propTypes defined

Take a look at this: /* eslint no-console: 0 */ import { ApolloProvider } from '@apollo/react-hooks'; import { InMemoryCache } from 'apollo-cache-inmemory'; import { ApolloClient } from 'apollo-client'; import { HttpLink } from…
TheLearner
  • 2,813
  • 5
  • 46
  • 94
0
votes
1 answer

Eslint/prettier javascript files

I currently have an issue where eslint and prettier don't do anything on my .js files in VS code. Here is the content of my .prettierrc: { "singleQuote": true, "printWidth": 80, "editor.formatOnSave": true, "proseWrap": "always", …
0
votes
2 answers

Error: Must use destructuring state assignment

Do you have any idea this error? I am getting ESlint error for the following line visible={this.state.visible} It says: "Must use destructuring state assignment" It uses: "eslint-config-airbnb" Thank you in advance import React from 'react' import {…
Volkan Haslak
  • 65
  • 1
  • 7
0
votes
2 answers

vue-cli linting throwing camelcase warning when the rule is disabled

I'm building an app with vue-cli, using airbnb rules to lint. Despite me adding a rule to my .eslintrc.js config file, and the rule appying on other files, this particular variable in my Welcome.vue file keeps throwing a warning when linting. The…
Pete
  • 4,542
  • 9
  • 43
  • 76
0
votes
2 answers

Why does my linting configuration for a React app want double quotes instead of single?

I am having trouble diagnosing an oddity in my linting configuration. It wants me to use double quotes, which I wouldn't necessarily mind, but I can't understand why because as far as I can tell all my rules want singles. This is for a React app. My…
cdpautsch
  • 1,769
  • 3
  • 13
  • 24
0
votes
1 answer

ESLINT infinite loop

So i used eslint pretty normally until I added a specific rule, then eslint seemed to just loop infinite : > api@1.0.0 pretest /api > eslint . this just stay forever. Never ending the process. So i removed that specific rule again, but it didnt…
Bidoubiwa
  • 910
  • 2
  • 12
  • 25
0
votes
1 answer

How can I use `eslint-config-airbnb` in a non-react project?

I am using eslint in my project and I'd like to use airbnb style. The problem I have is I need to install eslint-config-airbnb dependency which depends on eslint-plugin-jsx-a11y and some react plugin. My project is not a react project and I wonder…
Joey Yi Zhao
  • 37,514
  • 71
  • 268
  • 523
0
votes
1 answer

eslint problems is returning when saving file vs code

I can't find the solution to this.. i'm learning eslint and installed the required dependencies for airbnb config. It is working fine, but once i fixed the problems that eslint gives it simply returns the same errors when i save the file. Mostly it…
0
votes
2 answers

Airbnb JS StyleGuide & history.push don't combine

I'm writing a React app, namely a navbar. I have a logo and navItems there. Logo display and color of the navbar background are conditional. Added Aibnb guide to esLint, now my navbar code looks like this: class Toolbar extends Component { …
Dominik Domanski
  • 1,023
  • 2
  • 10
  • 18
0
votes
0 answers

eslint no-extraneous-dependencies issue

I have a problem with eslint rule import/no-extraneous-dependencies What need to do. If js file has import with package which not present in closest parent package.json - show error. Rule description :…
volos
  • 399
  • 5
  • 19
0
votes
0 answers

Airbnb throws errors instead of warnings

I have an issue with a airbnb linter config. Instead of giving warnings, eslint throws errors which causes the compilation to fail with a failed to compile error. My guess is that the problem is connected with webpack and its loaders. It needs…
Murakami
  • 3,474
  • 7
  • 35
  • 89