Skip to content
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

WebAssembly! #134

Open
jimmywarting opened this issue Dec 8, 2021 · 1 comment
Open

WebAssembly! #134

jimmywarting opened this issue Dec 8, 2021 · 1 comment

Comments

@jimmywarting
Copy link

jimmywarting commented Dec 8, 2021

This looks like a cool project. finally some fresh tool built up from scratch that flesh out some of eslint's old codebase with inherently old and many deprecated api's and limited to support older NodeJS versions with a bunch of polyfills and bloatware.

Now I would like to use this for scripting purpose to automate things... that means i would like to

  • A) Set the config via some method
  • B) Manually add a way for the RSlint to read files from any arbitrary filesystem, weather it be, node's fs, deno, browser's filesystem access or any memfs. as long as it is generic to work in any environment

ESLint had two ways to lint files with scripting, one was to lint one single file/string manually, but this would not go into the depth of reading other files and warn about things such as "module x don't export a default function y from module xyz" cuz it had no correlation to the file path or a filesystem. So the other option was to use eslint.lintFiles('*.js')...

I absolutely don't know anything about rust but i hear so much hype around it, that i wish to learn it someday.
but right now i just wish you could support me with a WebAssembly module

i wish i could do something like:

const RSLint = await WebAssembly.compileStreaming(fetch('rslint.wasm'))

const linter = new RSLint({
    async read (path) {
        return 'var x = 1;' // or blob.text()
    },
    fix: true,
    rules: {
        "no-var": "error"
    }
})

const result = await linter.lint([
    '/test.js',
    '/foo/test2.js'
])

or something like it...

ESLint is incredibly tightly coupled to node's core modules that makes it bad to use in any other environment that otherwise require files to be read asynchronous. or function in any other environment


bonus point if it can use web workers for multi threading

@Stupremee
Copy link
Member

Thank you for your feedback!

I really like the idea of abstracting away everything I/O related to support no_std, virtual file systems and other stuff and it's definitely on my priority list when I continue to work on RSLint again.

However, I do not have much time for RSLint right now so it might take while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants