eslint-plugin-svelte3
eslint-plugin-svelte3 copied to clipboard
vanilla setup doesn't enable type aware linting
Global types and custom declarations aren't being detected during lint.
// src/global.d.ts
/// <reference types="@sveltejs/kit" />
declare interface CustomGlobalType {
id: number;
name: string;
}
<!-- src/index.svelte -->
<script lang="ts">
const onClick: svelte.JSX.MouseEventHandler<HTMLButtonElement> = (evt) => {
const object: CustomGlobalType = { id: 0, name: evt.currentTarget.innerText };
alert(JSON.stringify(object));
};
</script>
<button on:click={onClick}>Click Me</button>
Running npm run lint yields the following errors:

Repro: https://github.com/jemhuntr/svelte-type-aware-eslint
Project has been created with the most minimal setup possible.
npm init svelte@next svelte-type-aware-eslint
√ Which Svelte app template? » Skeleton project
√ Use TypeScript? ... No / Yes
√ Add ESLint for code linting? ... No / Yes
√ Add Prettier for code formatting? ... No / Yes
npm install --save-dev eslint-plugin-svelte3
Modified eslintrc based on README documentation, and made some small formatting/linting tweaks to fix lint errors ootb.
I'm currently having the same exact issue. Would love to know if anyone has figured this out.