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