tree-sitter / tree-sitter-haskell

Haskell grammar for tree-sitter.
MIT License
157 stars 37 forks source link

use es6 to write a generator.js #132

Closed srghma closed 1 month ago

srghma commented 1 month ago

AFAIK its possible to rewrite generator.js on es6 and use import/export to improve type safety

I did it in https://github.com/postsolar/tree-sitter-purescript/pull/23 and in https://github.com/kayhide/tree-sitter-idris/pull/3

but I dont know that to replace require('.')

https://github.com/tree-sitter/tree-sitter-haskell/blob/70ea0757986ea58a0d39ddfcd9d791beadeb0f43/bindings/node/binding_test.js#L8

with

srghma commented 1 month ago

probably require("./index.cjs")

but now I have an error https://github.com/kayhide/tree-sitter-idris/pull/3#issuecomment-2434307473

and the configs of idris and haskell are identical

amaanq commented 1 month ago

ES6 is not supported, we cannot use it since we cannot declare the package as a module, and we cannot use it in standalone file mode until node 18 is EOL.

srghma commented 1 month ago

does it mean that it will become feasible to rewrite tree-sitter-haskell to es6 using .mjs extension at 30 Apr 2025?

https://endoflife.date/nodejs

amaanq commented 1 month ago

Yes.