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(all): [v16] Bump eslint and related packages, bump prettier and run on codebase #927

Conversation

rnegron
Copy link
Member

@rnegron rnegron commented Dec 3, 2024

Note: This MR is based on top of #926. It should be re-based and merged into the v16 branch after that one is merged.

Packages Updates

  • eslint 8.32.0 -> 9.16.0
  • eslint-config-prettier 8.6.0 -> 9.16.0
  • eslint-plugin-import: 2.27.5 -> 2.31.0
  • eslint-plugin-mocha: 9.0.0 -> 10.5.0
  • eslint-plugin-n: 15.6.1 -> 17.14.0
  • eslint-plugin-promise: 6.1.1 -> 7.2.1
  • prettier: 2.8.3 -> 3.4.1

Package Removals

Other Changes

  • Pin engine to >=18.18 for the cli package, to mirror the upgraded eslint dependency...

  • The vast majority of the file changes in this PR are due to the trailingCommas option in prettier, which had its default value changed from "es5" to "all" in v3.0.0

    • Even when using "es5", running prettier on the codebase generates a lot of file changes. So I figured we should just keep the default value then.
  • .eslintrc is replaced by eslint.config.cjs (auto-generated via npx @eslint/migrate-config .eslintrc --commonjs according to the migration guide, which then required we install globals, @eslint/js and @eslint/eslintrc)

  • .eslintignore: "ESLintIgnoreWarning: The ".eslintignore" file is no longer supported. Switch to using the "ignores" property in "eslint.config.js": https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files"

@@ -1,5 +1,5 @@
#!/usr/bin/env node

/* eslint-disable array-callback-return */
Copy link
Member Author

Choose a reason for hiding this comment

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

Calling out this specific disable I had to add to avoid changing some .map() calls below

@@ -40,8 +40,9 @@ const createFile = async (content, filename, dir) => {
endSpinner();
};

const prettifyJs = (code) =>
const prettifyJs = async (code) =>
Copy link
Member Author

Choose a reason for hiding this comment

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

prettier.format returns a Promise since v3. This means renderDefinitionSlice below which uses prettifyJs needs to await it. Interestingly, the callers for renderDefinitionSlice itself already awaited the response 👍🏻

The other usage of prettifyJs is in renderIndex which already returns a Promise.

@@ -46,7 +48,7 @@
"eslint --fix --quiet"
],
"*.{js,json}": [
"prettier --write"
"prettier --write --ignore-path=.prettierignore"
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if this has much effect; keeping previous behavior to avoid surprises just in case.

@@ -1,3 +1,3 @@
module.exports = (z, bundle) => {
return [{ id: 1234 }] || bundle;
Copy link
Member Author

Choose a reason for hiding this comment

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

Calling out this change I did to fix no-constant-binary-expression eslint error

@rnegron rnegron force-pushed the PDE-4097-bundlers-and-formatters branch from 879a606 to f9a0e95 Compare December 3, 2024 14:39
@rnegron rnegron marked this pull request as ready for review December 3, 2024 15:08
@rnegron rnegron requested a review from a team as a code owner December 3, 2024 15:08
@rnegron rnegron force-pushed the PDE-4097-bundlers-and-formatters branch from 0d5a9e5 to 6812b4e Compare December 3, 2024 15:15
Base automatically changed from PDE-4097 to zapier-platform-major-release-16.0.0-dev December 4, 2024 12:39
});

module.exports = [{
ignores: [
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved .eslintignore into this ignores property as required by eslint 9

"packages/cli/scaffold/*.js",
"packages/cli/src/generators/templates/**/*.template.js",
"**/.yarn",
"example-apps/onedrive/test/*",
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: I added this new ignore rule for onedrive example app tests; there seems to be some issue with eslint trying to read the .eslintrc.json in that root directory (?!) which I didn't want to get into...

Copy link
Contributor

Choose a reason for hiding this comment

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

Yikes, yeah that seems reasonable!

@@ -19,7 +19,7 @@
"/oclif.manifest.json"
],
"engines": {
"node": ">=18"
"node": ">=18.18"
Copy link
Member Author

Choose a reason for hiding this comment

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

Note this stricter requirement; eslint 9 requires the 18.18 minor version, so I figure it makes sense to enforce this for at least zapier-platform-cli

Copy link
Contributor

@kreddlear kreddlear left a comment

Choose a reason for hiding this comment

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

Whew, that's a lot of commas 😅 Thanks for adding comments on the main changes for this, that made it much easier to review! Looks great 👍

"packages/cli/scaffold/*.js",
"packages/cli/src/generators/templates/**/*.template.js",
"**/.yarn",
"example-apps/onedrive/test/*",
Copy link
Contributor

Choose a reason for hiding this comment

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

Yikes, yeah that seems reasonable!

@rnegron rnegron merged commit 349f4b3 into zapier-platform-major-release-16.0.0-dev Dec 4, 2024
14 checks passed
@rnegron rnegron deleted the PDE-4097-bundlers-and-formatters branch December 4, 2024 17:58
rnegron added a commit that referenced this pull request Dec 11, 2024
* Param name fixed.

* Width of produced markdown docs fixed to 80 chars.

* Deps of @oclif packages upgraded.

* Command args and flags upgraded.

* Run scripts updated.

* Tests for ZapierBaseCommand upgraded with command flag tests added.

* Tests for register command upgraded.

* logList is really printing tables (without borders).

* argv parsed.

* yarn lock file updated.

* Docs updated.

* Function name consolidated.

* @oclif/core requires node >= 18.

* Old code removed.

* build(schema-to-ts): [PDE-5183] schema-to-ts is now part of yarn workspace  (#913)

* BREAKING CHANGE(all): [v16] Bump dependency package versions (#926)

* bumping oclif packages

* bump more packages

* upgrade Yeoman enviornment to latest v3

* dotenv added a package.json

* more package upgrades

* use promises instead of callback

* revert jsonschema upgrade as it breaks a test

* bump

* upgrade Lerna to v8

* upgrade prettier to latest v3

* run prettier with trailingComma: es5

* upgrade husky

* husky followups

* Revert "upgrade prettier to latest v3"

This reverts commit 840d0ae.

* Revert "run prettier with trailingComma: es5"

This reverts commit df8a16f.

* bump mocha, dotenv and oclif core patch

* undo convert changes

* chore(all): [v16] Bump eslint and related packages, bump prettier and run on codebase (#927)

* bumping oclif packages

* bump more packages

* upgrade Yeoman enviornment to latest v3

* dotenv added a package.json

* more package upgrades

* use promises instead of callback

* revert jsonschema upgrade as it breaks a test

* bump

* upgrade Lerna to v8

* upgrade prettier to latest v3

* run prettier with trailingComma: es5

* upgrade husky

* husky followups

* Revert "upgrade prettier to latest v3"

This reverts commit 840d0ae.

* Revert "run prettier with trailingComma: es5"

This reverts commit df8a16f.

* bump mocha, dotenv and oclif core patch

* undo convert changes

* bump eslint and related packages

* prettier bump, run prettier

* fix eslintignore

* fix test

* run over example-apps as well

* rebuild yarn.lock

* chore(types): Add type for z.request option skipEncodingChars (#928)

---------

Co-authored-by: szchenghuang <[email protected]>
Co-authored-by: Thomas Cranny <[email protected]>
rnegron added a commit that referenced this pull request Dec 16, 2024
* chore(all) [PDE-4089]: v16 release development branch (#923)

* Param name fixed.

* Width of produced markdown docs fixed to 80 chars.

* Deps of @oclif packages upgraded.

* Command args and flags upgraded.

* Run scripts updated.

* Tests for ZapierBaseCommand upgraded with command flag tests added.

* Tests for register command upgraded.

* logList is really printing tables (without borders).

* argv parsed.

* yarn lock file updated.

* Docs updated.

* Function name consolidated.

* @oclif/core requires node >= 18.

* Old code removed.

* build(schema-to-ts): [PDE-5183] schema-to-ts is now part of yarn workspace  (#913)

* BREAKING CHANGE(all): [v16] Bump dependency package versions (#926)

* bumping oclif packages

* bump more packages

* upgrade Yeoman enviornment to latest v3

* dotenv added a package.json

* more package upgrades

* use promises instead of callback

* revert jsonschema upgrade as it breaks a test

* bump

* upgrade Lerna to v8

* upgrade prettier to latest v3

* run prettier with trailingComma: es5

* upgrade husky

* husky followups

* Revert "upgrade prettier to latest v3"

This reverts commit 840d0ae.

* Revert "run prettier with trailingComma: es5"

This reverts commit df8a16f.

* bump mocha, dotenv and oclif core patch

* undo convert changes

* chore(all): [v16] Bump eslint and related packages, bump prettier and run on codebase (#927)

* bumping oclif packages

* bump more packages

* upgrade Yeoman enviornment to latest v3

* dotenv added a package.json

* more package upgrades

* use promises instead of callback

* revert jsonschema upgrade as it breaks a test

* bump

* upgrade Lerna to v8

* upgrade prettier to latest v3

* run prettier with trailingComma: es5

* upgrade husky

* husky followups

* Revert "upgrade prettier to latest v3"

This reverts commit 840d0ae.

* Revert "run prettier with trailingComma: es5"

This reverts commit df8a16f.

* bump mocha, dotenv and oclif core patch

* undo convert changes

* bump eslint and related packages

* prettier bump, run prettier

* fix eslintignore

* fix test

* run over example-apps as well

* rebuild yarn.lock

* chore(types): Add type for z.request option skipEncodingChars (#928)

---------

Co-authored-by: szchenghuang <[email protected]>
Co-authored-by: Thomas Cranny <[email protected]>

* add changelog

* Bump cli, core, schema 15.19.0 -> 16.0.0

---------

Co-authored-by: szchenghuang <[email protected]>
Co-authored-by: Thomas Cranny <[email protected]>
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.

2 participants