Questions tagged [airbnb-js-styleguide]

For questions about complying with one of Airbnb's JavaScript style guides (located on GitHub). For questions about ESLint configurations, use [eslint-config-airbnb] instead.

Airbnb offers several JavaScript style guides, for ES, Ruby, React, and more.

For more information about the Airbnb JavaScript style guide, visit https://github.com/airbnb/javascript

37 questions
0
votes
1 answer

Is the switch example usage in airbnb javascript guide inconsistent?

I'm catching up on javascript that I have not used since some time, doing so by inspiring most of my coding style from the Modern Javascript coding guide by AirBnb In the paragraph regarding switch I think there is an inconsistency. But that's not…
Stephane Rolland
  • 38,876
  • 35
  • 121
  • 169
0
votes
2 answers

how do you style (big) short-circuit assignment in javascripts?

imagine that you have this line: var result = content['aPossbileValue'] || $el.data('root-path') + content.type + '/something/' + content.slug; The line length is too long, so i wonder how can i improve this? Possible options: var result =…
edudepetris
  • 714
  • 14
  • 27
0
votes
1 answer

How do I view linting errors when i run 'gulp'?

I'm trying to install the Airbnb JavaScript style guide into my environment. I'm using gulp to show linting errors as I save my .js files but it does not show it. If I do 'eslint main.js' it shows me the errors. Is there any way I can show it…
0
votes
1 answer

unexpected use of comma using map on a object

I'm using the AirBnb style guide and get an "unexpected use of comma" error here at the end of the first line of code: myApp.fields.map(field => (field.obj.label = field.label.default, field.label.textContent = field.obj.label)); I can…
Tristan Forward
  • 3,304
  • 7
  • 35
  • 41
0
votes
1 answer

Eslint - Unexpected block statement surrounding arrow body

I just started using Airbnb's eslint config - and it seems really good. I am however getting the below error, and I'm unsure of what the fix is - I guess it's due to the function only existing to return a val. I've played around with it - but I…
Ollie
  • 1,104
  • 7
  • 24
  • 45
0
votes
5 answers

Reduce with deconstruction or forEach - Iteration and Airbnb JavaScript Style Guide

I have an object: things = { table: 'red', chair: 'green' } Adhering to Airbnb's JavaScript Style Guide, I want to create a function that duplicates this object, setting all keys of the object to blue. My 2 options seem to be: 1 Use…
1 2
3