Coder Social home page Coder Social logo

CLI: add support for config files about wakaru HOT 7 OPEN

milahu avatar milahu commented on August 27, 2024 1
CLI: add support for config files

from wakaru.

Comments (7)

pionxzh avatar pionxzh commented on August 27, 2024 1

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.

from wakaru.

milahu avatar milahu commented on August 27, 2024 1

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

from wakaru.

pionxzh avatar pionxzh commented on August 27, 2024

For the user interaction part, how to generate or provide the config file is also something that needs some consideration.

from wakaru.

0xdevalias avatar 0xdevalias commented on August 27, 2024

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:

from wakaru.

milahu avatar milahu commented on August 27, 2024

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

from wakaru.

0xdevalias avatar 0xdevalias commented on August 27, 2024

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.

from wakaru.

milahu avatar milahu commented on August 27, 2024

#113 (comment)

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
  }),
}

from wakaru.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.