Custom Mappings for file extensions to .json linter/formatter #4754
Replies: 2 comments 3 replies
-
That's a good suggestion. I would move the option under I'm a bit hesitant about the use of Regex, though. |
Beta Was this translation helpful? Give feedback.
-
Ah gotcha. So the syntax would be more like: {
"files": {
"extensionMapping": {
".cjs.swcrc": "json"
}
}
} Or actually, would it be better to have the extension mapping object have known keys (i.e. the same keys as the formatters and linters) and then people can just add their own files there: {
"files": {
"extensionMapping": {
"json": [
".cjs.swcrc",
".esm.swcrc",
]
}
}
} I think as a MVP, it would be fine to not have regex/glob. On the regex front though, I guess I have 2 thoughts:
If there is an agreed upon scope and you guys are open to it, I may try my hand at the codebase (since I'm assuming this is a pretty low priority for the larger project). |
Beta Was this translation helpful? Give feedback.
-
Hey all!
I just made the switch from eslint and am overall pretty thrilled with the outcome. As I was setting up my config though, I discovered that I don't have a way (at least that I have been able to find), of applying the same json rules to some of my config files.
I use SWC for compilation and as such, I have
.cjs.swcrc
and.esm.swcrc
files that are json. Since these aren't part of the "well-known names", it doesn't look like I can get them to be linted or formatted via the normal json rules. And since the pattern that I am following is to create variable-prefixed files that don't end in .json, I wouldn't want them to be in the extension/well-known name mapping for the json tool.Ideally, I would like to be able to set something like:
Has this been brought up before and would this be a valid idea within the project's mandate? I wouldn't be opposed to contributing a fix if that's the case.
Beta Was this translation helpful? Give feedback.
All reactions