Open milahu opened 8 months ago
Let me share the big picture in my mind.
This wakaru.json
should support configuring rule orders and their enabled status. Users should be able to pass some advanced options to rules. (This is not even presented in the playground right now).
The format of eslintrc can be a reference of how this config file should structured.
Parser won't be configurable, it's fixed.
For the user interaction part, how to generate or provide the config file is also something that needs some consideration.
should support configuring rule orders
then rules would be an array
{
"rules": [
["un-jsx", "off"]
],
}
how to generate or provide the config file
to create a default config file
wakaru unminify --init-config wakaru.json
Potentially could be something like this (object in the array, rather than array in array):
{
"rules": [
{ rule: "un-jsx", enabled: false }
],
}
It's been a while since I looked how eslint handles its config for plugins/etc with extra options:
object in the array
more verbose... plus, the rule name is required, so why not make it a positional argument
in any case, it would be nice to have javascript configs wakaru.js wakaru.cjs wakaru.mjs
Verbosity in a config file doesn't necessarily matter all that much if it makes things more explicit/coherent. But I don't have strong opinions either way.
Eslint seems to use a straight object for the rule config; but then I don't believe it makes use of ordering there. Technically depending how the object is iterated it can have stable ordering, but that might be too 'hidden away'/unobvious for most users.
Perhaps webpack/similar's config patterns are worth modelling on as well.
https://github.com/pionxzh/wakaru/issues/113#issuecomment-1946623485
If you are running this repo in local environment, simply disable it in file packages/unminify/src/transformations/index.ts
i guess the simplest solution would be only javascript config, no json config
// wakaru.config.js
import { transformationRules } from "wakaru/unminify"
export default {
transformationRules: transformationRules.filter(rule => {
if (rule.name == "un-jsx") return false
return true
}),
}
i want to disable some rules for the
wakaru unminify
commandsomething like
wakaru.json
would be similar to .eslintrc.jsonexample: disable the un-jsx rule
continue #113
i guess that transforming
document.createElement
to JSX can be desired so i would be happy with a