Skip to content

Commit 7554492

Browse files
committed
change common js to esm
1 parent 6a4319c commit 7554492

File tree

452 files changed

+4809
-4443
lines changed

Some content is hidden

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

452 files changed

+4809
-4443
lines changed

.eslintrc.js

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

.eslintrc.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"env": {
3+
"es2021": true,
4+
"node": true,
5+
"mocha": true
6+
},
7+
"extends": [
8+
"standard",
9+
"plugin:mocha/recommended",
10+
"plugin:security/recommended",
11+
"plugin:prettier/recommended"
12+
],
13+
"plugins": ["mocha", "security", "prettier"],
14+
"parserOptions": {
15+
"ecmaVersion": 13,
16+
"sourceType": "module"
17+
},
18+
"globals": {
19+
"config": "readonly",
20+
"logger": "readonly"
21+
},
22+
"rules": {
23+
"no-trailing-spaces": "error",
24+
"consistent-return": "error",
25+
"no-console": "error",
26+
"import/extensions": ["error", "always"],
27+
"import/no-commonjs": "error",
28+
"mocha/no-skipped-tests": "error",
29+
"mocha/no-exclusive-tests": "error",
30+
"prettier/prettier": "error"
31+
},
32+
"ignorePatterns": ["public/*", "dist/*"]
33+
}

.mocharc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Mocha configuration file
33
* Info: https://mochajs.org/#configuring-mocha-nodejs
44
*/
5-
module.exports = {
5+
export default {
66
timeout: "5000",
77
extension: ["ts", "js"],
88
require: "ts-node/register",

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ The following project structure should be followed:
7474
| | |-- services
7575
| |-- utils // Utility functions to be used while testing
7676
|-- utils // Files containing utility functions
77-
| |-- logger.js
77+
| |-- logger
7878
|-- .github
7979
| |-- workflows
8080
| |-- // Github actions files

app.js

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

app.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import createError from 'http-errors';
2+
import express from 'express';
3+
import { isMulterError, multerErrorHandling } from './utils/multer.js';
4+
5+
// Attach response headers
6+
import { responseHeaders } from './middlewares/responseHeaders.js';
7+
8+
// import app middlewares
9+
import { middleware } from './middlewares/index.js';
10+
11+
// import routes
12+
import { appRoutes } from './routes/index.js';
13+
14+
const app = express();
15+
16+
// Add Middlewares, routes
17+
middleware(app);
18+
app.use("/", responseHeaders, appRoutes);
19+
20+
// catch 404 and forward to error handler
21+
app.use(function (req, res, next) {
22+
next(createError(404));
23+
});
24+
25+
// error handler
26+
app.use(function (err, req, res, next) {
27+
if (isMulterError(err)) {
28+
return multerErrorHandling(err, req, res, next);
29+
}
30+
return res.boom.boomify(err, {
31+
statusCode: err.statusCode,
32+
});
33+
});
34+
35+
export default app;

config/custom-environment-variables.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Documentation: https://github.com/lorenwest/node-config/wiki/Environment-Variables
77
*/
8-
module.exports = {
8+
export default {
99
port: {
1010
__name: "PORT",
1111
__format: "number",

config/default.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
const NODE_ENV = process.env.NODE_ENV;
10-
module.exports = {
10+
export default {
1111
port: 3000,
1212
enableFileLogs: true,
1313
enableConsoleLogs: false,

config/development.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
const port = 3000;
77
const localUrl = `http://localhost:${port}`;
88

9-
module.exports = {
9+
export default {
1010
port: port,
1111
enableFileLogs: false,
1212
enableConsoleLogs: true,

config/production.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Set the environment specific config in this file.
33
* Defaults set from default.js
44
*/
5-
module.exports = {
5+
export default {
66
discordUnverifiedRoleId: "1103047289330745386",
77
discordDeveloperRoleId: "915490782939582485",
88
discordNewComersChannelId: "709080951824842783",

0 commit comments

Comments
 (0)