royriojas / eslint-friendly-formatter

A simple formatter/reporter for ESLint that's friendly with Sublime Text and iterm2 "click to open file" functionality
MIT License
198 stars 28 forks source link

Custom rules #18

Closed klimashkin closed 8 years ago

klimashkin commented 8 years ago

Hi! Thanks for the new version!

But if I have custom rules in some folder of my project, friendly-formatter shows path to http://eslint.org/docs/rules/my-custom-rule (which doesn't exist of course). It would be good to see custom rule file path or just custom rule name as before

royriojas commented 8 years ago

Hi @klimashkin,

I see, I haven't thought about that scenario. Will hide the link to the rule behind a flag then.

Thanks for reporting

klimashkin commented 8 years ago

Hi @royriojas! Is it possible to determine what rules are custom and do not show link only for them? I meant exactly this behavior :)

royriojas commented 8 years ago

Hi @klimashkin

Sadly no, I tried to find how to do that, but I found nothing in the messages object that is passed to the reporters that could help to determine if the rule was custom, coming from a plugin or from a custom rules directory.

I will have to think if we can find a way to pass configuration values to the reporter something like.

"scripts": {
   "lint": "EFF_CONFIG=path/to/eff-config.conf.js eslint --format eslint-friendly-formatter src/**/*.js"
}

And in the eff-config.conf.js do something like

module.exports = {
   isCustomRule: function (ruleId) {  
       // if ruleId matches a custom rule, return true
       // else return false so we can decide if add the link to the rule or not
   }
};