Skip to content

Commit

Permalink
Merge pull request #734 from devoxa/renovate/devoxa-eslint-config-4.x
Browse files Browse the repository at this point in the history
Update dependency @devoxa/eslint-config from 3.0.11 to 4.0.0
  • Loading branch information
kodiakhq[bot] authored Dec 5, 2024
2 parents 1a2bac5 + 1a51c1b commit 060d646
Show file tree
Hide file tree
Showing 4 changed files with 1,014 additions and 577 deletions.
5 changes: 5 additions & 0 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const config = require('@devoxa/eslint-config')

module.exports = config({
ignoreFiles: ['.gitignore'],
})
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,23 @@
"test": "jest",
"format": "prettier --ignore-path='.gitignore' --list-different --write .",
"format:check": "prettier --ignore-path='.gitignore' --check .",
"lint": "eslint --ignore-path='.gitignore' '{src,tests}/**/*.ts'",
"lint": "eslint '{src,tests}/**/*.ts'",
"build": "rm -rf dist/ && tsc",
"preversion": "yarn build",
"postinstall": "node scripts/postinstall.js"
},
"eslintConfig": {
"extends": "@devoxa"
},
"prettier": "@devoxa/prettier-config",
"dependencies": {
"mmdb-lib": "2.1.1"
},
"devDependencies": {
"@devoxa/eslint-config": "3.0.11",
"@devoxa/eslint-config": "4.0.0",
"@devoxa/prettier-config": "2.0.3",
"@swc/core": "1.10.0",
"@swc/jest": "0.2.37",
"@types/jest": "29.5.14",
"@types/node": "20.9.5",
"eslint": "8.57.1",
"eslint": "9.16.0",
"jest": "29.7.0",
"prettier": "3.4.2",
"typescript": "5.7.2"
Expand Down
10 changes: 9 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ import fs from 'fs/promises'
import { Reader } from 'mmdb-lib'
import path from 'path'

interface MmdbResult {
continent: { code: string; names: { en: string } }
country: { iso_code: string; names: { en: string }; is_in_european_union: boolean }
subdivisions: Array<{ names: { en: string } }>
city: { names: { en: string } }
location: { latitude: number; longitude: number }
}

export interface GeolocateIpResult {
continent: { code: string; name: string }
country: { code: string; name: string; isInEuropeanUnion: boolean }
Expand All @@ -16,7 +24,7 @@ export async function geolocateIp(ip: string): Promise<GeolocateIpResult | null>
const databaseBuffer = await fs.readFile(DB_FILE_PATH)

const reader = new Reader(databaseBuffer)
const result = reader.get(ip) as any // eslint-disable-line @typescript-eslint/no-explicit-any
const result = reader.get(ip) as MmdbResult | null

if (!result) {
return null
Expand Down
Loading

0 comments on commit 060d646

Please sign in to comment.