Skip to content

feat: set languageOptions.globals in base config #1038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/eslint-plugin-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"@jridgewell/sourcemap-codec": "^1.5.0",
"eslint-compat-utils": "^0.6.4",
"esutils": "^2.0.3",
"globals": "^15.14.0",
"known-css-properties": "^0.35.0",
"postcss": "^8.4.49",
"postcss-load-config": "^3.1.4",
Expand Down
11 changes: 10 additions & 1 deletion packages/eslint-plugin-svelte/src/configs/flat/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This file has been automatically generated,
// in order to update its content execute "pnpm run update"
import type { ESLint, Linter } from 'eslint';
import globals from 'globals';
import * as parser from 'svelte-eslint-parser';
let pluginObject: ESLint.Plugin | null = null;
export function setPluginObject(plugin: ESLint.Plugin): void {
Expand All @@ -14,13 +15,21 @@ const config: Linter.Config[] = [
get svelte(): ESLint.Plugin {
return pluginObject!;
}
},
languageOptions: {
globals: {
...globals.browser
}
}
},
{
name: 'svelte:base:setup-for-svelte',
files: ['*.svelte', '**/*.svelte'],
languageOptions: {
parser
parser,
globals: {
...globals.browser
}
},
rules: {
// ESLint core rules known to cause problems with `.svelte`.
Expand Down
9 changes: 9 additions & 0 deletions packages/eslint-plugin-svelte/tools/update-rulesets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const baseContent = `/*
* in order to update its content execute "pnpm run update"
*/
import type { ESLint, Linter } from 'eslint';
import globals from 'globals';
import * as parser from 'svelte-eslint-parser';
let pluginObject: ESLint.Plugin | null = null;
export function setPluginObject(plugin: ESLint.Plugin): void {
Expand All @@ -27,12 +28,20 @@ const config: Linter.Config[] = [
return pluginObject!;
}
},
languageOptions: {
globals: {
...globals.browser
},
},
},
{
name: 'svelte:base:setup-for-svelte',
files: ["*.svelte", "**/*.svelte"],
languageOptions: {
parser: parser,
globals: {
...globals.browser
},
},
rules: {
// ESLint core rules known to cause problems with \`.svelte\`.
Expand Down