Closed brunchboy closed 1 year ago
It looks like Antora default UI is using eslint
, so I guess we should use the same linter (and rules) to ease integration.
.stylelintrc
{
"extends": "stylelint-config-standard",
"rules": {
"comment-empty-line-before": null,
"no-descending-specificity": null,
}
}
I had to make the same or similar fixes. lunr.js and search.css fixes are in commit 571d38df104e3f4c7d82ed0c204e26033e3d7f7c on my plugin-377 branch, and search.js fixes are in 94185cb965bbb6370bf8bef49237fe505996bf63; this involves a code change I'll talk about in another issue.
The changes I was most tentative about were a few places where void 0
became undefined
. Javascript is chaotic black magic to me though.
I would argue that the default UI should not lint "vendor" folder. I don't want to reformat js/vendor/lunr.js
as this file is copy/paste from the Lunr distribution.
But I'm willing to updatejs/vendor/search.js
and css/search.css
to conform with the Antora default UI linter.
In my opinion, the following definition should be updated to ignore the "vendor" folder: https://gitlab.com/antora/antora-ui-default/-/blob/master/gulpfile.js#L20
I agree with that. Do you have an example of how to make such a modification?
@brunchboy The glob expression should be less greedy, not sure if you can include everything except the vendor folder... Maybe something like that:
const glob = {
js: ['gulpfile.js', 'gulp.d/**/*.js', `${srcDir}/helpers/**/*.js`, `${srcDir}/js/!(vendor)/**/*.js`],
}
It should only lint bundle files in the vendor folder. For example: https://gitlab.com/antora/antora-ui-default/-/blob/master/src/js/vendor/highlight.bundle.js
It should only lint bundle files in the vendor folder.
That would work but currently the linter is applied on ${srcDir}/js/**/*.js
.
I understand. What I'm suggesting is what it should do.
I found that the simplest way around this was to add the .eslintignore
file to my UI repo with this content:
# https://github.com/Mogztter/antora-lunr#enable-the-search-component-in-the-ui
/src/js/vendor/lunr.js
/src/js/vendor/search.js
Development continues on https://gitlab.com/antora/antora-lunr-extension/
I was unable to build my fork of the Antora default UI after merging in lunr support until I fixed 480 eslint errors in
js/vendor/lunr.js
, 3 injs/vendor/search.js
, and 3 css lint errors incss/search.css
.