Allow to specify which files are scripts and which are modules #4207
christophehenry
started this conversation in
Ideas
Replies: 1 comment 3 replies
-
Creating yet another option is a rabbit hole and source of many inconsistencies across projects. I prefer to make a rule smarter and collect as many metadata as possible from the environment, instead adding options. An option wouldn't make the rule portable in this case, and it forces the developer to babysit Biome. Biome wants to make the DX easier, not the other way around. If we need to evaluate an option, I would prefer another part of the configuration. Going back to the proposal, I think you're onto something, and checking the manifest can't be the only way to deduce the file type. Are there other cases we would need to be aware of? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The
useStrictMode
, currently in nursery, allows to enforce the use of the directive "use strict" in script files. However, documentation states:Which is not a convenient way for detecting which files are scripts and which are modules. It requires either to use a
package.json
which is inconvenient for project that don't use NodeJS or rename every script file in the project to use the.cjs
extension, which is also inconvenient. Some project still use the old-school HTML of sourcing files (<script src="…">
) and use neither Node or CommonJS.I believe there should be configuration in
biome.json
, (likeeslint
does) possibly in thefiles
section and it should also be configurable per-file using a comment.Beta Was this translation helpful? Give feedback.
All reactions