Skip to content
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

chore(*): Enable comma-dangle #271

Merged
merged 7 commits into from Feb 19, 2019

Conversation

Projects
None yet
4 participants
@bradzacher
Copy link
Member

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 typescript-eslint/core-team Feb 13, 2019

@@ -7,6 +7,7 @@
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"rules": {
"comma-dangle": ["error", "always-multiline"],

This comment has been minimized.

@armano2

armano2 Feb 14, 2019

Member

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

This comment has been minimized.

@bradzacher

bradzacher Feb 14, 2019

Author Member

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 typescript-eslint/core-team Feb 14, 2019

@armano2

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member Author

bradzacher commented Feb 14, 2019

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!

bradzacher added some commits Feb 14, 2019

@codecov

This comment was marked as off-topic.

Copy link

codecov bot commented Feb 14, 2019

Codecov Report

Merging #271 into master will not change coverage.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master     #271   +/-   ##
=======================================
  Coverage   96.76%   96.76%           
=======================================
  Files          67       67           
  Lines        2350     2350           
  Branches      335      335           
=======================================
  Hits         2274     2274           
  Misses         51       51           
  Partials       25       25
Impacted Files Coverage Δ
...s/eslint-plugin/src/rules/interface-name-prefix.ts 87.5% <ø> (ø) ⬆️
packages/typescript-estree/src/parser.ts 93.06% <ø> (ø) ⬆️
packages/eslint-plugin/src/util/types.ts 66.66% <ø> (ø) ⬆️
packages/parser/src/parser.ts 100% <ø> (ø) ⬆️
packages/parser/src/visitor-keys.ts 100% <ø> (ø) ⬆️
packages/eslint-plugin/src/rules/ban-types.ts 100% <ø> (ø) ⬆️
...ages/eslint-plugin/src/rules/no-require-imports.ts 100% <ø> (ø) ⬆️
...kages/eslint-plugin/src/rules/class-name-casing.ts 89.47% <ø> (ø) ⬆️
.../eslint-plugin/src/rules/member-delimiter-style.ts 95.12% <ø> (ø) ⬆️
...es/eslint-plugin/src/rules/no-array-constructor.ts 100% <ø> (ø) ⬆️
... and 55 more

bradzacher added some commits Feb 14, 2019

Merge branch 'master' into lint-comma-dangle
# 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
@JamesHenry
Copy link
Member

JamesHenry left a comment

I have definitely read every single line

@bradzacher bradzacher merged commit 1d9ca84 into master Feb 19, 2019

3 checks passed

Semantic Pull Request ready to be squashed
Details
codecov/patch 100% of diff hit (target 90%)
Details
codecov/project 96.76% (+0%) compared to 7bf4342
Details

@bradzacher bradzacher deleted the lint-comma-dangle branch Feb 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.