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

Enable ESLint; add ESLint/Prettier to CI #99

Merged
merged 2 commits into from
Sep 29, 2023
Merged

Enable ESLint; add ESLint/Prettier to CI #99

merged 2 commits into from
Sep 29, 2023

Conversation

maxatdetroit
Copy link
Member

This PR

See context in CityOfDetroit/detroitmi#1099. This PR:

  • Adds ESLint to the package
  • Codemods a suppression for existing lint errors (this way past errors are forgiven but no new lint errors can be added to the repo)
  • Creates yarn scripts to check the lint config and format/lint source code
  • Adds a GH action workflow to run format/lint on push or PR against dev branch

Note: This PR uses jscodeshift and suppress-eslint-errors to codemod Javascript to suppress ESLint errors. Then, Prettier to format the output.

$ npx suppress-eslint-errors ./src --rules=eqeqeq,no-console,no-unused-vars,prefer-const,no-case-declarations,no-unreachable,no-undef,no-empty --message="TODO: See CityOfDetroit/detroitmi#1099"
$ yarn prettier -w ./src

Testing

Run formatter, linter, and tests locally.

$ yarn lint && yarn test-storybook
Checking formatting...
All matched files use Prettier code style!
 PASS   browser: chromium  src/stories/offcanvas.stories.js
 PASS   browser: chromium  src/stories/accordion.stories.js
 PASS   browser: chromium  src/stories/modal.stories.js
 PASS   browser: chromium  src/stories/listgroup.stories.js
 PASS   browser: chromium  src/stories/card.stories.js
 PASS   browser: chromium  src/stories/dropdown.stories.js
 PASS   browser: chromium  src/stories/formcheck.stories.js
 PASS   browser: chromium  src/stories/pagination.stories.js
 PASS   browser: chromium  src/stories/formcheckgroup.stories.js
 PASS   browser: chromium  src/stories/carousel.stories.js
 PASS   browser: chromium  src/stories/loader.stories.js
 PASS   browser: chromium  src/stories/buttongroup.stories.js
 PASS   browser: chromium  src/stories/navbar.stories.js
 PASS   browser: chromium  src/stories/button.stories.js
 PASS   browser: chromium  src/stories/progress.stories.js
 PASS   browser: chromium  src/stories/formlabel.stories.js
 PASS   browser: chromium  src/stories/container.stories.js
 PASS   browser: chromium  src/stories/nav.stories.js
 PASS   browser: chromium  src/stories/alert.stories.js
 PASS   browser: chromium  src/stories/badge.stories.js
 PASS   browser: chromium  src/stories/geocoder.stories.js
 PASS   browser: chromium  src/stories/icon.stories.js
 PASS   browser: chromium  src/stories/breadcrumb.stories.js
 PASS   browser: chromium  src/stories/formcontrol.stories.js
 PASS   browser: chromium  src/stories/formselect.stories.js
 PASS   browser: chromium  src/stories/spinner.stories.js
 PASS   browser: chromium  src/stories/image.stories.js
 PASS   browser: chromium  src/stories/form.stories.js
 PASS   browser: chromium  src/stories/range.stories.js
 PASS   browser: chromium  src/stories/table.stories.js (6.543 s)

Test Suites: 30 passed, 30 total
Tests:       154 passed, 154 total
Snapshots:   0 total
Time:        7.518 s
Ran all test suites.

@maxatdetroit maxatdetroit merged commit 77532c0 into dev Sep 29, 2023
3 checks passed
@maxatdetroit maxatdetroit linked an issue Nov 27, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Conform UXDS library to Prettier & ESLint standards
1 participant