SimenB / stylint

Improve your Stylus code with Stylint
https://simenb.github.io/stylint/
GNU General Public License v2.0
348 stars 62 forks source link

Config file structure changes #354

Open SimenB opened 7 years ago

SimenB commented 7 years ago
SimenB commented 7 years ago

IMO, we should copy the config format of eslint for rules. A name, and error, warn or off, or an array of the same, plus options.

Not necessarily because I think it looks good, but it's something people should be familiar with, and eslint probably use some module internally we could leverage. Alternatively extract, then leverage.

EDIT: Seems to be internal: https://github.com/eslint/eslint/tree/master/lib/config Asked about extracting it in their gitter room: https://gitter.im/eslint/eslint?at=57f8e381a7c618cd26f3f20f

wojciechczerniak commented 7 years ago

While we wait I've got another question here. With #365 in mind, how should we structure reporter configuration?

{
  "reporter": {
      "formatter": "json",
  }
}

for short (should we?):

{
  "reporter": "json"
}

If we want to change reporter from console.log can we still format with json ?

{
  "reporter": {
      "name": "default",
      "formatter": "json"
  }
}

Well, default is default 🎉 and unnecessary here, but this will call require(name) as it does now?

Should options be flat or under options node?

{
  "reporter": {
      "formatter": "json",
      "options": {
          "columns": ["lineData", "severity", "description", "rule"],
          "columnSplitter": "  ",
          "showHeaders": false,
          "truncate": true
       }
    }
}

vs :

{
  "reporter": {
     "formatter": "json",
     "columns": ["lineData", "severity", "description", "rule"],
     "columnSplitter": "  ",
     "showHeaders": false,
     "truncate": true
  }
}

Or... those are totally unrelated

{
  "reporter": {
     "name": "default"
  },
  "formatter": {
     "name": "json",
     "columns": ["lineData", "severity", "description", "rule"],
     "columnSplitter": "  ",
     "showHeaders": false,
     "truncate": true
   }
}
SimenB commented 7 years ago

Let's just go formatter for now, and keep reporter out of it. If people don't want output to stdout, I'm thinking we wait for the feature request. I don't see the use case for it, personally.

So then you have "formatter": "custom-formatter" being shorthand for "formatter": {"name": "custom-formatter"}, and just chuck config in there.

If it's called default, just special case it?

SimenB commented 7 years ago

Didn't receive any response on Gitter, tried opening an issue: eslint/eslint#7339. Hopefully they are positive towards it!