From d4034eea2d0098e64bfe037e4b7212d43ec96d42 Mon Sep 17 00:00:00 2001 From: Rui Jiang Date: Tue, 19 Nov 2024 21:23:53 -0600 Subject: [PATCH 1/2] updated eslint scraper --- lib/docs/filters/eslint/entries.rb | 7 ++++++- lib/docs/scrapers/eslint.rb | 21 ++++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/lib/docs/filters/eslint/entries.rb b/lib/docs/filters/eslint/entries.rb index f5f0f345..e40cd7a5 100644 --- a/lib/docs/filters/eslint/entries.rb +++ b/lib/docs/filters/eslint/entries.rb @@ -10,7 +10,12 @@ module Docs if subpath.start_with?('rules') return 'Rules' else - at_css('nav.docs-index [aria-current="true"]').ancestors('li')[-1].at_css('a').content + type = at_css('nav.docs-index [aria-current="true"]').ancestors('li')[-1].at_css('a').content + # This specific entry is mispelled with a lowercase 'i' + if type.start_with?('integrate') + type = type.sub('integrate', 'Integrate') + end + return type end end end diff --git a/lib/docs/scrapers/eslint.rb b/lib/docs/scrapers/eslint.rb index 6d069839..e3243171 100644 --- a/lib/docs/scrapers/eslint.rb +++ b/lib/docs/scrapers/eslint.rb @@ -2,9 +2,9 @@ module Docs class Eslint < UrlScraper self.name = 'ESLint' self.type = 'simple' - self.release = '8.56.0' + self.release = '9.15.0' self.base_url = 'https://eslint.org/docs/latest/' - self.root_path = 'user-guide/getting-started' + self.root_path = '/' self.links = { home: 'https://eslint.org/', code: 'https://github.com/eslint/eslint' @@ -14,7 +14,22 @@ module Docs options[:skip_patterns] = [/maintain/, /migrating/, /migrate/, /\Aversions/, /rule-deprecation/] options[:skip] = %w(about about/ versions) - options[:replace_paths] = { 'user-guide' => 'user-guide/' } + # A number of paths have a trailing slash, causing them to be suffixed by "index" during the NormalizePathsFilter + options[:replace_paths] = { + 'configure/' => 'configure', + 'contribute/' => 'contribute', + 'contribute/architecture/' => 'contribute/architecture', + 'extend/' => 'extend', + 'flags/' => 'flags', + 'integrate/' => 'integrate', + 'rules/' => 'rules', + 'use/' => 'use', + 'use/formatters/' => 'use/formatters', + 'use/configure/' => 'use/configure', + 'use/configure/rules/' => 'use/configure/rules', + 'use/core-concepts/' => 'use/core-concepts', + 'use/troubleshooting/' => 'use/troubleshooting', + } options[:attribution] = <<-HTML © OpenJS Foundation and other contributors
From dfe89bb46011d1c21f54942c695fd80d65a6eceb Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Wed, 20 Nov 2024 22:12:06 +0100 Subject: [PATCH 2/2] Update ESLint documentation (9.15.0) --- lib/docs/filters/eslint/clean_html.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/docs/filters/eslint/clean_html.rb b/lib/docs/filters/eslint/clean_html.rb index 0737acef..f347cef9 100644 --- a/lib/docs/filters/eslint/clean_html.rb +++ b/lib/docs/filters/eslint/clean_html.rb @@ -5,6 +5,7 @@ module Docs @doc = at_css('#main') if at_css('#main') @doc = at_css('.docs-main__content') if at_css('.docs-main__content') + css('.docs-toc').remove css('.eslint-ad').remove css('.glyphicon').remove css('hr', 'colgroup', 'td:empty').remove