Skip to content

Commit

Permalink
feat!: Export both CommonJS and ESM (#417)
Browse files Browse the repository at this point in the history
* export cjs and esm
  • Loading branch information
Jason3S committed Oct 16, 2023
1 parent 227e3d8 commit e31e40c
Show file tree
Hide file tree
Showing 12 changed files with 707 additions and 4,563 deletions.
23 changes: 17 additions & 6 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,30 @@
*/
const config = {
env: {
es2020: true,
es2023: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:node/recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:promise/recommended',
'plugin:prettier/recommended',
],
parserOptions: {
ecmaVersion: 11,
ecmaVersion: 2023,
sourceType: 'module',
},
overrides: [
{
files: '**/*.ts',
extends: ['plugin:@typescript-eslint/recommended', 'plugin:import/typescript'],
extends: ['plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
rules: {
'no-unused-vars': 0, // off - caught by the compiler
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'node/no-missing-import': [
'error',
'off',
{
tryExtensions: ['.js', '.d.ts', '.ts'],
},
Expand All @@ -42,6 +40,19 @@ const config = {
},
},
],
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx', '.mts'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code

// use an array of glob patterns
project: ['packages/*/tsconfig.json', 'integration-tests/tsconfig.json'],
},
},
},
};

module.exports = config;
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ jobs:
matrix:
node-version:
# List of supported node versions (latest is tested in `test-os`)
- 14.x
- 16.x
- 18.x
- 20.x

os:
- ubuntu-latest
Expand All @@ -42,7 +41,7 @@ jobs:
matrix:
node-version:
# Test the latest node version here, move older versions to `test-old-node-versions`
- 16.x
- 20.x

os:
- ubuntu-latest
Expand Down

0 comments on commit e31e40c

Please sign in to comment.