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

feat: upgrade eslint to v9 #12268

merged 3 commits into from
May 29, 2024

Conversation

benmccann
Copy link
Member

@benmccann benmccann commented May 28, 2024

We tried before and had to rollback because typescript-eslint v7 was not compatible. Try again this time with a pre-release version, which seems to be quite stable. Otherwise we'd have to make all users wait another 2-4 months

Ref typescript-eslint/typescript-eslint#9141

Copy link

changeset-bot bot commented May 28, 2024

🦋 Changeset detected

Latest commit: f0dcf0d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
create-svelte Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@hyunbinseo
Copy link
Contributor

I have read the typescript-eslint issue and understand that the beta release is 'behaviorally stable'.

but it still feels weird to have an alpha dependency in the official template.

Would pnpm update upgrade 8.0.0-alpha.20 to 8.0.0 once it is officially released?

@benmccann
Copy link
Member Author

Yeah, it is a bit weird. But it's much easier for users to just upgrade that one package than to do the whole migration from eslint v8

@hyunbinseo
Copy link
Contributor

hyunbinseo commented May 30, 2024

Migration Guide

For Prettier users, you can reference this diff.

  1. ESLint v9's default config is flat config, and this is used. Release Note
  2. (Optional) typescript-eslint package that uses the flat config has a different package name. Release Note
- "@typescript-eslint/eslint-plugin": "^7.10.0",
- "@typescript-eslint/parser": "^7.10.0",
+ "typescript-eslint": "8.0.0-alpha.20",
# JavaScript
pnpm i eslint@9 globals@latest -D

# TypeScript
pnpm i eslint@9 globals@latest typescript-eslint@rc-v8 -D
pnpm rm @typescript-eslint/eslint-plugin @typescript-eslint/parser
  1. Legacy ESLint config should be removed, and a new flat config should be added.
+ eslint.config.js
- .eslintrc.cjs
- .eslintignore # The ignore file should be removed!

The content of the config files differs based on (TypeScript, Prettier) installation.

Reference the Files changed tab in this PR.

@niemyjski
Copy link

I upgraded my ts app following these changes and now I'm seeing lots of errors around generics

7:29 error 'T' is not defined no-undef
8:16 error 'T' is not defined no-undef

<script lang="ts" generics="T">
  import type { Snippet } from 'svelte';
  import type { HTMLAttributes } from 'svelte/elements';
  import { cn } from '$lib/utils';

  type Props = HTMLAttributes<Element> & {
      children?: Snippet<[T]>;
      items: T[];
  };

8:18 error '$$Generic' is not defined no-undef

<script lang="ts">
 import IconViewColumn from '~icons/mdi/view-column';
 import { Button } from '$comp/ui/button';
 import * as DropdownMenu from '$comp/ui/dropdown-menu';

 import type { Table } from '@tanstack/svelte-table';

 type TData = $$Generic;
 export let table: Table<TData>;
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants