Update eslint and eslint-plugin-vue, fix rules

This commit is contained in:
Pavel Djundik 2019-06-25 11:51:47 +03:00
parent 921307a914
commit 1425130436
12 changed files with 83 additions and 73 deletions

View file

@ -35,6 +35,7 @@ rules:
no-catch-shadow: error
no-confusing-arrow: [error, {allowParens: true}]
no-control-regex: off
no-console: error
no-duplicate-imports: error
no-else-return: error
no-implicit-globals: error

View file

@ -219,7 +219,7 @@ export default {
const args = text.substr(1).split(" ");
const cmd = args.shift().toLowerCase();
if (commands.hasOwnProperty(cmd) && commands[cmd].input(args)) {
if (Object.prototype.hasOwnProperty.call(commands, cmd) && commands[cmd].input(args)) {
return false;
}
}

View file

@ -182,7 +182,7 @@ function parseOverrideParams(params, data) {
key = "join";
}
if (!data.defaults.hasOwnProperty(key)) {
if (!Object.prototype.hasOwnProperty.call(data.defaults, key)) {
continue;
}

View file

@ -81,8 +81,8 @@
"css-loader": "0.28.11",
"css.escape": "1.5.1",
"emoji-regex": "8.0.0",
"eslint": "5.16.0",
"eslint-plugin-vue": "5.2.2",
"eslint": "6.0.1",
"eslint-plugin-vue": "5.2.3",
"fuzzy": "0.1.3",
"graphql-request": "1.8.2",
"handlebars": "4.1.2",

View file

@ -362,7 +362,7 @@ Client.prototype.inputLine = function(data) {
const irc = target.network.irc;
let connected = irc && irc.connection && irc.connection.connected;
if (inputs.hasOwnProperty(cmd) && typeof inputs[cmd].input === "function") {
if (Object.prototype.hasOwnProperty.call(inputs, cmd) && typeof inputs[cmd].input === "function") {
const plugin = inputs[cmd];
if (connected || plugin.allowDisconnected) {

View file

@ -32,7 +32,7 @@ program
const packages = JSON.parse(fs.readFileSync(packagesConfig, "utf-8"));
if (!packages.dependencies || !packages.dependencies.hasOwnProperty(packageName)) {
if (!packages.dependencies || !Object.prototype.hasOwnProperty.call(packages.dependencies, packageName)) {
log.warn(packageWasNotInstalled);
process.exit(1);
}

View file

@ -38,7 +38,7 @@ program
packages.forEach((p) => {
log.info(`- ${colors.green(p)}`);
if (packagesList.hasOwnProperty(p)) {
if (Object.prototype.hasOwnProperty.call(packagesList, p)) {
argsList.push(p);
count++;
} else {

View file

@ -239,7 +239,7 @@ function getDefaultNick() {
function mergeConfig(oldConfig, newConfig) {
return _.mergeWith(oldConfig, newConfig, (objValue, srcValue, key, object) => {
if (!object.hasOwnProperty(key)) {
if (!Object.prototype.hasOwnProperty.call(object, key)) {
log.warn(`Unknown key "${colors.bold(key)}", please verify your config.`);
}

View file

@ -152,7 +152,7 @@ Network.prototype.createIrcFramework = function(client) {
};
Network.prototype.createWebIrc = function(client) {
if (!Helper.config.webirc || !Helper.config.webirc.hasOwnProperty(this.host)) {
if (!Helper.config.webirc || !Object.prototype.hasOwnProperty.call(Helper.config.webirc, this.host)) {
return null;
}

View file

@ -34,6 +34,21 @@ async function fetch() {
return versions;
}
updateVersions(response);
// Emptying cached information after reaching said expiration date
setTimeout(() => {
delete versions.current.changelog;
delete versions.latest;
}, TIME_TO_LIVE);
} catch (error) {
log.error(`Failed to fetch changelog: ${error}`);
}
return versions;
}
function updateVersions(response) {
let i;
let release;
let prerelease = false;
@ -72,15 +87,4 @@ async function fetch() {
// Add expiration date to the data to send to the client for later refresh
versions.expiresAt = Date.now() + TIME_TO_LIVE;
// Emptying cached information after reaching said expiration date
setTimeout(() => {
delete versions.current.changelog;
delete versions.latest;
}, TIME_TO_LIVE);
} catch (error) {
log.error(`Failed to fetch changelog: ${error}`);
}
return versions;
}

View file

@ -464,7 +464,7 @@ function initializeClient(socket, client, token, lastMessage) {
if (!Helper.config.public) {
socket.on("push:register", (subscription) => {
if (!client.config.sessions.hasOwnProperty(token)) {
if (!Object.prototype.hasOwnProperty.call(client.config.sessions, token)) {
return;
}
@ -529,7 +529,7 @@ function initializeClient(socket, client, token, lastMessage) {
});
socket.on("setting:get", () => {
if (!client.config.hasOwnProperty("clientSettings")) {
if (!Object.prototype.hasOwnProperty.call(client.config, "clientSettings")) {
socket.emit("setting:all", {});
return;
}
@ -545,7 +545,7 @@ function initializeClient(socket, client, token, lastMessage) {
tokenToSignOut = token;
}
if (!client.config.sessions.hasOwnProperty(tokenToSignOut)) {
if (!Object.prototype.hasOwnProperty.call(client.config.sessions, tokenToSignOut)) {
return;
}
@ -717,7 +717,7 @@ function performAuthentication(data) {
if (client && data.token) {
const providedToken = client.calculateTokenHash(data.token);
if (client.config.sessions.hasOwnProperty(providedToken)) {
if (Object.prototype.hasOwnProperty.call(client.config.sessions, providedToken)) {
token = providedToken;
client.updateSession(providedToken, getClientIp(socket), socket.request);

View file

@ -1187,6 +1187,16 @@ ajv@^6.1.0, ajv@^6.5.5, ajv@^6.9.1:
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"
ajv@^6.10.0:
version "6.10.0"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.0.tgz#90d0d54439da587cd7e843bfb7045f50bd22bdf1"
integrity sha512-nffhOpkymDECQyR0mnsUtoCE8RlX38G0rYP+wgLWFyZuUyuuojSSvi/+euOiQBIn63whYwYVIIH1TvE3tu4OEg==
dependencies:
fast-deep-equal "^2.0.1"
fast-json-stable-stringify "^2.0.0"
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"
alphanum-sort@^1.0.1, alphanum-sort@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/alphanum-sort/-/alphanum-sort-1.0.2.tgz#97a1119649b211ad33691d9f9f486a8ec9fbe0a3"
@ -3110,10 +3120,10 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
eslint-plugin-vue@5.2.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-5.2.2.tgz#86601823b7721b70bc92d54f1728cfc03b36283c"
integrity sha512-CtGWH7IB0DA6BZOwcV9w9q3Ri6Yuo8qMjx05SmOGJ6X6E0Yo3y9E/gQ5tuNxg2dEt30tRnBoFTbvtmW9iEoyHA==
eslint-plugin-vue@5.2.3:
version "5.2.3"
resolved "https://registry.yarnpkg.com/eslint-plugin-vue/-/eslint-plugin-vue-5.2.3.tgz#3ee7597d823b5478804b2feba9863b1b74273961"
integrity sha512-mGwMqbbJf0+VvpGR5Lllq0PMxvTdrZ/ZPjmhkacrCHbubJeJOt+T6E3HUzAifa2Mxi7RSdJfC9HFpOeSYVMMIw==
dependencies:
vue-eslint-parser "^5.0.0"
@ -3143,13 +3153,13 @@ eslint-visitor-keys@^1.0.0:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==
eslint@5.16.0:
version "5.16.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea"
integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==
eslint@6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.0.1.tgz#4a32181d72cb999d6f54151df7d337131f81cda7"
integrity sha512-DyQRaMmORQ+JsWShYsSg4OPTjY56u1nCjAmICrE8vLWqyLKxhFXOthwMj1SA8xwfrv0CofLNVnqbfyhwCkaO0w==
dependencies:
"@babel/code-frame" "^7.0.0"
ajv "^6.9.1"
ajv "^6.10.0"
chalk "^2.1.0"
cross-spawn "^6.0.5"
debug "^4.0.1"
@ -3157,18 +3167,19 @@ eslint@5.16.0:
eslint-scope "^4.0.3"
eslint-utils "^1.3.1"
eslint-visitor-keys "^1.0.0"
espree "^5.0.1"
espree "^6.0.0"
esquery "^1.0.1"
esutils "^2.0.2"
file-entry-cache "^5.0.1"
functional-red-black-tree "^1.0.1"
glob "^7.1.2"
glob-parent "^3.1.0"
globals "^11.7.0"
ignore "^4.0.6"
import-fresh "^3.0.0"
imurmurhash "^0.1.4"
inquirer "^6.2.2"
js-yaml "^3.13.0"
is-glob "^4.0.0"
js-yaml "^3.13.1"
json-stable-stringify-without-jsonify "^1.0.1"
levn "^0.3.0"
lodash "^4.17.11"
@ -3176,7 +3187,6 @@ eslint@5.16.0:
mkdirp "^0.5.1"
natural-compare "^1.4.0"
optionator "^0.8.2"
path-is-inside "^1.0.2"
progress "^2.0.0"
regexpp "^2.0.1"
semver "^5.5.1"
@ -3194,10 +3204,10 @@ espree@^4.1.0:
acorn-jsx "^5.0.0"
eslint-visitor-keys "^1.0.0"
espree@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/espree/-/espree-5.0.1.tgz#5d6526fa4fc7f0788a5cf75b15f30323e2f81f7a"
integrity sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A==
espree@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/espree/-/espree-6.0.0.tgz#716fc1f5a245ef5b9a7fdb1d7b0d3f02322e75f6"
integrity sha512-lJvCS6YbCn3ImT3yKkPe0+tJ+mH6ljhGNjHQH9mRtiO6gjhVAOhVXW1yjnwqGwTkK3bGbye+hb00nFNmu0l/1Q==
dependencies:
acorn "^6.0.7"
acorn-jsx "^5.0.0"
@ -6240,11 +6250,6 @@ path-is-absolute@^1.0.0:
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
path-is-inside@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53"
integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=
path-key@^2.0.0, path-key@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"