fix == and != to === and !==, add check to eslint
This commit is contained in:
@@ -16,16 +16,17 @@ export default defineConfig([{
|
||||
},
|
||||
rules: {
|
||||
"no-tabs": ["error", { allowIndentationTabs: true }],
|
||||
indent: ["error", "tab"],
|
||||
"indent": ["error", "tab"],
|
||||
"linebreak-style": ["error", "unix"],
|
||||
quotes: ["error", "double"],
|
||||
semi: ["error", "always"],
|
||||
"quotes": ["error", "double"],
|
||||
"semi": ["error", "always"],
|
||||
"brace-style": ["error", "stroustrup", { allowSingleLine: false }],
|
||||
"no-unused-vars": ["warn", {
|
||||
"argsIgnorePattern": "^_",
|
||||
"varsIgnorePattern": "^_",
|
||||
"caughtErrorsIgnorePattern": "^_"
|
||||
}],
|
||||
"prefer-const": ["error"]
|
||||
"prefer-const": ["error"],
|
||||
"eqeqeq": ["error"]
|
||||
}
|
||||
}]);
|
||||
|
||||
+5
-5
@@ -203,7 +203,7 @@ export default class PVE extends PVE_BACKEND {
|
||||
|
||||
async getDisk (node, instance, disk) {
|
||||
const config = await this.getInstance(node, instance);
|
||||
if (config != null && config.volumes[disk] != null) {
|
||||
if (config !== null && config.volumes[disk] !== null) {
|
||||
return config.volumes[disk];
|
||||
}
|
||||
else {
|
||||
@@ -213,7 +213,7 @@ export default class PVE extends PVE_BACKEND {
|
||||
|
||||
async getNet (node, instance, netid) {
|
||||
const config = await this.getInstance(node, instance);
|
||||
if (config != null && config.nets[netid] != null) {
|
||||
if (config !== null && config.nets[netid] !== null) {
|
||||
return config.nets[netid];
|
||||
}
|
||||
else {
|
||||
@@ -223,7 +223,7 @@ export default class PVE extends PVE_BACKEND {
|
||||
|
||||
async getDevice (node, instance, deviceid) {
|
||||
const config = await this.getInstance(node, instance);
|
||||
if (config != null && config.devices[deviceid] != null) {
|
||||
if (config !== null && config.devices[deviceid] !== null) {
|
||||
return config.devices[deviceid];
|
||||
}
|
||||
else {
|
||||
@@ -238,11 +238,11 @@ export default class PVE extends PVE_BACKEND {
|
||||
return null;
|
||||
}
|
||||
const data = res.data;
|
||||
if (data.length != 1) {
|
||||
if (data.length !== 1) {
|
||||
return null;
|
||||
}
|
||||
const poolPVE = data[0];
|
||||
if (poolPVE.poolid != pool) {
|
||||
if (poolPVE.poolid !== pool) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ router.get("/:groupname", async (req, res) => {
|
||||
|
||||
// attempt to parse group from groupname
|
||||
const groupObj = global.utils.getGroupObjFromGroupname(params.groupname);
|
||||
if (groupObj == null) {
|
||||
if (groupObj === null) {
|
||||
res.status(400).send({ auth: true, error:`Groupname ${params.groupname} does not match format gid-realm or gid.` });
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ router.get("/:username", async (req, res) => {
|
||||
|
||||
// attempt to parse user from username
|
||||
const userObj = global.utils.getUserObjFromUsername(params.username);
|
||||
if (userObj == null) {
|
||||
if (userObj === null) {
|
||||
res.status(400).send({ auth:true, error:`username ${params.username} does not match format uid@realm.` });
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ router.post("/:disk/resize", async (req, res) => {
|
||||
|
||||
// attempt to parse user from username
|
||||
const userObj = global.utils.getUserObjFromUsername(req.cookies.username);
|
||||
if (userObj == null) {
|
||||
if (userObj === null) {
|
||||
res.status(400).send({ auth:true, error:`username ${req.cookies.username} does not match format uid@realm.` });
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ router.post("/:disk/move", async (req, res) => {
|
||||
|
||||
// attempt to parse user from username
|
||||
const userObj = global.utils.getUserObjFromUsername(req.cookies.username);
|
||||
if (userObj == null) {
|
||||
if (userObj === null) {
|
||||
res.status(400).send({ auth:true, error:`username ${req.cookies.username} does not match format uid@realm.` });
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ router.post("/:disk/create", async (req, res) => {
|
||||
|
||||
// attempt to parse user from username
|
||||
const userObj = global.utils.getUserObjFromUsername(req.cookies.username);
|
||||
if (userObj == null) {
|
||||
if (userObj === null) {
|
||||
res.status(400).send({ auth:true, error:`username ${req.cookies.username} does not match format uid@realm.` });
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -254,7 +254,7 @@ export async function approveResources (req, user, node, pool, request) {
|
||||
// if the resource type is list, check if the requested resource exists in the list
|
||||
if (configResources[key].type === "list") {
|
||||
const index = resourceData.findIndex((availElement) => request[key].includes(availElement.match));
|
||||
// if no matching resource when index == -1, then remaining is -1 otherwise use the remaining value
|
||||
// if no matching resource when index === -1, then remaining is -1 otherwise use the remaining value
|
||||
const avail = index === -1 ? false : resourceData[index].avail > 0;
|
||||
if (avail !== configResources[key].whitelist) {
|
||||
reason[key] = { approved: false, reason: `${key} ${configResources[key].whitelist ? "not in whitelist" : "in blacklist"}` };
|
||||
|
||||
Reference in New Issue
Block a user