Skip to content

Commit fefa574

Browse files
committed
Switch to ESM
1 parent 4889cfe commit fefa574

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1193
-796
lines changed

.babelrc

Lines changed: 0 additions & 31 deletions
This file was deleted.

.eslintrc.cjs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
module.exports = {
2+
env: {
3+
commonjs: true,
4+
es2022: true,
5+
node: true,
6+
jest: true,
7+
'jest/globals': true
8+
},
9+
extends: [
10+
'standard',
11+
'prettier',
12+
'plugin:import/recommended',
13+
'plugin:jest-formatting/recommended',
14+
'plugin:n/recommended',
15+
'plugin:promise/recommended'
16+
],
17+
overrides: [
18+
{
19+
files: ['**/*.cjs'],
20+
parserOptions: {
21+
sourceType: 'commonjs'
22+
}
23+
},
24+
{
25+
files: ['**/*.test.js'],
26+
plugins: ['jest'],
27+
extends: ['plugin:jest/recommended', 'plugin:jest-formatting/recommended']
28+
}
29+
],
30+
parserOptions: {
31+
ecmaVersion: 'latest',
32+
sourceType: 'module'
33+
},
34+
plugins: ['import', 'jest', 'jest-formatting', 'n', 'promise', 'prettier'],
35+
rules: {
36+
'prettier/prettier': [
37+
'error',
38+
{
39+
endOfLine: 'auto'
40+
}
41+
],
42+
'no-console': 'error',
43+
44+
// Check for mandatory file extensions
45+
// https://nodejs.org/api/esm.html#mandatory-file-extensions
46+
'import/extensions': ['error', 'always', { ignorePackages: true }],
47+
48+
// Skip rules handled by TypeScript compiler
49+
'import/default': 'off',
50+
'import/namespace': 'off',
51+
'n/no-extraneous-require': 'off',
52+
'n/no-extraneous-import': 'off',
53+
'n/no-missing-require': 'off',
54+
'n/no-missing-import': 'off'
55+
},
56+
settings: {
57+
'import/resolver': {
58+
node: true,
59+
typescript: true
60+
}
61+
},
62+
ignorePatterns: ['.server', '.public', 'src/__fixtures__', 'coverage']
63+
}

.eslintrc.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.config.*
2+
*.test.*
3+
__fixtures__
4+
test-helpers

.prettierrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
tabWidth: 2,
33
semi: false,
44
singleQuote: true,

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ ARG PORT
3838
ENV PORT ${PORT}
3939
EXPOSE ${PORT}
4040

41-
CMD [ "node", "./.server" ]
41+
CMD [ "node", "." ]

babel.config.cjs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const { NODE_ENV } = process.env
2+
3+
module.exports = {
4+
presets: [
5+
[
6+
'@babel/preset-env',
7+
{
8+
modules: NODE_ENV === 'test' ? 'auto' : false,
9+
targets: {
10+
node: '20'
11+
}
12+
}
13+
]
14+
],
15+
plugins: [
16+
[
17+
'module-resolver',
18+
{
19+
root: ['./'],
20+
alias: {
21+
'~': '.'
22+
}
23+
}
24+
]
25+
],
26+
env: {
27+
test: {
28+
plugins: ['babel-plugin-transform-import-meta']
29+
}
30+
}
31+
}

jest-mongodb-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
mongodbMemoryServerOptions: {
33
binary: {
44
skipMD5: true

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
rootDir: '.',
33
verbose: true,
44
resetModules: true,

0 commit comments

Comments
 (0)