Skip to content
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

feat: upgrade eslint to v9 #12268

Merged
merged 3 commits into from
May 29, 2024
Merged
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
5 changes: 5 additions & 0 deletions .changeset/young-monkeys-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-svelte": minor
---

feat: upgrade eslint to v9
18 changes: 0 additions & 18 deletions .eslintrc.json

This file was deleted.

21 changes: 21 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import svelte_config from '@sveltejs/eslint-config';

/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
...svelte_config,
{
rules: {
'@typescript-eslint/no-unused-expressions': 'off',
'no-undef': 'off'
}
},
{
ignores: [
'**/.svelte-kit',
'packages/adapter-static/test/apps/*/build',
'packages/adapter-cloudflare/files',
'packages/adapter-netlify/files',
'packages/adapter-node/files'
]
}
];
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@sveltejs/eslint-config": "^6.0.4",
"@sveltejs/eslint-config": "^7.0.1",
"@svitejs/changesets-changelog-github-compact": "^1.1.0",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"eslint": "^8.56.0",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.35.1",
"eslint-plugin-svelte": "^2.36.0",
"eslint-plugin-unicorn": "^53.0.0",
"playwright": "^1.41.0"
"playwright": "^1.41.0",
"typescript-eslint": "^8.0.0-alpha.20"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-netlify/src/edge.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function is_static_file(request) {

try {
file = decodeURIComponent(file);
} catch (err) {
} catch {
// ignore
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import js from '@eslint/js';
import ts from 'typescript-eslint';
import svelte from 'eslint-plugin-svelte';
import prettier from 'eslint-config-prettier';
import globals from 'globals';

/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs['flat/recommended'],
prettier,
...svelte.configs['flat/prettier'],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
}
},
{
files: ['**/*.svelte'],
languageOptions: {
parserOptions: {
parser: ts.parser
}
}
},
{
ignores: ['build/', '.svelte-kit/', 'dist/']
}
];

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import js from '@eslint/js';
import svelte from 'eslint-plugin-svelte';
import prettier from 'eslint-config-prettier';
import globals from 'globals';

/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
js.configs.recommended,
...svelte.configs['flat/recommended'],
prettier,
...svelte.configs['flat/prettier'],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
}
},
{
ignores: ['build/', '.svelte-kit/', 'dist/']
}
];
2 changes: 1 addition & 1 deletion packages/create-svelte/shared/+eslint+svelte5/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"devDependencies": {
"eslint-plugin-svelte": "^2.36.0-next.4"
"eslint-plugin-svelte": "^2.36.0"
}
}
30 changes: 0 additions & 30 deletions packages/create-svelte/shared/+eslint+typescript/.eslintrc.cjs

This file was deleted.

30 changes: 30 additions & 0 deletions packages/create-svelte/shared/+eslint+typescript/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import js from '@eslint/js';
import ts from 'typescript-eslint';
import svelte from 'eslint-plugin-svelte';
import globals from 'globals';

/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs['flat/recommended'],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
}
},
{
files: ['**/*.svelte'],
languageOptions: {
parserOptions: {
parser: ts.parser
}
}
},
{
ignores: ['build/', '.svelte-kit/', 'dist/']
}
];
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0"
"typescript-eslint": "^8.0.0-alpha.20"
}
}
15 changes: 0 additions & 15 deletions packages/create-svelte/shared/+eslint-typescript/.eslintrc.cjs

This file was deleted.

20 changes: 20 additions & 0 deletions packages/create-svelte/shared/+eslint-typescript/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import js from '@eslint/js';
import svelte from 'eslint-plugin-svelte';
import globals from 'globals';

/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
js.configs.recommended,
...svelte.configs['flat/recommended'],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
}
},
{
ignores: ['build/', '.svelte-kit/', 'dist/']
}
];
13 changes: 0 additions & 13 deletions packages/create-svelte/shared/+eslint/.eslintignore

This file was deleted.

7 changes: 4 additions & 3 deletions packages/create-svelte/shared/+eslint/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"devDependencies": {
"@types/eslint": "^8.56.0",
"eslint": "^8.56.0",
"eslint-plugin-svelte": "^2.35.1"
"@types/eslint": "^8.56.7",
"eslint": "^9.0.0",
"eslint-plugin-svelte": "^2.36.0",
"globals": "^15.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/enhanced-img/src/preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export function parseObject(str) {
.replaceAll(/,(\n\s*)?([^ ])/g, ',"$2');
try {
return JSON.parse(updated);
} catch (err) {
} catch {
throw new Error(`Failed parsing string to object: ${str}`);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/core/config/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ const options = object(

try {
origin = new URL(input).origin;
} catch (e) {
} catch {
throw new Error(`${keypath} must be a valid origin`);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/exports/vite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ async function resolve_peer_dependency(dependency) {
// @ts-expect-error the types are wrong
const resolved = await imr.resolve(dependency, pathToFileURL(process.cwd() + '/dummy.js'));
return import(resolved);
} catch (e) {
} catch {
throw new Error(
`Could not resolve peer dependency "${dependency}" relative to your project — please install it and try again.`
);
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/app/stores.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const updated = {
function get_store(name) {
try {
return getStores()[name];
} catch (e) {
} catch {
throw new Error(
`Cannot subscribe to '${name}' store on the server outside of a Svelte component, as it is bound to the current request via component context. This prevents state from leaking between users.` +
'For more information, see https://kit.svelte.dev/docs/state-management#avoid-shared-state-on-the-server'
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ async function load_nearest_error_page(i, branch, errors) {
universal: null
}
};
} catch (e) {
} catch {
continue;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/server/data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export function get_data_json(event, options, nodes) {
let str;
try {
str = devalue.stringify(value, reducers);
} catch (e) {
} catch {
const error = await handle_error_and_jsonify(
event,
options,
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/server/page/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ function get_data(event, options, nodes, global) {
let str;
try {
str = devalue.uneval({ id, data, error }, replacer);
} catch (e) {
} catch {
error = await handle_error_and_jsonify(
event,
options,
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/runtime/server/respond.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export async function respond(request, options, manifest, state) {
let rerouted_path;
try {
rerouted_path = options.hooks.reroute({ url: new URL(url) }) ?? url.pathname;
} catch (e) {
} catch {
return text('Internal Server Error', {
status: 500
});
Expand Down
Loading
Loading