import-js icon indicating copy to clipboard operation
import-js copied to clipboard

Option to import with double quotes instead of single quotes

Open LandonSchropp opened this issue 3 years ago • 2 comments

At my company, we've standardized on using double quotes for most strings. ImportJS imports files using single strings. Is there a setting I could flip to get it to import with double quotes instead?

Thanks!

LandonSchropp avatar Sep 30 '20 18:09 LandonSchropp

I suspect you can use the importStatementFormatter option to do that:

importStatementFormatter({ importStatement }) {
  return importStatement.replace(/'/, '"');
},

I haven't tested this however. A simple config setting would be nicer for sure

coagmano avatar Sep 30 '20 22:09 coagmano

@coagmano That did the trick with one minor change!

importStatementFormatter({ importStatement }) {
  return importStatement.replace(/'/g, '"');
},

Thanks for the help.

LandonSchropp avatar Oct 04 '20 22:10 LandonSchropp