question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable `object-curly-spacing` and `comma-dangle` on the ESLint codebase

See original GitHub issue

I think it would be nice to enable object-curly-spacing and comma-dangle on the ESLint codebase. A lot of our code is inconsistent about this (sometimes it’s even inconsistent in the same object, e.g. { message: "foo"}).

I ran the rules on the existing codebase to determine which options we should use:

$ eslint --rule 'comma-dangle:[error, never]' 'lib/**/*.js' 'tests/**/*.js' 'bin/**/*.js' --rulesdir lib/internal-rules/ | grep 'problems'
✖ 227 problems (227 errors, 0 warnings)
$ eslint --rule 'comma-dangle:[error, always-multiline]' 'lib/**/*.js' 'tests/**/*.js' 'bin/**/*.js' --rulesdir lib/internal-rules/ | grep 'problems'
✖ 13251 problems (13251 errors, 0 warnings)

It looks like we almost always omit the trailing comma, so I think we should enable comma-dangle: never.

$ eslint --rule 'object-curly-spacing: [error, always]' 'lib/**/*.js' 'tests/**/*.js' 'bin/**/*.js' --rulesdir lib/internal-rules/ | grep 'problems'
✖ 9272 problems (9272 errors, 0 warnings)
eslint --rule 'object-curly-spacing: [error, never]' 'lib/**/*.js' 'tests/**/*.js' 'bin/**/*.js' --rulesdir lib/internal-rules/ | grep 'problems'
✖ 16060 problems (16060 errors, 0 warnings)

It looks like we usually include curly spacing, so I think we should enable object-curly-spacing: always.

I’ll probably create a PR to add these in the next few days if no one has any objections. I just wanted to create this issue first to give some advance notice in case anyone is against enabling these rules, since it seems like we generally end up merging PRs like that fairly quickly to avoid merge conflicts.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
kaicataldocommented, Jan 10, 2017

Sounds like the only thing left to hash out here is how we want to configure comma-dangle. Seems like most of us would be fine with "never" or "always-multiline". Since we have one vote strictly in favor of "never", I propose we go with "never" (which is what our codebase currently follows anyway).

0reactions
vitorbalcommented, Jan 10, 2017

Makes sense 👍 On Tue, Jan 10, 2017 at 4:27 AM Kai Cataldo notifications@github.com wrote:

Sounds like the only thing left to hash out here is how we want to configure comma-dangle. Seems like most of us would be fine “never” or “always-multiline”. Since we have one vote strictly in favor for “never”, I propose we go with “never” (which is what our codebase currently follows anyway).

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/eslint/eslint/issues/7725#issuecomment-271477099, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmNdtUTEzxigTSmdEBK1AAmjgpHwWGcks5rQvqrgaJpZM4LIXf7 .

Read more comments on GitHub >

github_iconTop Results From Across the Web

comma-dangle - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
How to replace Prettier by ESLint rules ? | by Florian Briand
In this article, I'll list and explain how to quickly replace Prettier rules by equivalent ESLint rules, to then allow you to really...
Read more >
How to resolve "Definition for rule '@typescript-eslint/rule ...
I'm trying to add TypeScript compilation to an existing Javascript project. AFAIK this is supposed to be possible (even easy), and you can ......
Read more >
eslint-config-canonical - npm
Rule CN AB GG SD XO @babel/new‑cap ❌ 👻 👻 👻 👻 @babel/no‑invalid‑this 🚨 👻 👻 👻 👻 @babel/no‑unused‑expressions 🚨 👻 👻 👻 👻
Read more >
eslint | Yarn - Package Manager
ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found