Skip to content

Commit e9771e5

Browse files
chore(deps): update devdependency eslint to v9 (#36)
* chore(deps): update devdependency eslint to v9 * chore: update dependencies * chore: add eslint config, run lint:fix --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Gugustinette <[email protected]>
1 parent cce6d0a commit e9771e5

File tree

18 files changed

+626
-841
lines changed

18 files changed

+626
-841
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// @ts-check
2+
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
3+
4+
export default createConfigForNuxt({
5+
features: {
6+
stylistic: true,
7+
tooling: true,
8+
},
9+
dirs: {
10+
src: ['src'],
11+
},
12+
})
13+
.append({
14+
ignores: ['node_modules', 'dist', 'playground', 'docs'],
15+
})
16+
.override('nuxt/typescript/rules', {
17+
rules: {
18+
// Required while Leaflet's types are not updated
19+
'@typescript-eslint/no-explicit-any': 'off',
20+
},
21+
})
22+
.override('nuxt/vue/rules', {
23+
rules: {
24+
'vue/multi-word-component-names': 'off',
25+
},
26+
})

package-lock.json

Lines changed: 525 additions & 762 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
3030
"release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
3131
"lint": "eslint .",
32+
"lint:fix": "eslint . --fix",
3233
"test": "vitest run",
3334
"test:watch": "vitest watch",
3435
"docs:dev": "vitepress dev docs",
@@ -53,7 +54,7 @@
5354
"@typescript-eslint/eslint-plugin": "^8.0.0",
5455
"caniuse-lite": "^1.0.30001649",
5556
"changelogen": "^0.5.5",
56-
"eslint": "^8.57.0",
57+
"eslint": "^9.8.0",
5758
"leaflet.heat": "^0.2.0",
5859
"leaflet.markercluster": "^1.5.3",
5960
"nuxt": "^3.12.4",

src/module.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { defineNuxtModule, addComponent, createResolver, addImports } from '@nux
22

33
// Module options TypeScript interface definition
44
export interface ModuleOptions {
5-
markerCluster?: boolean,
5+
markerCluster?: boolean
66
heat?: boolean
77
}
88

@@ -28,20 +28,20 @@ export const components = [
2828
'LRectangle',
2929
'LTileLayer',
3030
'LTooltip',
31-
'LWmsTileLayer'
31+
'LWmsTileLayer',
3232
]
3333

3434
export default defineNuxtModule<ModuleOptions>({
3535
meta: {
3636
name: 'nuxt-leaflet',
3737
configKey: 'leaflet',
3838
compatibility: {
39-
nuxt: '>=3.0.0'
40-
}
39+
nuxt: '>=3.0.0',
40+
},
4141
},
4242
// Default configuration options of the Nuxt module
4343
defaults: {},
44-
async setup (options, nuxt) {
44+
async setup(options, nuxt) {
4545
// Create a resolver for the module
4646
const resolver = createResolver(import.meta.url)
4747

@@ -55,7 +55,7 @@ export default defineNuxtModule<ModuleOptions>({
5555
export: component,
5656
filePath: '@vue-leaflet/vue-leaflet',
5757
chunkName: `nuxt-leaflet/${component}`,
58-
mode: 'all'
58+
mode: 'all',
5959
})
6060
}
6161

@@ -69,7 +69,7 @@ export default defineNuxtModule<ModuleOptions>({
6969
addImports({
7070
name: 'useLMarkerCluster',
7171
as: 'useLMarkerCluster',
72-
from: resolver.resolve('runtime/composables/useLMarkerCluster')
72+
from: resolver.resolve('runtime/composables/useLMarkerCluster'),
7373
})
7474
}
7575

@@ -79,8 +79,8 @@ export default defineNuxtModule<ModuleOptions>({
7979
addImports({
8080
name: 'useLHeat',
8181
as: 'useLHeat',
82-
from: resolver.resolve('runtime/composables/useLHeat')
82+
from: resolver.resolve('runtime/composables/useLHeat'),
8383
})
8484
}
85-
}
85+
},
8686
})
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
// L can be loaded here as the composable should be loaded client-side only
2-
import L from 'leaflet';
3-
import type { Map } from 'leaflet';
2+
import L from 'leaflet'
3+
import type { Map } from 'leaflet'
44

55
interface HeatPoint {
6-
lat: number;
7-
lng: number;
8-
intensity: number;
6+
lat: number
7+
lng: number
8+
intensity: number
99
}
1010

1111
interface Props {
12-
leafletObject: Map;
13-
heatPoints: HeatPoint[];
14-
radius?: number;
12+
leafletObject: Map
13+
heatPoints: HeatPoint[]
14+
radius?: number
1515
}
1616

1717
export const useLHeat = async (props: Props) => {
1818
// Lazy-load leaflet.heat
1919
// Importing it at the top level will cause errors because it could be loaded before the Leaflet library
20-
await import('leaflet.heat');
20+
await import('leaflet.heat')
2121

2222
const heat = L.heatLayer(
23-
props.heatPoints.map((point) => [point.lat, point.lng, point.intensity]),
24-
{radius: props.radius || 50}
25-
);
23+
props.heatPoints.map(point => [point.lat, point.lng, point.intensity]),
24+
{ radius: props.radius || 50 },
25+
)
2626

2727
// Add the heat layer to the map
28-
props.leafletObject.addLayer(heat);
28+
props.leafletObject.addLayer(heat)
2929

3030
// Return the heat layer
31-
return heat;
31+
return heat
3232
}
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
import type { MarkerOptions, Map } from 'leaflet';
1+
import type { MarkerOptions, Map } from 'leaflet'
22

33
interface MarkerProps {
4-
name?: string;
5-
lat: number;
6-
lng: number;
7-
options?: MarkerOptions;
4+
name?: string
5+
lat: number
6+
lng: number
7+
options?: MarkerOptions
88
}
99

1010
interface Props {
11-
leafletObject: Map;
12-
markers: MarkerProps[];
11+
leafletObject: Map
12+
markers: MarkerProps[]
1313
}
1414

1515
export const useLMarkerCluster = async (props: Props) => {
1616
// Get Leaflet from the window object
17-
const L = window.L;
17+
const L = window.L
1818

1919
// Lazy-load leaflet.markercluster
2020
// Importing it at the top level will cause errors because it could be loaded before the Leaflet library
21-
const { MarkerClusterGroup } = await import('leaflet.markercluster');
21+
const { MarkerClusterGroup } = await import('leaflet.markercluster')
2222

2323
// Initialize marker cluster
24-
const markerCluster = new MarkerClusterGroup();
24+
const markerCluster = new MarkerClusterGroup()
2525

2626
// For each marker in props
2727
props.markers.forEach((location: any) => {
2828
// Create a Leaflet marker
2929
const marker = L.marker([location.lat, location.lng], {
3030
title: location.name,
3131
...location.options,
32-
});
32+
})
3333

3434
// Add the marker to the cluster
35-
markerCluster.addLayer(marker);
36-
});
35+
markerCluster.addLayer(marker)
36+
})
3737

3838
// Add the marker cluster to the map
39-
props.leafletObject.addLayer(markerCluster);
39+
props.leafletObject.addLayer(markerCluster)
4040
}

src/types/dev-types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
* Leaflet Markercluster module declaration
33
*/
44
declare module 'leaflet.markercluster' {
5-
export const MarkerClusterGroup: any;
5+
export const MarkerClusterGroup: any
66
}

test/basic.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { describe, it, expect } from 'vitest'
21
import { fileURLToPath } from 'node:url'
2+
import { describe, it, expect } from 'vitest'
33
import { setup, $fetch } from '@nuxt/test-utils'
44

55
describe('nuxt leaflet', async () => {

0 commit comments

Comments
 (0)