Skip to content

Commit d438a70

Browse files
renovate[bot]renovate-botbeeequeue
authored
Update dependency @beequeue/eslint-plugin to v0.2.0 (#418)
Co-authored-by: Renovate Bot <bot@renovateapp.com> Co-authored-by: Adam <adam@haglund.dev>
1 parent 079b37f commit d438a70

File tree

9 files changed

+206
-171
lines changed

9 files changed

+206
-171
lines changed

.eslintrc.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@ module.exports = {
1111
'plugin:@beequeue/prettier',
1212
],
1313
rules: {
14-
'prettier/prettier': 'off',
15-
'import/no-named-as-default-member': 'off',
14+
'import/no-named-as-default': 'off',
1615
},
17-
overrides: [
18-
{
19-
files: ['!pages/**/*.tsx', '**/*.stories.tsx'],
20-
rules: {
21-
'import/no-default-export': 'off',
22-
},
23-
},
24-
],
2516
}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ Invalid HTTP requests have been deprecated.
6868
They will have a 33% chance to respond with a `400`, with a message detailing this deprecation.
6969

7070
i.e:
71+
7172
- Sending JSON bodies in `GET` requests
72-
- Sending query parameters in `POST` requests
73+
- Sending query parameters in `POST` requests
7374

7475
#### 2020-12-27
7576

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"typescript": "4.2.4"
5050
},
5151
"devDependencies": {
52-
"@beequeue/eslint-plugin": "0.1.3",
52+
"@beequeue/eslint-plugin": "0.2.0",
5353
"@tsconfig/node14": "1.0.0",
5454
"@types/jest": "26.0.23",
5555
"@types/koa": "2.13.1",

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { Logger } from '@/lib/logger'
55
import { App } from './app'
66
import { updateRelations } from './update'
77

8-
const { NODE_ENV } = process.env
9-
const port = process.env.PORT ?? 3000
8+
const { NODE_ENV, PORT } = process.env
9+
const port = PORT ?? 3000
1010

1111
const runUpdateScript = () => updateRelations().catch(captureException)
1212

src/routes/handlers/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ export const sourceArray = (enumToArray(Source) as unknown) as string[]
1313

1414
export const idSchema = Joi.number()
1515
.min(0)
16-
.max(2147483647)
16+
.max(2_147_483_647)
1717
.precision(0)
1818
.required()

src/routes/handlers/json-body.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export const bodyHandler = async (
4141
// Get relations
4242
relations = await knex
4343
.where(function () {
44-
// eslint-disable-next-line @typescript-eslint/no-misused-promises
45-
input.forEach((item) => this.orWhere(item))
44+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
45+
for (const item of input) this.orWhere(item)
4646
})
4747
.from('relations')
4848

src/update.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ const regexes = {
4545
const formatEntry = (entry: OfflineDatabaseSchema): Relation => {
4646
const relation: Relation = {}
4747

48-
entry.sources.forEach((src) => {
48+
for (const src of entry.sources) {
4949
const anilistMatch = regexes.anilist.exec(src)
5050
if (anilistMatch) {
5151
const id = Number(anilistMatch[1])
5252

53-
if (isNaN(id)) throw new Error(`${src}'s ID is not a number!!`)
53+
if (Number.isNaN(id)) throw new Error(`${src}'s ID is not a number!!`)
5454

5555
relation.anilist = id
5656
}
@@ -59,7 +59,7 @@ const formatEntry = (entry: OfflineDatabaseSchema): Relation => {
5959
if (anidbMatch) {
6060
const id = Number(anidbMatch[1])
6161

62-
if (isNaN(id)) throw new Error(`${src}'s ID is not a number!!`)
62+
if (Number.isNaN(id)) throw new Error(`${src}'s ID is not a number!!`)
6363

6464
relation.anidb = id
6565
}
@@ -68,7 +68,7 @@ const formatEntry = (entry: OfflineDatabaseSchema): Relation => {
6868
if (malMatch) {
6969
const id = Number(malMatch[1])
7070

71-
if (isNaN(id)) throw new Error(`${src}'s ID is not a number!!`)
71+
if (Number.isNaN(id)) throw new Error(`${src}'s ID is not a number!!`)
7272

7373
relation.myanimelist = id
7474
}
@@ -77,11 +77,11 @@ const formatEntry = (entry: OfflineDatabaseSchema): Relation => {
7777
if (kitsuMatch) {
7878
const id = Number(kitsuMatch[1])
7979

80-
if (isNaN(id)) throw new Error(`${src}'s ID is not a number!!`)
80+
if (Number.isNaN(id)) throw new Error(`${src}'s ID is not a number!!`)
8181

8282
relation.kitsu = id
8383
}
84-
})
84+
}
8585

8686
return relation
8787
}
@@ -113,8 +113,8 @@ export const updateRelations = async () => {
113113
knex.batchInsert('relations', formattedEntries, 100).transacting(trx),
114114
),
115115
)
116-
} catch (e) {
117-
throw new Error(e)
116+
} catch (error) {
117+
throw new Error(error)
118118
}
119119
Logger.info('Updated database.')
120120

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ export const isEmpty = <
88
obj: T,
99
) => {
1010
if (Array.isArray(obj)) {
11-
return obj.length < 1
11+
return obj.length === 0
1212
}
1313

14-
return Object.keys(obj).length < 1
14+
return Object.keys(obj).length === 0
1515
}

0 commit comments

Comments
 (0)