Selaa lähdekoodia

updated eslint scraper

Rui Jiang 1 vuosi sitten
vanhempi
commit
d4034eea2d
2 muutettua tiedostoa jossa 24 lisäystä ja 4 poistoa
  1. 6 1
      lib/docs/filters/eslint/entries.rb
  2. 18 3
      lib/docs/scrapers/eslint.rb

+ 6 - 1
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

+ 18 - 3
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
       &copy; OpenJS Foundation and other contributors<br>