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',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: ['plugin:@typescript-eslint/recommended'],
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
root: true,
env: {
node: true,

View File

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

View File

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

View File

@ -1,6 +1,6 @@
import { IAlternative } from '../../@types/runes'
const punctuations = /[!"#\$%&'()*+-.\/:;<=>?@\[\\\]^`{|}~]/
const punctuations = /[!"#$%&'()*+-./:;<=>?@[\\\]^`{|}~]/
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}`)
case '<':
case '>':
const actualInt = Number.parseInt(val)
if (Number.isNaN(actualInt)) {
return why(false, this.field, 'not an integer field')
}
const restrictionVal = Number.parseInt(this.value)
if (Number.isNaN(restrictionVal)) {
return why(false, this.field, 'not a valid integer')
}
{
const actualInt = Number.parseInt(val)
if (Number.isNaN(actualInt)) {
return why(false, this.field, 'not an integer field')
}
const restrictionVal = Number.parseInt(this.value)
if (Number.isNaN(restrictionVal)) {
return why(false, this.field, 'not a valid integer')
}
if (this.cond === '<') {
return why(actualInt < restrictionVal, this.field, `>= ${restrictionVal}`)
} else {
return why(actualInt > restrictionVal, this.field, `<= ${restrictionVal}`)
if (this.cond === '<') {
return why(actualInt < restrictionVal, this.field, `>= ${restrictionVal}`)
} else {
return why(actualInt > restrictionVal, this.field, `<= ${restrictionVal}`)
}
}
case '{':
return why(val < this.value, this.field, `is the same or ordered after ${this.value}`)