Skip to content

Wrong type checking for reactive statments. #242

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
2 tasks done
mpiorowski opened this issue Aug 29, 2022 · 7 comments · Fixed by sveltejs/svelte-eslint-parser#204
Closed
2 tasks done

Wrong type checking for reactive statments. #242

mpiorowski opened this issue Aug 29, 2022 · 7 comments · Fixed by sveltejs/svelte-eslint-parser#204
Labels
invalid This doesn't seem right needs repro Need a repository that can reproduce the problem

Comments

@mpiorowski
Copy link

mpiorowski commented Aug 29, 2022

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.23.0

What version of eslint-plugin-svelte are you using?

2.7.0

What did you do?

Trying to write reactive statment with strcit typescript rule applied.

What did you expect to happen?

Working eslint code.

What actually happened?

Wrong typescript eslint.

Link to Minimal Reproducible Example

Hope photos will be enought:

image

image

And ofc if i delete the ? i got another error:

image

Additional comments

No response

@mpiorowski
Copy link
Author

Here's my eslint config

module.exports = {
  root: true,
  parser: '@typescript-eslint/parser',
  extends: [
    'eslint:recommended',
    'plugin:@typescript-eslint/recommended',
    'plugin:@typescript-eslint/eslint-recommended',
    'plugin:@typescript-eslint/recommended-requiring-type-checking',
    'plugin:@typescript-eslint/strict',
    'plugin:svelte/recommended',
  ],
  plugins: ['@typescript-eslint'],
  parser: '@typescript-eslint/parser',
  overrides: [
    {
      files: ['*.svelte'],
      parser: 'svelte-eslint-parser',
      parserOptions: {
        parser: '@typescript-eslint/parser',
      },
    },
  ],
  parserOptions: {
    tsconfigRootDir: __dirname,
    project: ['./tsconfig.json'],
    extraFileExtensions: ['.svelte'],
  },
  env: {
    browser: true,
    es2017: true,
    node: true,
  },
  rules: {
    '@typescript-eslint/no-shadow': ['error'],
    curly: ['warn'],
    'dot-notation': ['warn'],
    '@typescript-eslint/consistent-type-definitions': ['error', 'type'],
  },
};

@ota-meshi
Copy link
Member

Hope photos will be enought:

Not enough. Please always provide a repository.

@ota-meshi ota-meshi added needs repro Need a repository that can reproduce the problem invalid This doesn't seem right labels Aug 29, 2022
@mpiorowski
Copy link
Author

@ota-meshi ok, i used part of my lib to showcase the error.

https://github.com/mpiorowski/svelte-init/blob/test/src/routes/test.svelte

@mpiorowski
Copy link
Author

@ota-meshi another error is when using reactive assigment to variables, then eslint doesn't seems to see the value

image

It's working when i remove the ractive assigment:

image

@ota-meshi
Copy link
Member

ota-meshi commented Aug 29, 2022

Please always provide a repository and file to reproduce the issue.

@mpiorowski
Copy link
Author

@ota-meshi i added another example in the same file. You can check this error by switching "$:" to "let".

And thanks for the worka and fast response :)

https://github.com/mpiorowski/svelte-init/blob/test/src/routes/test.svelte

@ota-meshi
Copy link
Member

The second issue seems to be the same issue as the issue opened in the parser repo. Please track the following issue.

sveltejs/svelte-eslint-parser#206

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right needs repro Need a repository that can reproduce the problem
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants