- Issue created by @darvanen
- First commit to issue fork.
- šÆšµJapan ptmkenny
Many of the issues are with js/build/tokenBrowser.js, but this file probably doesn't need to be linted because it is already built and not meant to be user-editable.
- š¦šŗAustralia darvanen Sydney, Australia
@ptmkenny I've merged the changes from š Require composer-lint, cspell, phpcs, and stylelint to pass Fixed , you may wish to rebase this branch.
Yes please to ignoring compiled files.
- šÆšµJapan ptmkenny
@darvanen Thanks for the quick merge! Updated and requiring eslint to pass as part of this issue.
- Status changed to Needs work
6 months ago 1:51pm 28 May 2024 - šÆšµJapan ptmkenny
Ok, here are the remaining issues:
/builds/issue/token_filter-3433142/web/modules/custom/token_filter-3433142/js/ckeditor5_plugins/tokenBrowser/src/token-browser-command.js 1:25 error Unable to resolve path to module 'ckeditor5/src/core' import/no-unresolved /builds/issue/token_filter-3433142/web/modules/custom/token_filter-3433142/js/ckeditor5_plugins/tokenBrowser/src/token-browser-editing.js 1:24 error Unable to resolve path to module 'ckeditor5/src/core' import/no-unresolved /builds/issue/token_filter-3433142/web/modules/custom/token_filter-3433142/js/ckeditor5_plugins/tokenBrowser/src/token-browser-ui.js 1:24 error Unable to resolve path to module 'ckeditor5/src/core' import/no-unresolved 2:28 error Unable to resolve path to module 'ckeditor5/src/ui' import/no-unresolved /builds/issue/token_filter-3433142/web/modules/custom/token_filter-3433142/js/ckeditor5_plugins/tokenBrowser/src/token-browser.js 1:24 error Unable to resolve path to module 'ckeditor5/src/core' import/no-unresolved /builds/issue/token_filter-3433142/web/modules/custom/token_filter-3433142/js/plugins/tokenbrowser/plugin.js 62:20 error 'CKEDITOR' is not defined no-undef /builds/issue/token_filter-3433142/web/modules/custom/token_filter-3433142/webpack.config.js 3:25 error Unable to resolve path to module 'webpack' import/no-unresolved 4:30 error Unable to resolve path to module 'terser-webpack-plugin' import/no-unresolved ā 8 problems (8 errors, 0 warnings)
7 of the issues are a result of ckeditor5/webpack not being installed.
As for how to solve this, in Drupal Slack #gitlab, @fjgarlin stated:
this is what core does https://git.drupalcode.org/project/drupal/-/blob/11.x/.gitlab-ci.yml?ref_type=heads#L359 maybe you need to run that somehow. maybe in the composer:after_script because we run yarn in the composer job: https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.main.yml#L350 or ignore
- Status changed to Needs review
6 months ago 2:51pm 28 May 2024 - šÆšµJapan ptmkenny
So there was one final error I wasn't sure about:
/builds/issue/token_filter-3433142/web/modules/custom/token_filter-3433142/js/plugins/tokenbrowser/plugin.js 62:20 error 'CKEDITOR' is not defined no-undef ā 1 problem (1 error, 0 warnings)
The code appears to be based off of Entity Embed module's CKEditor plugin, but that has the same eslint issue.
So, I just ignored this line, since CKEDITOR should always be defined, right?
If not, hopefully someone else can fix this.
The only other thing I ignored was the build output, but that should be ignored because build artifacts don't need to be linted.
I did NOT manually test this because I don't use CKEditor on my site, so I would appreciate if someone who is using the plugin can test this and confirm everything still works.
- š¦šŗAustralia darvanen Sydney, Australia
Nice one! Gonna do the manual testing now. One question for my ongoing education: what purpose does making ckeditor5 a dependency instead of a dev-dependency serve?
- Status changed to Needs work
6 months ago 11:24am 29 May 2024 - š¦šŗAustralia darvanen Sydney, Australia
Alrighty, everything worked until I rebuilt the code with the altered JS then the CKEditor instance failed to initialise and the browser reported this:
CKEditorError: plugincollection-plugin-not-found {"plugin":null} Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-plugincollection-plugin-not-found at ckeditor5-dll.js?v=40.2.0:5:110188 at ckeditor5-dll.js?v=40.2.0:5:110247 at Array.forEach (<anonymous>) at u (ckeditor5-dll.js?v=40.2.0:5:110049) at l.init (ckeditor5-dll.js?v=40.2.0:5:108537) at D.initPlugins (ckeditor5-dll.js?v=40.2.0:5:115287) at js_SiUtCm46YLOYMNhHO4sPUmdx9_ZqVt-kXQc_l3wcO6E.js?scope=footer&delta=2&language=en&theme=claro&include=eJyNU9tuwyAM_SGaPO0DNql9mrRPiBziJKyAKZhu7dcPktAurVTlJfHl-GDsgyTL-MsRdN356EBX8hbZaWWPQUjyWFvyBrS6opAaPNWDpjYhAl8SaJgxCwFIVmecihewpQ53fWIQ2Sq4bK8KJWkNLqyDEJkkGaeRUTjgsSSynZDGoOU7w-SK9IlNVCW8uCvewMAYRK80oy_B2RPyiJ1i8m-1SrPwNmXKASWzBVOhcSMEFTaBRzZ6bwdlcRNcGRiWSd2DeVh5zsCPmVaTPJ4i8VPNvKfHWHhicBAYD57MV98r-UQTKHqJ--RNethwA5n2_5Hb2oRmaPXToSN5dU16Bf05zW2d9WjojId5HkxHtM2y7tlpPf2EtO4s96KAbGdR4D9JLMS33r5PEf2lmgQ9C7woGs671GcQITXGMt5Yi5-6IN1CbmD6ixju4st2pdLzy0_uxasstdAZZZsHxoo94otUGtk5X_khhUGCw_dcJlo1NE45rIvxBxRnl5Y:5:9630 at new Promise (<anonymous>) at D.create (js_SiUtCm46YLOYMNhHO4sPUmdx9_ZqVt-kXQc_l3wcO6E.js?scope=footer&delta=2&language=en&theme=claro&include=eJyNU9tuwyAM_SGaPO0DNql9mrRPiBziJKyAKZhu7dcPktAurVTlJfHl-GDsgyTL-MsRdN356EBX8hbZaWWPQUjyWFvyBrS6opAaPNWDpjYhAl8SaJgxCwFIVmecihewpQ53fWIQ2Sq4bK8KJWkNLqyDEJkkGaeRUTjgsSSynZDGoOU7w-SK9IlNVCW8uCvewMAYRK80oy_B2RPyiJ1i8m-1SrPwNmXKASWzBVOhcSMEFTaBRzZ6bwdlcRNcGRiWSd2DeVh5zsCPmVaTPJ4i8VPNvKfHWHhicBAYD57MV98r-UQTKHqJ--RNethwA5n2_5Hb2oRmaPXToSN5dU16Bf05zW2d9WjojId5HkxHtM2y7tlpPf2EtO4s96KAbGdR4D9JLMS33r5PEf2lmgQ9C7woGs671GcQITXGMt5Yi5-6IN1CbmD6ixju4st2pdLzy0_uxasstdAZZZsHxoo94otUGtk5X_khhUGCw_dcJlo1NE45rIvxBxRnl5Y:5:9587) at Object.attach (js_SiUtCm46YLOYMNhHO4sPUmdx9_ZqVt-kXQc_l3wcO6E.js?scope=footer&delta=2&language=en&theme=claro&include=eJyNU9tuwyAM_SGaPO0DNql9mrRPiBziJKyAKZhu7dcPktAurVTlJfHl-GDsgyTL-MsRdN356EBX8hbZaWWPQUjyWFvyBrS6opAaPNWDpjYhAl8SaJgxCwFIVmecihewpQ53fWIQ2Sq4bK8KJWkNLqyDEJkkGaeRUTjgsSSynZDGoOU7w-SK9IlNVCW8uCvewMAYRK80oy_B2RPyiJ1i8m-1SrPwNmXKASWzBVOhcSMEFTaBRzZ6bwdlcRNcGRiWSd2DeVh5zsCPmVaTPJ4i8VPNvKfHWHhicBAYD57MV98r-UQTKHqJ--RNethwA5n2_5Hb2oRmaPXToSN5dU16Bf05zW2d9WjojId5HkxHtM2y7tlpPf2EtO4s96KAbGdR4D9JLMS33r5PEf2lmgQ9C7woGs671GcQITXGMt5Yi5-6IN1CbmD6ixju4st2pdLzy0_uxasstdAZZZsHxoo94otUGtk5X_khhUGCw_dcJlo1NE45rIvxBxRnl5Y:22:3962)
- šÆšµJapan ptmkenny
Hmm, maybe CKEditor requires the plugins not to be exported by default? Just a guess.
what purpose does making ckeditor5 a dependency instead of a dev-dependency serve?
This is just a standard eslint error. Eslint requires anything that is imported in the build to be in
dependencies
instead ofdevDependencies
. I am not an expert on this, but usually I don't think it matters either way. However, there may be cases where webpack, vite, and other build tools can make mistakes because they will strip devDependencies, so if a real dependency that gets imported is in dev, what should the build tool do, strip it or keep it? To avoid this kind of confusion, eslint says make it a dependency. - Status changed to RTBC
6 months ago 10:40pm 2 June 2024 - š¦šŗAustralia darvanen Sydney, Australia
Looks like we just needed to compile the JS code. Manual testing passes now.
-
darvanen ā
committed f006702f on 2.x authored by
ptmkenny ā
Issue #3433142 by ptmkenny, darvanen: Get eslint test to pass and then...
-
darvanen ā
committed f006702f on 2.x authored by
ptmkenny ā
- Status changed to Fixed
6 months ago 10:46pm 2 June 2024 - š¦šŗAustralia darvanen Sydney, Australia
Brilliant work mate, thank you.
Automatically closed - issue fixed for 2 weeks with no activity.