Skip to content

Commit

Permalink
feat: Use ESM modules
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Requires semantic-release 20 or above.

Thanks to @w4rlock for doing all the work to get this done and also adding some additional structure to the repo. Much appreciated!

Closes #31
Closes #32

Co-Authored-By: w4rlock <warlock.gpl@gmail.com>
  • Loading branch information
pmowrer and w4rlock committed Jan 17, 2024
1 parent a29cbdf commit 6a99326
Show file tree
Hide file tree
Showing 17 changed files with 30,705 additions and 6,814 deletions.
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/tests/**/*.js
!/**/.eslintrc.js
/scripts/release/node_modules
/coverage/
/dist/
**/node_modules/**
node_modules/*
23 changes: 23 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
env: {
es2021: true,
node: true,
jest: true
},
parserOptions: {
ecmaVersion: 12,
sourceType: 'module'
},
extends: ['eslint:recommended', 'airbnb-base', 'prettier'],
plugins: ['prettier'],
rules: {
'import/extensions': [0, 'ignorePackages', { js: 'never', jsx: 'never' }],
'max-len': 0,
'no-console': 0,
'no-await-in-loop': 0,
'no-multiple-empty-lines': 0,
'space-in-parens': 0,
'no-spaced-func': 0
}
};

2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 20
- run: yarn && yarn test
- run: npm install && npm test
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dist
dist-types
coverage
.vscode
yarn.lock
package-lock.json
8 changes: 8 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
semi: true
trailingComma: none
singleQuote: true
tabWidth: 2
useTabs: false
bracketSpacing: true
insertFinalNewline: true
printWidth: 120
2 changes: 1 addition & 1 deletion __mocks__/import-from.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = (path, module) => require(module);
export default (path, module) => import(module);
2 changes: 1 addition & 1 deletion __mocks__/myPlugin.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = 'myPlugin';
export default 'myPlugin';
13 changes: 13 additions & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// babel.config.js
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current'
}
}
]
]
};
5 changes: 5 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
transform: {
'\\.[jt]sx?$': 'babel-jest'
}
};
Loading

0 comments on commit 6a99326

Please sign in to comment.