Skip to content

chore(*): Enable comma-dangle #271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 19, 2019
Merged

chore(*): Enable comma-dangle #271

merged 7 commits into from
Feb 19, 2019

Conversation

bradzacher
Copy link
Member

@bradzacher bradzacher commented Feb 13, 2019

As per the discussion on slack.
Enable comma-dangle eslint rule + prettier config.
Good for two reasons:

  1. (the main reason) It will create less noise in PRs:
 {
-  "foo": true
+  "foo": true,
+  "bar": false
 }
  1. It makes reordering members easier because there is always a comma at the end.

Steps to create this PR:

  1. add line in eslint config
  2. add prettier config
  3. run yarn format
  4. ???
  5. profit.

No other code was manually touched in the making of this PR.

@bradzacher bradzacher requested a review from a team February 13, 2019 18:10
@@ -7,6 +7,7 @@
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"rules": {
"comma-dangle": ["error", "always-multiline"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need eslint rule for this? we are using prettier

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the lint rule gives you in-editor warnings when you're writing code (helps in case you don't have format on save turned on).
will also give a better warning in the CI logs. (the prettier check will just say the file failed formatting, whereas the eslint check will tell you the actual problem)

@armano2 armano2 requested a review from a team February 14, 2019 22:28
@armano2
Copy link
Collaborator

armano2 commented Feb 14, 2019

i'm unsure if i like this

Pros:

  • PR's / diffs does not include , from previous lines (it looks better)
  • ??

Cons:

  • Extra character that you have to remember to put
  • ??

i don't have strong opinion on code style

@mohsen1
Copy link
Contributor

mohsen1 commented Feb 14, 2019

Extra character that you have to remember to put

I write objects in one line and let Prettier format things for me!

@bradzacher
Copy link
Member Author

Pros:

  • less noisy diffs
  • easier to refactor and move things (because there's always a trailing ,

Extra character that you have to remember to put

It's covered by eslint fixers and by prettier.
So whilst you have to remember, it's easy to fix, and easy to remember, esp with the lint warnings.
Failing that yarn format will add it in for you!

let Prettier format things for me!

@codecov

This comment has been minimized.

# Conflicts:
#	packages/eslint-plugin/src/rules/prefer-namespace-keyword.ts
#	packages/eslint-plugin/tests/rules/promise-function-async.test.ts
#	packages/typescript-estree/src/convert.ts
#	packages/typescript-estree/src/node-utils.ts
#	tests/integration/utils/generate-package-json.js
Copy link
Member

@JamesHenry JamesHenry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have definitely read every single line

@bradzacher bradzacher merged commit 1d9ca84 into master Feb 19, 2019
@bradzacher bradzacher deleted the lint-comma-dangle branch February 19, 2019 19:05
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants