Giter Site home page Giter Site logo

Comments (5)

ota-meshi avatar ota-meshi commented on May 18, 2024

Thank you for posting the issue.

I already know the problem.
I'm doing an experiment to solve the problem.

https://github.com/ota-meshi/typescript-eslint-parser-for-extra-files

At least I have it working in my project.
https://github.com/ota-meshi/eslint-plugin-promise-playground/blob/4efb3d094056a45f87a86a4a2bc463d5ba9e9a9d/src/lib/eslint/ESLintEditor.svelte#L25-L29

If you are interested in it, please try it and give us feedback.
(I haven't tried it, but it might work in combination with eslint-plugin-svelte3.)

from eslint-plugin-svelte.

ptrxyz avatar ptrxyz commented on May 18, 2024

Oh yes, that seems to do it. Thanks a bunch!

Any chance you also have an idea why x.doesNotExist does not raise an error? Obviously the prop does not exist yet neither ESlint nor Typescript seem to care. Did I miss something? Is there a rule for that?

from eslint-plugin-svelte.

ota-meshi avatar ota-meshi commented on May 18, 2024

I think it's because all default imported classes from *.svelte files are of type SvelteComponentDev.

https://github.com/sveltejs/svelte/blob/master/src/runtime/ambient.ts

from eslint-plugin-svelte.

ptrxyz avatar ptrxyz commented on May 18, 2024

I think it's because all default imported classes from *.svelte files are of type SvelteComponentDev.

https://github.com/sveltejs/svelte/blob/master/src/runtime/ambient.ts

Ok, thanks. I know, this is not in the scope of this issue, but I am really lost on this. Do you know/could point me to something on how to properly type the component to make TS raise an error when I try to access an undefined member?

from eslint-plugin-svelte.

ota-meshi avatar ota-meshi commented on May 18, 2024

You can try the typescript-eslint-parser-for-extra-files.
https://github.com/ota-meshi/typescript-eslint-parser-for-extra-files

This is a project for passing proper types to @typescript-eslint for *.svelte etc.

from eslint-plugin-svelte.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.