-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Enhancement: Publish browser-compatible TS ESLint package? #10808
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
Comments
Caveat -- we've "solved this" specifically in a way that works in our playground. This isn't a good way to solve this or even a scalable way to solve it -- much of the "solving" involves us purely mocking out any of our internals that touch NodeJS APIs. One of the reasons we hack around like this is because we have all the tabs on our playground to allow us to inspect our internals and TS's internals. What we've done is by far NOT what should be done by others. Instead one should be looking to more holistically mock out the NodeJS APIs themselves so that all of the ESLint ecosystem can "just work". For example this is what you will see "VSCode Web" or "Code Sandbox" or other such browser IDEs do. In an ideal world -- yeah, this is something we could consider to make it easy for people to embed our tooling without any effort. But in our current state I just don't we don't have the bandwidth to consider taking on such a workload. Thoughts @typescript-eslint/triage-team |
@bradzacher Thanks for the feedback, its clear and I respect completely your bandwidth. Your giving a sense of magnitude of doing this "properly" is also useful!
Good point, they've apparently also crossed this bridge. Overall, I did and continue to wonder why ESLint went down a path of being coupled to Node APIs, like TS has done which is even more complex of a tool. |
Well, they have two areas of APIs:
TypeScript also abstracts away system APIs. It runs well on Node.js by default but can be made to run fully virtually: https://www.typescriptlang.org/dev/typescript-vfs. We've been interested in moving to that VFS for tests for a while: #1891 |
The problem with decoupling from nodejs APIs is that often means that you can't use 3rd party dependencies for things and instead have to write your own code or fork something. For example we rely on a 3rd party dependency to do globbing - which requires the node FS API to iterate the disk. This sort of behaviour falls over when you move to the browser - what does it mean to "glob the file system" if there is no file system? Browser IDEs usually have a VFS which allows them to create and maintain the folder structure - and in using a VFS they also usually reimplement the node FS API. Ultimately though it depends on usecases and cost/value trade-offs. If 99.99% of usecases are in a NodeJS-like environment - then spending time making the code nodejs agnostic isn't hugely valuable. |
Is there a proposal to ESLint to make them web-compatible, to the extent of having a reusable ESLint playground that you can attach plugins to? I think we shouldn't concern us about infra more than a typical ESLint plugin should do. |
Indeed, this isn't something we're in a good place to support. If you're interested in taking this on then I think the right next steps would be #1891 to prove out running typed linting in a VFS. But, regardless of how that goes, we definitely don't have the bandwidth to set up an ESLint VFS + browser solution ourselves (as much as we would love to!). That task would just be something we could give advice to if you want to ask us in our Discord / ping us on an ESLint RFC. Thanks for asking! Closing out as out-of-scope for typescript-eslint itself. |
Thanks for the thoughtful responses all! |
Before You File a Proposal Please Confirm You Have Done The Following...
Relevant Package
website
My proposal is suitable for this project
Description
I recently inquired about the Website Playground in #10798. Since then, after more review of the codebase, I believe there is too much application code for us to try and recreate for our own product. While we clearly don't need the whole playground itself, we do need a way to easily execute ESLint+TS ESLint validation over editor contents. This core functionality seems not available in the ecosystem right now, but is achieved on your website. How feasible would it be to have that core distributed on npm for others to consume? I appreciate the fact that I am asking about something which partially implicates an unrelated projects which is ESLint itself, and perhaps its that project which should ideally lead with a browser compatible package. I'm not sure what makes most sense for TS ESLint, but given you already solved this, maybe its not a stretch to publish that solution/tweaked solution for others.
Thanks for any consideration :)
(and great projects thanks all :))
Additional Info
No response
The text was updated successfully, but these errors were encountered: