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

Convert package to ESM #70

Closed
9 tasks
nzakas opened this issue May 7, 2021 · 6 comments · Fixed by #71
Closed
9 tasks

Convert package to ESM #70

nzakas opened this issue May 7, 2021 · 6 comments · Fixed by #71

Comments

@nzakas
Copy link
Member

nzakas commented May 7, 2021

To convert this package from CommonJS to ECMAScript modules (ESM):

  • Add type: module to package.json
  • Convert files in lib to ESM
  • Convert files in tests/lib to ESM
  • Upgrade Mocha
  • Create build script in package.json to generate CommonJS file (.cjs) in dist directory (use Rollup)
  • Add dist to .gitignore
  • Run build in prepare script in package.json to ensure build is run at key moments
  • Update package.json so that main points in the CJS file in dist and exports provides both require and import options
  • Update README instructions
@eslint-github-bot eslint-github-bot bot added this to Needs Triage in Triage May 7, 2021
@nzakas nzakas added this to Planned in Public Roadmap via automation May 7, 2021
@nzakas nzakas moved this from Planned to Ready for Implementation in Public Roadmap May 7, 2021
@nzakas nzakas moved this from Needs Triage to Ready to Implement in Triage May 7, 2021
@brettz9
Copy link
Contributor

brettz9 commented Jun 24, 2021

Would you like to change to named exports here too?

@nzakas
Copy link
Member Author

nzakas commented Jun 25, 2021

Sure, I'm open to that.

@brettz9
Copy link
Contributor

brettz9 commented Jun 25, 2021

FWIW, in my PR I've kept some single item files as default exports, but for the main one (the one being exported) and others, they are named.

@aladdin-add
Copy link
Member

as I mentioned here, eslint-scope was used by webpack, too. the change would stop webpack upgrading to the latest eslint-scope. // @sokra

@nzakas
Copy link
Member Author

nzakas commented Jun 25, 2021

@aladdin-add would it stop them from upgrading, or would they just wait a bit longer? I assume with a breaking change that it would probably go through a more thorough evaluation before upgrading regardless.

@aladdin-add
Copy link
Member

yes, they will drop Node.js < 12 at some point, it's just a bit longer.

Public Roadmap automation moved this from Ready for Implementation to Complete Jul 22, 2021
nzakas added a commit that referenced this issue Jul 22, 2021
* Chore: Update devDeps.

* Chore: Lint according to latest config

* Breaking: Switch to ESM; also adds eslint-plugin-jsdoc for linter

* Fix: Sync with eslint-visitor-keys, including fixing cjs linting

* Update package.json

Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>

* Test: Drop Node 13, 10, 8 tests, and add 16, 12.22.0

* Docs: Add comment to explain shelljs command

* Refactor: Apply new API and ESM changes

* Chore: Update devDeps.

* Docs: Update espree usage in README

* Test: Add CJS file

* Update README.md

Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>

* Fix: Avoid named imports of CJS modules

* Fix: For browser compatibility, avoid package.json file-reading attempt

* Refactor: Drop `fs` from Rollup now that not in use

* Fix: Stop re-exporting Scope child classes and only export `Scope`

* Fix: Re-export Reference, Definition, and PatternVisitor

* Update Makefile.js

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* Update tests/commonjs.cjs

Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>

Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>
Triage automation moved this from Ready to Implement to Complete Jul 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Public Roadmap
  
Complete
Archived in project
Triage
Complete
Development

Successfully merging a pull request may close this issue.

3 participants