Skip to content

Commit

Permalink
feat(eslint): disabling default exports in ESM libraries (#765)
Browse files Browse the repository at this point in the history
* feat(eslint): disabling default exports in ESM libraries

* fix: pr feedback
  • Loading branch information
erunion authored Oct 31, 2023
1 parent c646e8c commit c4c3bc9
Showing 1 changed file with 11 additions and 0 deletions.
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': 'warn',

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

0 comments on commit c4c3bc9

Please sign in to comment.