Open nodesocket opened 3 years ago
Editing the generated file shouldn't be difficult (e.g. run prettier on the generated file), but I understand where you're coming from.
Although I don't think single quotes are indeed the standard everywhere, I do think some form of project-scoped template selection could be provided by the CLI, when you create a new migration. This way, you could select a template that conforms to your project's standards, and db-migrate just makes sure that the name and location (the date prefix) of the new migration are correct.
It's quite unfortunate that jshint
doesn't have a --fix
flag, like eslint
does. eslint
also has a rule for quotes and it is autofixable. If you could migrate to eslint
, and while a better option is not provided by db-migrate
itself, you could run a command like this to fix your new migrations right after a db-migrate create
(also supposing you're using git):
# Path from the root of your project where your migrations are created. Change as needed.
MIGRATIONS_DIR=migrations
git ls-files -o --exclude-standard --full-name | grep "^${MIGRATIONS_DIR}/.*.js" | xargs npx eslint --fix
I'm submitting a...
Current behavior
The current template for .js files is:
Expected behavior
Can the template for .js files be changed to:
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
I enforce single quotes with my linter
jshint
and it complains about using double quotes. Plus everywhere else in the file uses single quotes, hopefully double quotes are not required.Environment