Skip to content

Conversation

@paulcam206
Copy link
Member

@paulcam206 paulcam206 commented Dec 7, 2021

Related Issue

Fixes #6657
Fixes #6757

Description

The commits on this PR are structured such that each is self-contained:

  • e6d7495
    • Updated configuration for eslint
    • Install/configure prettier
    • npm scripts updated for lint
  • d683d1c
    • Install/configure lint-staged, a tool that can run sets of tools against changes staged in git
  • 1a54be7
    • Install/configure husky, a client-side git hook manager
    • Wire husky up to our root prepare lifecycle script
  • 5b55c77
    • Run eslint --fix on the adaptivecards package - no manual edits
  • 46bcce1
    • Manual fixes for eslint issues. This is probably the most important thing to review!
  • 0455e3b
    • Run prettier on stuff in adaptivecards - no manual edits
  • subsequent commits address PR feedback

With these changes, after this branch is merged, doing an npm install in source/nodejs will automatically install husky-managed git hooks. After a file under source/nodejs is modified and staged, attempting to commit it will cause eslint and prettier to run. Automatically-fixable issues detected by eslint will be fixed and any formatting changes that need to be made will also be done automatically. Any errors from eslint that aren't auto-fixable will yield an error and refuse the commit. This hook can be bypassed using the --no-verify git commandline argument.

I should note that I didn't apply any autofixing or formatting outside of the adaptivecards package for now, as each individual package will need its own dedicated time.

Microsoft Reviewers: Open in CodeFlow

@ghost
Copy link

ghost commented Dec 7, 2021

Hi @paulcam206. Thanks for helping make the AdaptiveCards JS renderer + tooling better. As additional verification, once the JS build succeeds, please go to the test site to test out your website/designer changes.

@paulcam206 paulcam206 force-pushed the paulcam/eslint-fixes branch from 64dd28b to 9706d08 Compare December 7, 2021 02:57
@paulcam206 paulcam206 force-pushed the paulcam/eslint-fixes branch from 9706d08 to 3db9c20 Compare December 7, 2021 19:25
@paulcam206 paulcam206 requested a review from licanhua December 9, 2021 00:24
@paulcam206 paulcam206 force-pushed the paulcam/eslint-fixes branch from 9971adb to 79ff05d Compare December 9, 2021 00:25
@paulcam206 paulcam206 merged commit 7a46444 into main Dec 9, 2021
@paulcam206 paulcam206 deleted the paulcam/eslint-fixes branch December 9, 2021 18:22
michaelfarnsworth pushed a commit to michaelfarnsworth/AdaptiveCards that referenced this pull request Nov 10, 2022
* [JS] `prettier` config and updated `eslint`

Fixes microsoft#6757

* lint-staged config

run "npx lint-staged" from nodejs root for service

* set up husky

* `eslint --fix` on `adaptivecards`

does not include fixing of fixes :)

* eslint manual cleanup

* Fix formatting of properties with quotes

* `prettier` format `adaptivecards`

* tsx/jsx support and remove from .editorconfig

* Pre-filter commit hook to only check if files opened in nodejs
rankush pushed a commit to rankush/AdaptiveCards that referenced this pull request May 8, 2024
* [JS] `prettier` config and updated `eslint`

Fixes microsoft#6757

* lint-staged config

run "npx lint-staged" from nodejs root for service

* set up husky

* `eslint --fix` on `adaptivecards`

does not include fixing of fixes :)

* eslint manual cleanup

* Fix formatting of properties with quotes

* `prettier` format `adaptivecards`

* tsx/jsx support and remove from .editorconfig

* Pre-filter commit hook to only check if files opened in nodejs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revisit/revive/enforce eslint use Add prettier code formatter for JS, typescript

4 participants