Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meta: fix linter warnings #3753

Merged
merged 1 commit into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/uppy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports.debugLogger = exports.Core.debugLogger
exports.server = require('@uppy/companion-client')

exports.views = {
// eslint-disable-next-line global-require
ProviderView: require('@uppy/provider-views'),
}

Expand Down
1 change: 1 addition & 0 deletions private/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ switch (window.location.pathname.toLowerCase()) {
case '/':
case '/dashboard.html': Dashboard(); break
case '/dragdrop.html': DragDrop(); break
default: throw new Error('404')
}

if ('serviceWorker' in navigator) {
Expand Down
1 change: 1 addition & 0 deletions private/dev/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ self.addEventListener('message', (event) => {
case 'uppy/GET_FILES':
getFiles(event.data.store)
break
default:
}
})
50 changes: 22 additions & 28 deletions private/locale-pack/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,6 @@ const pluginLocaleDependencies = {
core: 'provider-views',
}

await test()
.then(() => {
console.log('\n')
console.log('No blocking issues found')
})
.catch((error) => {
console.error(error)
process.exit(1)
})

function test () {
switch (mode) {
case 'unused':
return getPaths(`${root}/packages/@uppy/**/src/locale.js`)
.then((paths) => unused(getAllFilesPerPlugin(paths.map((filePath) => path.basename(path.join(filePath, '..', '..'))))))

case 'warnings':
return getLocales(`${root}/packages/@uppy/locales/src/*.js`)
.then((locales) => warnings({
leadingLocale: locales[leadingLocaleName],
followerLocales: omit(locales, leadingLocaleName),
}))

default:
return Promise.reject(new Error(`Invalid mode "${mode}"`))
}
}

function getAllFilesPerPlugin (pluginNames) {
const filesPerPlugin = {}

Expand Down Expand Up @@ -139,3 +111,25 @@ function warnings ({ leadingLocale, followerLocales }) {

console.log(logs.join('\n'))
}

function test () {
switch (mode) {
case 'unused':
return getPaths(`${root}/packages/@uppy/**/src/locale.js`)
.then((paths) => unused(getAllFilesPerPlugin(paths.map((filePath) => path.basename(path.join(filePath, '..', '..'))))))

case 'warnings':
return getLocales(`${root}/packages/@uppy/locales/src/*.js`)
.then((locales) => warnings({
leadingLocale: locales[leadingLocaleName],
followerLocales: omit(locales, leadingLocaleName),
}))

default:
return Promise.reject(new Error(`Invalid mode "${mode}"`))
}
}

await test()
console.log('\n')
console.log('No blocking issues found')
37 changes: 18 additions & 19 deletions website/src/docs/tus.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,25 +101,24 @@ If you want to extend this functionality, for instance to retry on unauthorized
import Uppy from '@uppy/core'
import Tus from '@uppy/tus'

new Uppy().use(Tus, { endpoint: '', onBeforeRequest, onShouldRetry, onAfterResponse })

async function onBeforeRequest (req) {
const token = await getAuthToken()
req.setHeader('Authorization', `Bearer ${token}`)
}

function onShouldRetry (err, retryAttempt, options, next) {
if (err?.originalResponse?.getStatus() === 401) {
return true
}
return next(err)
}

async function onAfterResponse (req, res) {
if (res.getStatus() === 401) {
await refreshAuthToken()
}
}
new Uppy().use(Tus, {
endpoint: '',
async onBeforeRequest (req) {
const token = await getAuthToken()
req.setHeader('Authorization', `Bearer ${token}`)
},
onShouldRetry (err, retryAttempt, options, next) {
if (err?.originalResponse?.getStatus() === 401) {
return true
}
return next(err)
},
async onAfterResponse (req, res) {
if (res.getStatus() === 401) {
await refreshAuthToken()
}
},
})
```

### `metaFields: null`
Expand Down