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

fix: use pure ES modules at the monorepo top level #3970

Merged
merged 2 commits into from Dec 21, 2021

Conversation

ehmicky
Copy link
Contributor

@ehmicky ehmicky commented Dec 20, 2021

Fixes #3742

Every package of this monorepo is now using pure ES modules, including @netlify/build and @netlify/config.

There is a top-level package which is not published and is not needed in development as part of the monorepo structure. This PR makes that top-level and related top-level files use pure ES modules as well.

This has no impact on published code, only on development code.


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code πŸ§‘β€πŸ’». This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire πŸ”₯ (e.g. incident related), you can skip this step.
  • Read the contribution guidelines πŸ“–. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) πŸ§ͺ
  • Update or add documentation (if features were changed or added) πŸ“
  • Make sure the status checks below are successful βœ…

@ehmicky ehmicky added the type: chore work needed to keep the product and development running smoothly label Dec 20, 2021
@ehmicky ehmicky self-assigned this Dec 20, 2021
@github-actions github-actions bot added the type: bug code to address defects in shipped code label Dec 20, 2021
@ehmicky ehmicky removed the type: bug code to address defects in shipped code label Dec 20, 2021
const { overrides } = require('@netlify/eslint-config-node')

module.exports = {
extends: ['plugin:fp/recommended', '@netlify/eslint-config-node'],
parserOptions: {
sourceType: 'module',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The ESLint configuration can be simplified in several ways, now that every package is using pure ES modules.

{
files: ['packages/*/tests/**/*.{cjs,mjs,js}'],
rules: {
'no-magic-numbers': 'off',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Re-enable this rule since only a few statements were offending.

@@ -1,2 +1,2 @@
[[plugins]]
package = "./plugin"
package = "./plugin.cjs"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some test files must be renamed to .cjs to get the right linting.

@@ -3,7 +3,7 @@
"private": true,
"version": "0.0.0",
"description": "Netlify build module",
"main": "index.js",
"type": "module",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's the main change.

@@ -3,7 +3,7 @@
"private": true,
"version": "0.0.0",
"description": "Netlify build module",
"main": "index.js",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The top-level package.json is not published to npm and does not have any main/exports file.

@kodiakhq kodiakhq bot merged commit 922ddc5 into main Dec 21, 2021
@kodiakhq kodiakhq bot deleted the fix/monorepo-pure-esm branch December 21, 2021 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge type: chore work needed to keep the product and development running smoothly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use pure ES modules
2 participants