Feat: es modules (#139)
* All file imports change from commonjs to es-module * Improved plex error responses back from api * Converted viewHistory to es module * Es-module requires file extension, updated all imports * Fix esmodule not having __dirname defined in scope * Replace dynamic-require with fs readFileSync * Short message service module function is exported as default * Resolved lint issues & ignore import/extension rule until typescript * All tests file imports changed from commonjs to es-module * Import json fixtures with new helper
This commit was merged in pull request #139.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const jwt = require("jsonwebtoken");
|
||||
const User = require("./user");
|
||||
import jwt from "jsonwebtoken";
|
||||
import User from "./user.js";
|
||||
|
||||
class Token {
|
||||
constructor(user, admin = false, settings = null) {
|
||||
@@ -38,4 +38,4 @@ class Token {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Token;
|
||||
export default Token;
|
||||
|
||||
@@ -5,4 +5,4 @@ class User {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = User;
|
||||
export default User;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const assert = require("assert");
|
||||
const establishedDatabase = require("../database/database");
|
||||
import assert from "assert";
|
||||
import establishedDatabase from "../database/database.js";
|
||||
|
||||
class LinkPlexUserError extends Error {
|
||||
constructor(errorMessage = null) {
|
||||
@@ -263,4 +263,4 @@ class UserRepository {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = UserRepository;
|
||||
export default UserRepository;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const bcrypt = require("bcrypt");
|
||||
const UserRepository = require("./userRepository");
|
||||
import bcrypt from "bcrypt";
|
||||
import UserRepository from "./userRepository.js";
|
||||
|
||||
class UserSecurity {
|
||||
constructor(database) {
|
||||
@@ -72,4 +72,4 @@ class UserSecurity {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = UserSecurity;
|
||||
export default UserSecurity;
|
||||
|
||||
Reference in New Issue
Block a user