ckeditor / ckeditor4

The best enterprise-grade WYSIWYG editor. Fully customizable with countless features and plugins.
https://ckeditor.com/ckeditor-4
Other
5.8k stars 2.48k forks source link

ESLint support #3279

Open jacekbogdanski opened 5 years ago

jacekbogdanski commented 5 years ago

Type of report

Task

Provide description of the task

Currently, we are using JSHint and JSCS as our linting tools. It would be nice to get ESLint support also, which seems to have much better TE/IDE support and have great extension mechanism for custom rules.

Additionally, JSCS has a terrible performance which slows down any Text Editor including the ones with the best performance (like Sublime, VIM, etc) when opening bigger JS files - almost freezes on plugins/widget/plugin.js when using live linting.

Not really sure if we should totally replace current liners, although it makes sense for me to use a single tool, especially that some rules may not be available for JSHint/JSCS when moving to ESLint.

There is already some nice starting point for ESLint config file prepared by @mlewand https://github.com/mlewand/eslint-config-ckeditor4

Please, give your feedback if you also would like to see linting tool switch.

jacekbogdanski commented 5 years ago

The issue is also related to https://github.com/ckeditor/ckeditor-dev/issues/3277 - although the whole refactoring makes sense from a readability perspective, so wouldn't tread this one as a fix.

Comandeer commented 5 years ago

ESLint is definitely the better choice than JSHint & JSCS combo, especially nowadays as ESLint became an industry standard. Additionally JSCS is discontinued. So a big 👍 from me.

f1ames commented 4 years ago

We need to update docs too since grunt githooks command will be removed https://ckeditor.com/docs/ckeditor4/latest/guide/dev_contributing_code.html.

Comandeer commented 4 years ago

I've made the rules a little bit more loose, changing some errors to warnings (e.g. max-length one). I've also switched off block scoped vars rules, as we have too many places created without such restriction.

ESLint automatic fixes are in #3854 – they should make the code much more elegant without breaking anything.

Comandeer commented 4 years ago

I've prepared ckeditor/ckeditor4-docs#287 to update docs.