Skip to content

Commit

Permalink
Switch to ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
chotai committed Aug 16, 2024
1 parent 4889cfe commit fefa574
Show file tree
Hide file tree
Showing 76 changed files with 1,193 additions and 796 deletions.
31 changes: 0 additions & 31 deletions .babelrc

This file was deleted.

63 changes: 63 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
module.exports = {
env: {
commonjs: true,
es2022: true,
node: true,
jest: true,
'jest/globals': true
},
extends: [
'standard',
'prettier',
'plugin:import/recommended',
'plugin:jest-formatting/recommended',
'plugin:n/recommended',
'plugin:promise/recommended'
],
overrides: [
{
files: ['**/*.cjs'],
parserOptions: {
sourceType: 'commonjs'
}
},
{
files: ['**/*.test.js'],
plugins: ['jest'],
extends: ['plugin:jest/recommended', 'plugin:jest-formatting/recommended']
}
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
plugins: ['import', 'jest', 'jest-formatting', 'n', 'promise', 'prettier'],
rules: {
'prettier/prettier': [
'error',
{
endOfLine: 'auto'
}
],
'no-console': 'error',

// Check for mandatory file extensions
// https://nodejs.org/api/esm.html#mandatory-file-extensions
'import/extensions': ['error', 'always', { ignorePackages: true }],

// Skip rules handled by TypeScript compiler
'import/default': 'off',
'import/namespace': 'off',
'n/no-extraneous-require': 'off',
'n/no-extraneous-import': 'off',
'n/no-missing-require': 'off',
'n/no-missing-import': 'off'
},
settings: {
'import/resolver': {
node: true,
typescript: true
}
},
ignorePatterns: ['.server', '.public', 'src/__fixtures__', 'coverage']
}
18 changes: 0 additions & 18 deletions .eslintrc.json

This file was deleted.

4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.config.*
*.test.*
__fixtures__
test-helpers
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
tabWidth: 2,
semi: false,
singleQuote: true,
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ ARG PORT
ENV PORT ${PORT}
EXPOSE ${PORT}

CMD [ "node", "./.server" ]
CMD [ "node", "." ]
31 changes: 31 additions & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const { NODE_ENV } = process.env

module.exports = {
presets: [
[
'@babel/preset-env',
{
modules: NODE_ENV === 'test' ? 'auto' : false,
targets: {
node: '20'
}
}
]
],
plugins: [
[
'module-resolver',
{
root: ['./'],
alias: {
'~': '.'
}
}
]
],
env: {
test: {
plugins: ['babel-plugin-transform-import-meta']
}
}
}
2 changes: 1 addition & 1 deletion jest-mongodb-config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
mongodbMemoryServerOptions: {
binary: {
skipMD5: true
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
rootDir: '.',
verbose: true,
resetModules: true,
Expand Down
Loading

0 comments on commit fefa574

Please sign in to comment.