ggrossetie / antora-lunr

Integration of Lunr in Antora
MIT License
66 stars 26 forks source link

Linter errors when used with Antora default UI #36

Closed brunchboy closed 1 year ago

brunchboy commented 4 years ago

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 in js/vendor/search.js, and 3 css lint errors in css/search.css.

ggrossetie commented 4 years 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,
  }
}
djencks commented 4 years ago

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.

brunchboy commented 4 years ago

The changes I was most tentative about were a few places where void 0 became undefined. Javascript is chaotic black magic to me though.

ggrossetie commented 4 years ago

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

brunchboy commented 4 years ago

I agree with that. Do you have an example of how to make such a modification?

ggrossetie commented 4 years ago

@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`],
}
mojavelinux commented 4 years ago

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

ggrossetie commented 4 years ago

It should only lint bundle files in the vendor folder.

That would work but currently the linter is applied on ${srcDir}/js/**/*.js.

mojavelinux commented 4 years ago

I understand. What I'm suggesting is what it should do.

myii commented 3 years ago

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
ggrossetie commented 1 year ago

Development continues on https://gitlab.com/antora/antora-lunr-extension/