Shahryar
Shahryar
SDSWC Developers
Created by Shahryar on 1/12/2025 in #questions
Emitter in SWC does not add expected space after '=>' in Arrow Functions
Hello friends, I am new to rust and SWC, I hope I am not wasting your time 🥹🙏🏻 I edited with extra space.
// This is first test we need to have
console.log("We are here");
// This is another comment
const add = () => {
// This is inner content
return "Test" + "Test";
};


const min = () => {return "Test" + "Test"};
// This is first test we need to have
console.log("We are here");
// This is another comment
const add = () => {
// This is inner content
return "Test" + "Test";
};


const min = () => {return "Test" + "Test"};
Now I want to edit the add to adds, I is more than 2000 character and discord dose not let me send the code, so I put it in gist: https://gist.github.com/shahryarjb/6f314fa7fab85fb09751bb8146c919f3 My problem is it returns
// This is first test we need to have
console.log("We are here");
// This is another comment
const adds = ()=>{
// This is inner content
return "Shahryar" + "Tavakkoli";
};
const min = ()=>{
return "Shahryar" + "Tavakkoli";
};
// This is first test we need to have
console.log("We are here");
// This is another comment
const adds = ()=>{
// This is inner content
return "Shahryar" + "Tavakkoli";
};
const min = ()=>{
return "Shahryar" + "Tavakkoli";
};
but I need to have an space after => and before{} like this
const adds = () => {
// This is inner content
return "Test" + "Test";
};
const adds = () => {
// This is inner content
return "Test" + "Test";
};
how can do it? Thank you in advance
6 replies
SDSWC Developers
Created by Shahryar on 1/10/2025 in #questions
Does SWC remove comments in the code when transforming a JS file's AST and converting it back to a c
Hello friends, I'm quite new to Rust. Recently, I used OXC in my Elixir project with NIF to modify JS files in my CLI. Unfortunately, after making changes to the JS file, all the comments above functions or within the code are removed, which is a major issue for me. Before diving into SWC, I wanted to ask if this library exhibits the same behavior. My next question is whether SWC supports converting the entire AST to JSON and vice versa, particularly from JSON back to AST. My current requirement is focused on JS files. Thanks in advance!
6 replies