RokuRoad / eslint-plugin-roku

ESLint plugin to parse and lint BrightScript files
MIT License
44 stars 9 forks source link

Please add no-shorthand-if rule #22

Closed evgygor closed 6 years ago

evgygor commented 6 years ago

It would be helpful to have 'no-shorthand-if' rule as in https://github.com/willowtreeapps/wist/blob/master/src/js/rules/no-shorthand-if.js

Thanks

ialpert commented 6 years ago

Hey, @evgygor thanks for the interest into the project.

I've created a rule that should do it. Please take a look at https://github.com/RokuRoad/eslint-plugin-roku/commit/5dbf02fe86d878b03948023ae3997321304ba3f2

My professional vector was shifted far away from Roku so I will be much slower to react and respond to requests, therefore encourage to do forks and PRs for the missing functionality and bugs.

Thanks

evgygor commented 6 years ago

Thanks for adding rule! Few issues:

I Added the rule to the .eslintrc.json "roku/no-shorthand-if": "error"

The error appears: [eslint] definition for rule 'roku/no-shorthand-if' was not found (roku/no-shorthand-if)

Only after editing of index.js: const errors = ['no-stop', 'no-shorthand-if']

and restart eslint the error disappears and i can manage the rule (error/warn/off).

2.

Rule doesnt works on else if statement

Thanks

ialpert commented 6 years ago

Thanks for the feedback, @evgygor! If you can, please contribute. Unfortunately, I'm engaged with other activities at the moment and won't be able to do it for a while. If it can wait for a week or two, I will work on it