Add support for svelte-eslint-parser and TS module declarations
marekdedic opened this issue · comments
Hi,
this plugin unfortunately doesn't work with svelte-eslint-parser - I tried opening an issue on their side, but from the response I gather that this needs to be fixed in esplint-plugin-simple-import sort: sveltejs/eslint-plugin-svelte#339. Could this please be fixed?
I am aware of #71 but that is a different parser and the fix does not apply.
Hi! Thanks for the report!
Note to self: sveltejs/eslint-plugin-svelte#199 (comment)
Need to visit SvelteScriptElement
and TSModuleBlock
and possibly something more. Or: Visit everything and try to sort imports in it.
eslint-plugin-simple-import-sort/src/imports.js
Lines 55 to 57 in 12a8227
Edit: Or, visit all ImportDeclaration
and keep track of their parents. Then, in "Program:exit"
, go through all the parents and do the sorting on each. Note: Also for ExportNamedDeclaration
and ExportAllDeclaration
.
@marekdedic Can you try npm install eslint-plugin-simple-import-sort@beta
and see if it works with your Svelte setup?
I can confirm that it works with my setup - I have only imports. I have tried both reporting and autofixing.
Released in v9.0.0.