Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
What version of ESLint are you using?
^8.44.0
What version of eslint-plugin-svelte
are you using?
^2.32.2
What did you do?
Configuration
module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/strict',
'plugin:svelte/recommended',
'plugin:svelte/prettier',
'prettier',
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
project: './tsconfig.eslint.json',
extraFileExtensions: ['.svelte'],
},
env: {
browser: true,
es2017: true,
node: true,
},
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
},
},
],
rules: {
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/default-param-last': 'error',
'@typescript-eslint/method-signature-style': 'error',
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/promise-function-async': ['error', { checkArrowFunctions: false }],
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/return-await': 'error',
'@typescript-eslint/sort-type-constituents': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
// SvelteKit uses that for returning errors in routes
'@typescript-eslint/no-throw-literal': 'off',
// Receiving markdown from the API
'svelte/no-at-html-tags': 'off',
},
}
<script lang="ts">
import type { CommunityView } from 'lemmy-js-client'
export let community: Promise<CommunityView>
export let followCommunity: (follow: boolean) => Promise<void>
</script>
{#await community}
<button class="rounded-full bg-surface px-4 py-2 text-on-surface">Loading...</button>
{:then community}
{#if community.subscribed === 'NotSubscribed'}
<button
class="rounded-full border-surface-container bg-surface-container px-4 py-2 text-on-surface-container hover:bg-surface hover:text-on-surface"
on:click={() => followCommunity(true)}
>
Join
</button>
{/if}
{/await}
What did you expect to happen?
Linting should pass
What actually happened?
/home/nato/Code/github.com/NatoBoram/Leanish/src/lib/SubscribeButton.svelte
11:7 error Unsafe member access .subscribed on an `any` value @typescript-eslint/no-unsafe-member-access
✖ 1 problem (1 error, 0 warnings)
Link to GitHub Repo with Minimal Reproducible Example
https://github.com/NatoBoram/bug-report-terrtc/commit/8c5c4c89aa1bb4e0a86cc8ef05c90b14dd7a53f5 (Deleted)
Additional comments
This happens when plugin:@typescript-eslint/recommended-requiring-type-checking
is enabled
I think this can be worked around by changing the name of the variable after :then
Metadata
Metadata
Assignees
Labels
No labels