Skip to content

Commit 2c62af9

Browse files
chore: add globals
1 parent f16729f commit 2c62af9

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

packages/eslint-plugin-svelte/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"@jridgewell/sourcemap-codec": "^1.5.0",
6161
"eslint-compat-utils": "^0.6.4",
6262
"esutils": "^2.0.3",
63+
"globals": "^15.14.0",
6364
"known-css-properties": "^0.35.0",
6465
"postcss": "^8.4.49",
6566
"postcss-load-config": "^3.1.4",

packages/eslint-plugin-svelte/src/configs/flat/base.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// This file has been automatically generated,
33
// in order to update its content execute "pnpm run update"
44
import type { ESLint, Linter } from 'eslint';
5+
import globals from 'globals';
56
import * as parser from 'svelte-eslint-parser';
67
let pluginObject: ESLint.Plugin | null = null;
78
export function setPluginObject(plugin: ESLint.Plugin): void {
@@ -14,13 +15,21 @@ const config: Linter.Config[] = [
1415
get svelte(): ESLint.Plugin {
1516
return pluginObject!;
1617
}
18+
},
19+
languageOptions: {
20+
globals: {
21+
...globals.browser
22+
}
1723
}
1824
},
1925
{
2026
name: 'svelte:base:setup-for-svelte',
2127
files: ['*.svelte', '**/*.svelte'],
2228
languageOptions: {
23-
parser
29+
parser,
30+
globals: {
31+
...globals.browser
32+
}
2433
},
2534
rules: {
2635
// ESLint core rules known to cause problems with `.svelte`.

packages/eslint-plugin-svelte/tools/update-rulesets.ts

+9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const baseContent = `/*
1414
* in order to update its content execute "pnpm run update"
1515
*/
1616
import type { ESLint, Linter } from 'eslint';
17+
import globals from 'globals';
1718
import * as parser from 'svelte-eslint-parser';
1819
let pluginObject: ESLint.Plugin | null = null;
1920
export function setPluginObject(plugin: ESLint.Plugin): void {
@@ -27,12 +28,20 @@ const config: Linter.Config[] = [
2728
return pluginObject!;
2829
}
2930
},
31+
languageOptions: {
32+
globals: {
33+
...globals.browser
34+
},
35+
},
3036
},
3137
{
3238
name: 'svelte:base:setup-for-svelte',
3339
files: ["*.svelte", "**/*.svelte"],
3440
languageOptions: {
3541
parser: parser,
42+
globals: {
43+
...globals.browser
44+
},
3645
},
3746
rules: {
3847
// ESLint core rules known to cause problems with \`.svelte\`.

0 commit comments

Comments
 (0)