浏览代码

website: disable linter warnings (#3759)

Antoine du Hamel 2 年之前
父节点
当前提交
0d7a7a6bc1

+ 1 - 1
website/build-examples.js

@@ -77,7 +77,7 @@ glob(srcPattern, (err, files) => {
           config: { root: path.join(__dirname, '..') },
         }),
       ],
-    })).catch(onError)
+    })).catch(onError) // eslint-disable-line no-use-before-define
   })
 })
 

+ 4 - 1
website/inject.js

@@ -72,6 +72,7 @@ const excludes = {
   '@uppy/react': ['react'],
 }
 
+// eslint-disable-next-line no-use-before-define
 inject().catch((err) => {
   console.error(err)
   process.exit(1)
@@ -125,6 +126,7 @@ async function injectSizes (config) {
     }),
   ).then(Object.fromEntries)
 
+  // eslint-disable-next-line no-param-reassign
   config.uppy_bundle_kb_sizes = await sizesPromise
 }
 
@@ -164,6 +166,7 @@ async function injectGhStars () {
     opts.auth = process.env.GITHUB_TOKEN
   }
 
+  // eslint-disable-next-line global-require
   const { Octokit } = require('@octokit/rest')
   const octokit = new Octokit(opts)
 
@@ -214,7 +217,7 @@ function injectLocaleList () {
   const localeList = {}
 
   const localePackagePath = path.join(localesRoot, 'src', '*.js')
-  // eslint-disable-next-line import/no-dynamic-require
+  // eslint-disable-next-line import/no-dynamic-require, global-require
   const localePackageVersion = require(path.join(localesRoot, 'package.json')).version
 
   glob.sync(localePackagePath).forEach((localePath) => {

+ 8 - 3
website/private_modules/hexo-renderer-uppyexamples/index.js

@@ -12,7 +12,8 @@ const browserifyScript = `${webRoot}/build-examples.js`
 
 function parseExamplesBrowserify (data, options, callback) {
   if (!data || !data.path) {
-    return callback(null)
+    callback(null)
+    return
   }
 
   if (!data.path.match(/\/examples\//)) {
@@ -26,20 +27,24 @@ function parseExamplesBrowserify (data, options, callback) {
   // hexo.log.i('hexo-renderer-uppyexamples: change detected in examples. running: ' + cmd);
   exec(cmd, (err, stdout) => {
     if (err) {
-      return callback(err)
+      callback(err)
+      return
     }
 
     hexo.log.i(`hexo-renderer-uppyexamples: ${stdout.trim()}`)
 
+    // eslint-disable-next-line no-shadow
     fs.readFile(tmpFile, 'utf-8', (err, bundledJS) => {
       if (err) {
-        return callback(err)
+        callback(err)
+        return
       }
       // hexo.log.i('hexo-renderer-uppyexamples: read: ' + tmpFile);
 
       // @TODO remove this hack
       // once this is resolved: https://github.com/hexojs/hexo/issues/1663
       // bundledJS = bundledJS.replace(/</g, ' < ');
+      // eslint-disable-next-line no-param-reassign
       bundledJS = bundledJS.replace(/<(?!=)/g, ' < ')
 
       callback(null, bundledJS)

+ 5 - 1
website/scripts/highlight.js

@@ -1,4 +1,3 @@
-/* global hexo */
 const Prism = require('prismjs')
 const entities = require('he')
 const { readFile } = require('fs/promises')
@@ -13,6 +12,7 @@ require('prismjs/components/')()
 
 const unhighlightedCodeRx = /<pre><code class="([^"]*)?">([\s\S]*?)<\/code><\/pre>/igm
 
+// eslint-disable-next-line no-shadow
 function highlight (lang, code) {
   const startTag = `<figure class="highlight ${lang}"><table><tr><td class="code"><pre>`
   const endTag = '</pre></td></tr></table></figure>'
@@ -27,9 +27,13 @@ function highlight (lang, code) {
 }
 
 function prismify (data) {
+  // eslint-disable-next-line no-param-reassign
   data.content = data.content.replace(unhighlightedCodeRx,
+    // eslint-disable-next-line no-shadow
     (_, lang, code) => highlight(lang, entities.decode(code)))
+  // eslint-disable-next-line no-param-reassign
   data.excerpt = data.excerpt.replace(unhighlightedCodeRx,
+    // eslint-disable-next-line no-shadow
     (_, lang, code) => highlight(lang, entities.decode(code)))
 
   return data

+ 4 - 0
website/src/examples/markdown-snippets/app.es6

@@ -97,6 +97,7 @@ class MarkdownTextarea {
     }).then((result) => {
       if (result === null) return
       this.insertAttachments(
+        // eslint-disable-next-line no-use-before-define
         matchFilesAndThumbs(result.results),
       )
     }).catch((err) => {
@@ -126,6 +127,7 @@ class MarkdownTextarea {
     }).then((result) => {
       if (result === null) return
       this.insertAttachments(
+        // eslint-disable-next-line no-use-before-define
         matchFilesAndThumbs(result.results),
       )
     }).catch((err) => {
@@ -192,7 +194,9 @@ document.querySelector('#new').addEventListener('submit', (event) => {
   saveSnippet(title, text)
   renderSnippet(title, text)
 
+  // eslint-disable-next-line no-param-reassign
   event.target.querySelector('input').value = ''
+  // eslint-disable-next-line no-param-reassign
   event.target.querySelector('textarea').value = ''
 })
 

+ 5 - 0
website/themes/uppy/source/js/common.js

@@ -8,9 +8,11 @@
 
   // On index page
   if (isIndex) {
+    // eslint-disable-next-line no-use-before-define
     IndexPage()
   // On inner pages
   } else {
+    // eslint-disable-next-line no-use-before-define
     InnerPage()
   }
 
@@ -72,6 +74,7 @@
         }
       }
       if (last) {
+        // eslint-disable-next-line no-use-before-define
         setActive(last.id)
       }
     }
@@ -80,6 +83,7 @@
       let link = document.createElement('li')
       let text = h.textContent.replace(/\(.*\)$/, '')
       // make sure the ids are link-able...
+      // eslint-disable-next-line no-param-reassign
       h.id = h.id
         .replace(/\(.*\)$/, '')
         .replace(/\$/, '')
@@ -272,6 +276,7 @@
       taglineCounter--
       if (taglineCounter >= 0) {
         let taglineText = taglineList.children[taglineCounter].textContent
+        // eslint-disable-next-line no-use-before-define
         showTagline(taglineText)
         return
       }