zhukov / webogram

Telegram web application, GPL v3
https://web.telegram.org
GNU General Public License v3.0
7.96k stars 2.35k forks source link

Introduce ESLint and Less linter #1292

Open Ryuno-Ki opened 7 years ago

Ryuno-Ki commented 7 years ago

Because #840 I cloned the repo and digged into the code.

To my surprise you haven't setup any linters yet, @zhukov O_O

I'd like to setup ESLint (since I consider it more active than JSLint or JSHint) and fix upcoming lint issues.

Any objections?

Can anyone recommend a LESS linter? I haven't chance to write any LESS code by now. But it can't be that hard :-D

zhukov commented 7 years ago

ESLint seems to be a nice idea, but the code seems to be totally unprepared for it. Last time I launched some linter like JSHint I've seen a huge amount of errors of warnings.

Current code is far from ideal, we use lots of nasty hacks, pollute global scope etc. While I agree that this is not good, I'm not going to fix these problems in the nearest future.

Though if somebody manages to make JS linter work fine and make it find real problems, I will be glad to merge it.

Ryuno-Ki commented 7 years ago

but the code seems to be totally unprepared for it

oh yeah … I'm not suggesting it out of the blue ;-)

we use lots of nasty hacks, pollute global scope etc

What speaks against a module loader? For example, RequireJS? In order not to break the app by fixing the lint reports, I am tackling the tests first.

Ryuno-Ki commented 7 years ago

Related to #767

zhukov commented 7 years ago

What speaks against a module loader? For example, RequireJS? In order not to break the app by fixing the lint reports, I am tackling the tests first.

Nothing, except that it takes time to rewrite a lot of code.

Ryuno-Ki commented 7 years ago

@zhukov Would you accept a PR?

zhukov commented 7 years ago

@Ryuno-Ki Sure, help is welcome. We just need to get some more details before. Like, why RequireJS and not Webpack / Browserify / something else.

bartist commented 7 years ago

@zhukov I have a JS linter (eslint) and a LESS linter (stylelint) "installed" on my fork, using CodeClimate Although the scores are not ideal, I managed to exclude all vendor-files so each issue is an issue on developed code. I also added a duplication engine, to find code duplication. (you can ignore the code coverage part, the testing score is send to CodeClimate using TravisCI)

All lint-settings are standard configurations from the linters themselves. Would you accept a PR for these linter settings? If not, could you tell which issues you don't agree with? then I will try to solve them before opening a PR.