Skip to content

Commit

Permalink
website: disable linter warnings (#3759)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed May 19, 2022
1 parent 797e171 commit 0d7a7a6
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion website/build-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ glob(srcPattern, (err, files) => {
config: { root: path.join(__dirname, '..') },
}),
],
})).catch(onError)
})).catch(onError) // eslint-disable-line no-use-before-define
})
})

Expand Down
5 changes: 4 additions & 1 deletion website/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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) => {
Expand Down
11 changes: 8 additions & 3 deletions website/private_modules/hexo-renderer-uppyexamples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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\//)) {
Expand All @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion website/scripts/highlight.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* global hexo */
const Prism = require('prismjs')
const entities = require('he')
const { readFile } = require('fs/promises')
Expand All @@ -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>'
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions website/src/examples/markdown-snippets/app.es6
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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 = ''
})

Expand Down
5 changes: 5 additions & 0 deletions website/themes/uppy/source/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down Expand Up @@ -72,6 +74,7 @@
}
}
if (last) {
// eslint-disable-next-line no-use-before-define
setActive(last.id)
}
}
Expand All @@ -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(/\$/, '')
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 0d7a7a6

Please sign in to comment.