chore: improve linting

This commit is contained in:
Ricardo Arturo Cabral Mejia 2022-10-25 09:14:55 -04:00
parent cda8df166f
commit 4941f8307a
No known key found for this signature in database
GPG Key ID: 5931EBF43A650245
4 changed files with 17 additions and 15 deletions

View File

@ -4,7 +4,7 @@ module.exports = {
sourceType: 'module', sourceType: 'module',
}, },
plugins: ['@typescript-eslint/eslint-plugin'], plugins: ['@typescript-eslint/eslint-plugin'],
extends: ['plugin:@typescript-eslint/recommended'], extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
root: true, root: true,
env: { env: {
node: true, node: true,

View File

@ -12,4 +12,3 @@ export const run = (isPrimary: boolean) => {
if (require.main === module) { if (require.main === module) {
run(cluster.isPrimary)() run(cluster.isPrimary)()
} }

View File

@ -18,6 +18,7 @@ function msb(b: number) {
return 8 return 8
} }
// eslint-disable-next-line no-cond-assign
while (b >>= 1) { while (b >>= 1) {
n++ n++
} }

View File

@ -1,6 +1,6 @@
import { IAlternative } from '../../@types/runes' import { IAlternative } from '../../@types/runes'
const punctuations = /[!"#\$%&'()*+-.\/:;<=>?@\[\\\]^`{|}~]/ const punctuations = /[!"#$%&'()*+-./:;<=>?@[\\\]^`{|}~]/
const hasPunctuation = (input) => punctuations.test(input) const hasPunctuation = (input) => punctuations.test(input)
@ -54,19 +54,21 @@ export class Alternative implements IAlternative {
return why(values[this.field].includes(this.value), this.field, `does not contain ${this.value}`) return why(values[this.field].includes(this.value), this.field, `does not contain ${this.value}`)
case '<': case '<':
case '>': case '>':
const actualInt = Number.parseInt(val) {
if (Number.isNaN(actualInt)) { const actualInt = Number.parseInt(val)
return why(false, this.field, 'not an integer field') if (Number.isNaN(actualInt)) {
} return why(false, this.field, 'not an integer field')
const restrictionVal = Number.parseInt(this.value) }
if (Number.isNaN(restrictionVal)) { const restrictionVal = Number.parseInt(this.value)
return why(false, this.field, 'not a valid integer') if (Number.isNaN(restrictionVal)) {
} return why(false, this.field, 'not a valid integer')
}
if (this.cond === '<') { if (this.cond === '<') {
return why(actualInt < restrictionVal, this.field, `>= ${restrictionVal}`) return why(actualInt < restrictionVal, this.field, `>= ${restrictionVal}`)
} else { } else {
return why(actualInt > restrictionVal, this.field, `<= ${restrictionVal}`) return why(actualInt > restrictionVal, this.field, `<= ${restrictionVal}`)
}
} }
case '{': case '{':
return why(val < this.value, this.field, `is the same or ordered after ${this.value}`) return why(val < this.value, this.field, `is the same or ordered after ${this.value}`)