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

feat(eslint): disabling default exports in ESM libraries #765

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/eslint-config/esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ const config = {
// see here for more rules to possibly enable in the future:
// https://gist.github.com/Jaid/164668c0151ae09d2bc81be78a203dd5
'import/no-commonjs': 'error',

/**
* This rule enablement is generally only intended for public-facing libraries but when shipping
* a package that exports CJS and ESM exports you cannot do `export default` and also
* `export type` in the same file because `export default` gets translated to `export =` in CJS
* and TS types can't be layered on top of that.
*
* @see {@link https://github.com/isaacs/tshy#handling-default-exports}
*/
'import/no-default-export': 'error',
erunion marked this conversation as resolved.
Show resolved Hide resolved

'node/no-extraneous-import': 'error',
'unicorn/prefer-module': 'error',
'unicorn/prefer-node-protocol': 'error',
Expand Down