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
1
vote
2 answers

Is it possible to use props as a default value in a function (when using react/destructuring-assignment rule)

I have a function that getting val as a parameter and I want to set this.props.val as default value. My current function: foo(val = this.props.val) { console.log(val); } I'm getting the follow lint error: Must use destructuring props…
yohaiz
  • 874
  • 6
  • 11
1
vote
1 answer

Expected to return a value at the end of arrow function recursion (consistent-return)

What if I have a recursive function like below? Can I just return false after the recursive foo call? function foo(fn, redo, interval = 1000) { return new Promise( (resolve, reject) => { fn() .then(resolve) .catch((error)…
stackjlei
  • 9,485
  • 18
  • 65
  • 113
1
vote
1 answer

Vuex ORM models dependency cycle

In the store, I have two related models: Company and User User import { Model } from '@vuex-orm/core'; import { Company } from './models'; export class User extends Model { static entity = 'users'; static fields() { return { company:…
Marek
  • 307
  • 3
  • 13
1
vote
1 answer

Missing dependency linting error on React hook

I'm using useEffect in a React function component like so: useEffect(() => { const handleRouteChangeComplete = () => { window.scrollTo(0, 0); userInterface.dispatch(closeNavigation()); }; Router.events.on('routeChangeComplete',…
CaribouCode
  • 13,998
  • 28
  • 102
  • 174
1
vote
0 answers

Cannot scan file for errors using eslint in angular 6 with project using eslint-plugin-angularjs-security-rules

I'm very new to eslint and one of my client asked to preform security check using Eslint and asked to use AngularJS Security Rules For ESLint (https://www.npmjs.com/package/eslint-plugin-angularjs-security-rules). I'm not clear what is the correct…
pTi
  • 357
  • 3
  • 13
1
vote
2 answers

Expected to return a value at the end of arrow function consistent-return

exports.create = (req, res) => { if (!req.body.task) { return res.status(400).send({ message: "Task Can't be empty", }); } const task = new Task({ task: req.body.task, }); task.save() .then((data) => { …
Sarvesh Jhanwar
  • 97
  • 1
  • 2
  • 10
1
vote
1 answer

Prettier AutoFormatting error for typescript and javascript mixed project

I am adding typescript to an existing javascript project. It is a large scale project, so I decided converting the project to typescript step by step. This is my eslintrc.js file module.exports = { parser: '@typescript-eslint/parser', // Specifies…
Dulara Malindu
  • 1,477
  • 4
  • 18
  • 37
1
vote
0 answers

ESLint: Cannot override AirBnb Extent?

I'm using this .eslintrc setup generated by the eslint --init command. It offers me to chose the airbnb styleguide which is a good start to me module.exports = { env: { browser: true, es6: true, }, rules: { …
1
vote
0 answers

Variable order in React Component using Airbnb Guidelines

I'm running into this problem that I'm not sure how to fix. I'm coding React with Typescript and we have implemented Airbnb config for Typescript in our project. This is an example of my code: class Grid extends React.PureComponent
Tree Nguyen
  • 1,198
  • 1
  • 14
  • 37
1
vote
0 answers

VueJs - Vetur keeps creating weird linebreak and then eslint complains about it

I am currently using eslint in a vue project of mine and while I really like linters at the moment it's driving me crazy. I have the following line this.someIndex = this.someObject.someKey.length % this.someIndex; Which the linter first keeps…
relief.melone
  • 3,042
  • 1
  • 28
  • 57
1
vote
1 answer

Error when running Express server using nodemon alongside react dev server

I have both the server and client side code in one folder, the react app is in a /client folder in the root of my project, I am not able to run the two servers concurrently. I used npx create-react-app to set up my react application, NOTE:…
MoSwilam
  • 824
  • 2
  • 10
  • 26
1
vote
1 answer

How to resolve the ESLint error "Prefer default export ..."?

I have the following module, in which there is a named function... eslint ( airbnb ) is raising an error: 8:1 error Prefer default export import/prefer-default-export How should I restructure my code to comply to this requirement? exports /…
user762579
1
vote
1 answer

ESlint : Component should be written as a pure function error when I'm creating a class component using redux

I am writing a react class component in my react-native project. I am using ESLint in my project extending the airbnb syling rules. This component has a form which stores it's form values in Redux. It initialises the form values from Redux and…
1
vote
1 answer

ESLint checks files inside a folder but doesn't check the folders inside the folder. How can I fix it?

I have installed eslint to clean up my code. I cd to the project folder and launch eslint with npm run pretest, which is "pretest": "eslint --ignore-path .gitignore ." it checks only webpack.config.js, that's in the project folder root, but omits…
Dominik Domanski
  • 1,023
  • 2
  • 10
  • 18
1
vote
1 answer

Configure public files path in eslint

I got the following files hierarchy ->public ->css ->javascript ->src ->views app.js I configured the path of public files in app.js like that app.use(express.static(path.join(__dirname, 'public'))); app.set('views',…
Jarlio
  • 117
  • 1
  • 2
  • 11