mirror of
https://github.com/transloadit/uppy.git
synced 2026-01-23 02:25:07 +00:00
meta: enforce no-unused-vars linter rule (#3118)
* meta: enforce `no-unused-vars` linter rule * meta: fix `@typescript-eslint/no-unused-vars` linter warnings * meta: enforce `no-unused-expressions` lint rule * @uppy/companion: fix `tsc` build
This commit is contained in:
parent
2a93874e3e
commit
ec87b232e9
65 changed files with 104 additions and 108 deletions
|
|
@ -64,6 +64,8 @@ module.exports = {
|
|||
'no-restricted-properties': 'error',
|
||||
'no-return-assign': 'error',
|
||||
'no-underscore-dangle': 'error',
|
||||
'no-unused-expressions': 'error',
|
||||
'no-unused-vars': 'error',
|
||||
'no-useless-concat': 'error',
|
||||
'no-var': 'error',
|
||||
'node/handle-callback-err': 'error',
|
||||
|
|
@ -83,8 +85,6 @@ module.exports = {
|
|||
'no-param-reassign': ['warn'],
|
||||
'no-redeclare': ['warn'],
|
||||
'no-shadow': ['warn'],
|
||||
'no-unused-expressions': ['warn'],
|
||||
'no-unused-vars': ['warn'],
|
||||
'no-use-before-define': ['warn'],
|
||||
'radix': ['warn'],
|
||||
'react/button-has-type': 'error',
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ b.plugin(watchify)
|
|||
b.transform(babelify)
|
||||
|
||||
function bundle () {
|
||||
return b.bundle((err, data) => {
|
||||
return b.bundle((err) => {
|
||||
if (err) console.error(err.stack)
|
||||
else console.log('bundle complete')
|
||||
}).pipe(createWriteStream(path.join(__dirname, './bundle.js')))
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ function adaptData (res) {
|
|||
* an example of a custom provider module. It implements @uppy/companion's Provider interface
|
||||
*/
|
||||
class MyCustomProvider {
|
||||
constructor (options) {
|
||||
constructor () {
|
||||
this.authProvider = 'myunsplash'
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,12 +70,12 @@ const uppyOptions = {
|
|||
app.use(uppy.app(uppyOptions))
|
||||
|
||||
// handle 404
|
||||
app.use((req, res, next) => {
|
||||
app.use((req, res) => {
|
||||
return res.status(404).json({ message: 'Not Found' })
|
||||
})
|
||||
|
||||
// handle server errors
|
||||
app.use((err, req, res, next) => {
|
||||
app.use((err, req, res) => {
|
||||
console.error('\x1b[31m', err.stack, '\x1b[0m')
|
||||
res.status(err.status || 500).json({ message: err.message, error: err })
|
||||
})
|
||||
|
|
|
|||
2
examples/react-native-expo/App.js
vendored
2
examples/react-native-expo/App.js
vendored
|
|
@ -56,7 +56,7 @@ export default class App extends React.Component {
|
|||
uploadStarted: true,
|
||||
})
|
||||
})
|
||||
this.uppy.on('upload-success', (file, response) => {
|
||||
this.uppy.on('upload-success', () => {
|
||||
// console.log(file.name, response)
|
||||
})
|
||||
this.uppy.on('complete', (result) => {
|
||||
|
|
|
|||
2
examples/react-native-expo/FileList.js
vendored
2
examples/react-native-expo/FileList.js
vendored
|
|
@ -59,7 +59,7 @@ export default function FileList (props) {
|
|||
<View style={styles.container}>
|
||||
<FlatList
|
||||
data={uppyFilesArray}
|
||||
keyExtractor={(item, index) => item.id}
|
||||
keyExtractor={(item) => item.id}
|
||||
numColumns={2}
|
||||
renderItem={({ item }) => {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ class MarkdownTextarea {
|
|||
}))
|
||||
}
|
||||
|
||||
uploadFiles (files) {
|
||||
uploadFiles () {
|
||||
robodog.upload({
|
||||
waitForEncoding: true,
|
||||
params: {
|
||||
|
|
|
|||
|
|
@ -64,12 +64,12 @@ const uppyOptions = {
|
|||
app.use(companion.app(uppyOptions))
|
||||
|
||||
// handle 404
|
||||
app.use((req, res, next) => {
|
||||
app.use((req, res) => {
|
||||
return res.status(404).json({ message: 'Not Found' })
|
||||
})
|
||||
|
||||
// handle server errors
|
||||
app.use((err, req, res, next) => {
|
||||
app.use((err, req, res) => {
|
||||
console.error('\x1b[31m', err.stack, '\x1b[0m')
|
||||
res.status(err.status || 500).json({ message: err.message, error: err })
|
||||
})
|
||||
|
|
|
|||
|
|
@ -272,7 +272,6 @@ class MultipartUploader {
|
|||
}
|
||||
|
||||
#uploadPart (index, prePreparedPart) {
|
||||
const body = this.chunks[index]
|
||||
this.chunkState[index].busy = true
|
||||
|
||||
const valid = typeof prePreparedPart?.url === 'string'
|
||||
|
|
@ -289,7 +288,7 @@ class MultipartUploader {
|
|||
return this.#uploadPartBytes(index, url, headers)
|
||||
}
|
||||
|
||||
#onPartProgress (index, sent, total) {
|
||||
#onPartProgress (index, sent) {
|
||||
this.chunkState[index].uploaded = ensureInt(sent)
|
||||
|
||||
const totalUploaded = this.chunkState.reduce((n, c) => n + c.uploaded, 0)
|
||||
|
|
@ -341,7 +340,7 @@ class MultipartUploader {
|
|||
this.#onPartProgress(index, ev.loaded, ev.total)
|
||||
})
|
||||
|
||||
xhr.addEventListener('abort', (ev) => {
|
||||
xhr.addEventListener('abort', () => {
|
||||
cleanup()
|
||||
this.chunkState[index].busy = false
|
||||
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ module.exports = class AwsS3Multipart extends BasePlugin {
|
|||
this.uploaderSockets[file.id] = socket
|
||||
this.uploaderEvents[file.id] = new EventTracker(this.uppy)
|
||||
|
||||
this.onFileRemove(file.id, (removed) => {
|
||||
this.onFileRemove(file.id, () => {
|
||||
queuedRequest.abort()
|
||||
socket.send('pause', {})
|
||||
this.resetUploaderReferences(file.id, { abort: true })
|
||||
|
|
@ -450,7 +450,7 @@ module.exports = class AwsS3Multipart extends BasePlugin {
|
|||
}
|
||||
|
||||
onRetryAll (fileID, cb) {
|
||||
this.uploaderEvents[fileID].on('retry-all', (filesToRetry) => {
|
||||
this.uploaderEvents[fileID].on('retry-all', () => {
|
||||
if (!this.uppy.getFile(fileID)) return
|
||||
cb()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -464,7 +464,7 @@ class Uploader {
|
|||
* @param {number} bytesUploaded
|
||||
* @param {number} bytesTotal
|
||||
*/
|
||||
onProgress (bytesUploaded, bytesTotal) {
|
||||
onProgress (bytesUploaded, bytesTotal) { // eslint-disable-line no-unused-vars
|
||||
uploader.emitIllusiveProgress(bytesUploaded)
|
||||
},
|
||||
onSuccess () {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ const logger = require('../logger')
|
|||
* @param {object} res
|
||||
* @param {Function} next
|
||||
*/
|
||||
module.exports = function callback (req, res, next) {
|
||||
module.exports = function callback (req, res, next) { // eslint-disable-line no-unused-vars
|
||||
const { providerName } = req.params
|
||||
|
||||
if (!req.companion.providerTokens) {
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ module.exports = function s3 (config) {
|
|||
Bucket: config.bucket,
|
||||
Key: key,
|
||||
UploadId: uploadId,
|
||||
}, (err, data) => {
|
||||
}, (err) => {
|
||||
if (err) {
|
||||
next(err)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -42,11 +42,6 @@ module.exports = function sendToken (req, res, next) {
|
|||
const { state } = dynamic
|
||||
if (state) {
|
||||
const origin = oAuthState.getFromState(state, 'origin', req.companion.options.secret)
|
||||
const clientVersion = oAuthState.getFromState(
|
||||
state,
|
||||
'clientVersion',
|
||||
req.companion.options.secret
|
||||
)
|
||||
const allowedClients = req.companion.options.clients
|
||||
// if no preset clients then allow any client
|
||||
if (!allowedClients || hasMatch(origin, allowedClients) || hasMatch((new URL(origin)).host, allowedClients)) {
|
||||
|
|
|
|||
|
|
@ -11,10 +11,13 @@ function thumbnail (req, res, next) {
|
|||
|
||||
provider.thumbnail({ id, token }, (err, response) => {
|
||||
if (err) {
|
||||
err.isAuthError ? res.sendStatus(401) : next(err)
|
||||
return
|
||||
if (err.isAuthError) res.sendStatus(401)
|
||||
else next(err)
|
||||
} else if (response) {
|
||||
response.pipe(res)
|
||||
} else {
|
||||
res.sendStatus(404)
|
||||
}
|
||||
response ? response.pipe(res) : res.sendStatus(404)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ const cleanUpFinishedUploads = (dirPath) => {
|
|||
}
|
||||
|
||||
logger.info(`found ${files.length} files`, 'jobs.cleanup.files')
|
||||
files.forEach((file, fileIndex) => {
|
||||
files.forEach((file) => {
|
||||
// if it does not contain FILE_NAME_PREFIX then it probably wasn't created by companion.
|
||||
// this is to avoid deleting unintended files, e.g if a wrong path was accidentally given
|
||||
// by a developer.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ class Provider {
|
|||
*
|
||||
* @param {object} options
|
||||
*/
|
||||
constructor (options) {
|
||||
constructor (options) { // eslint-disable-line no-unused-vars
|
||||
this.needsCookieAuth = false
|
||||
return this
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ class Provider {
|
|||
* @param {object} options
|
||||
* @param {Function} cb
|
||||
*/
|
||||
list (options, cb) {
|
||||
list (options, cb) { // eslint-disable-line no-unused-vars
|
||||
throw new Error('method not implemented')
|
||||
}
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ class Provider {
|
|||
* @param {object} options
|
||||
* @param {Function} cb
|
||||
*/
|
||||
download (options, cb) {
|
||||
download (options, cb) { // eslint-disable-line no-unused-vars
|
||||
throw new Error('method not implemented')
|
||||
}
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ class Provider {
|
|||
* @param {object} options
|
||||
* @param {Function} cb
|
||||
*/
|
||||
thumbnail (options, cb) {
|
||||
thumbnail (options, cb) { // eslint-disable-line no-unused-vars
|
||||
throw new Error('method not implemented')
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ class Provider {
|
|||
* @param {object} options
|
||||
* @param {Function} cb
|
||||
*/
|
||||
size (options, cb) {
|
||||
size (options, cb) { // eslint-disable-line no-unused-vars
|
||||
throw new Error('method not implemented')
|
||||
}
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ class Provider {
|
|||
* @param {object} options
|
||||
* @param {Function} cb
|
||||
*/
|
||||
deauthorizationCallback (options, cb) {
|
||||
deauthorizationCallback (options, cb) { // eslint-disable-line no-unused-vars
|
||||
// @todo consider doing something like cb(new NotImplementedError()) instead
|
||||
throw new Error('method not implemented')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class SearchProvider {
|
|||
* @param {object} options
|
||||
* @param {Function} cb
|
||||
*/
|
||||
list (options, cb) {
|
||||
list (options, cb) { // eslint-disable-line no-unused-vars
|
||||
throw new Error('method not implemented')
|
||||
}
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ class SearchProvider {
|
|||
* @param {object} options
|
||||
* @param {Function} cb
|
||||
*/
|
||||
download (options, cb) {
|
||||
download (options, cb) { // eslint-disable-line no-unused-vars
|
||||
throw new Error('method not implemented')
|
||||
}
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ class SearchProvider {
|
|||
* @param {object} options
|
||||
* @param {Function} cb
|
||||
*/
|
||||
size (options, cb) {
|
||||
size (options, cb) { // eslint-disable-line no-unused-vars
|
||||
throw new Error('method not implemented')
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,11 @@ class Facebook extends Provider {
|
|||
return done(err)
|
||||
}
|
||||
this._getUsername(token, (err, username) => {
|
||||
err ? done(err) : done(null, this.adaptData(body, username, directory, query))
|
||||
if (err) {
|
||||
done(err)
|
||||
} else {
|
||||
done(null, this.adaptData(body, username, directory, query))
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ module.exports.addProviderOptions = (companionOptions, grantConfig) => {
|
|||
* @param {{server: object, providerOptions: object}} options
|
||||
* @returns {string} the authProvider for this provider
|
||||
*/
|
||||
const providerNameToAuthName = (name, options) => {
|
||||
const providerNameToAuthName = (name, options) => { // eslint-disable-line no-unused-vars
|
||||
const providers = exports.getDefaultProviders()
|
||||
return (providers[name] || {}).authProvider
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ const MEDIA_TYPES = Object.freeze({
|
|||
|
||||
const isVideo = (item) => item.media_type === MEDIA_TYPES.video
|
||||
|
||||
exports.isFolder = (_) => {
|
||||
exports.isFolder = (item) => { // eslint-disable-line no-unused-vars
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ class Instagram extends Provider {
|
|||
return done(err)
|
||||
}
|
||||
this._getUsername(token, (err, username) => {
|
||||
err ? done(err) : done(null, this.adaptData(body, username, directory, query))
|
||||
if (err) done(err)
|
||||
else done(null, this.adaptData(body, username, directory, query))
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const querystring = require('querystring')
|
||||
|
||||
exports.isFolder = (item) => {
|
||||
exports.isFolder = (item) => { // eslint-disable-line no-unused-vars
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ exports.getItemName = (item) => {
|
|||
}
|
||||
}
|
||||
|
||||
exports.getMimeType = (item) => {
|
||||
exports.getMimeType = (item) => { // eslint-disable-line no-unused-vars
|
||||
return 'image/jpeg'
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ class Zoom extends Provider {
|
|||
return this.client
|
||||
.get(`${BASE_URL}${GET_MEETING_FILES}`)
|
||||
.auth(token)
|
||||
.request((err, resp, body) => {
|
||||
.request((err, resp) => {
|
||||
if (err || resp.statusCode !== 200) {
|
||||
return this._downloadError(resp, done)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,12 +60,12 @@ module.exports = function server (inputCompanionOptions = {}) {
|
|||
app.use(addRequestId)
|
||||
// log server requests.
|
||||
app.use(morgan('combined'))
|
||||
morgan.token('url', (req, res) => {
|
||||
morgan.token('url', (req) => {
|
||||
const { query, censored } = censorQuery(req.query)
|
||||
return censored ? `${req.path}?${qs.stringify(query)}` : req.originalUrl || req.url
|
||||
})
|
||||
|
||||
morgan.token('referrer', (req, res) => {
|
||||
morgan.token('referrer', (req) => {
|
||||
const ref = req.headers.referer || req.headers.referrer
|
||||
if (typeof ref === 'string') {
|
||||
let parsed
|
||||
|
|
@ -188,12 +188,12 @@ module.exports = function server (inputCompanionOptions = {}) {
|
|||
})
|
||||
}
|
||||
|
||||
app.use((req, res, next) => {
|
||||
app.use((req, res) => {
|
||||
return res.status(404).json({ message: 'Not Found' })
|
||||
})
|
||||
|
||||
// @ts-ignore
|
||||
app.use((err, req, res, next) => {
|
||||
app.use((err, req, res, next) => { // eslint-disable-line no-unused-vars
|
||||
const logStackTrace = true
|
||||
if (app.get('env') === 'production') {
|
||||
// if the error is a URIError from the requested URL we only log the error message
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
jest.mock('../../src/server/helpers/jwt', () => {
|
||||
return {
|
||||
generateToken: (payload, secret) => {},
|
||||
verifyToken: (token, secret) => {},
|
||||
generateEncryptedToken: (payload, secret) => {
|
||||
generateToken: () => {},
|
||||
verifyToken: () => {},
|
||||
generateEncryptedToken: () => {
|
||||
return 'dummy token'
|
||||
},
|
||||
verifyEncryptedToken: (token, secret) => {
|
||||
verifyEncryptedToken: () => {
|
||||
return { payload: '' }
|
||||
},
|
||||
addToCookies: (res, token, companionOptions, authProvider) => {},
|
||||
removeFromCookies: (res, companionOptions, authProvider) => {},
|
||||
addToCookies: () => {},
|
||||
removeFromCookies: () => {},
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
jest.mock('tus-js-client')
|
||||
jest.mock('../../src/server/helpers/request', () => {
|
||||
return {
|
||||
getURLMeta: (url) => {
|
||||
getURLMeta: () => {
|
||||
return Promise.resolve({ size: 7580, type: 'image/jpg' })
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const { render, h } = require('preact')
|
||||
const { render } = require('preact')
|
||||
const findDOMElement = require('@uppy/utils/lib/findDOMElement')
|
||||
|
||||
const BasePlugin = require('./BasePlugin')
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ const getTimeStamp = require('@uppy/utils/lib/getTimeStamp')
|
|||
// Swallow all logs, except errors.
|
||||
// default if logger is not set or debug: false
|
||||
const justErrorsLogger = {
|
||||
debug: (...args) => {},
|
||||
warn: (...args) => {},
|
||||
debug: () => {},
|
||||
warn: () => {},
|
||||
error: (...args) => console.error(`[Uppy] [${getTimeStamp()}]`, ...args),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,12 +91,14 @@ type anyObject = Record<string, unknown>
|
|||
|
||||
// Normal event signature
|
||||
uppy.on('complete', (result) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const successResults = result.successful
|
||||
})
|
||||
|
||||
// Meta signature
|
||||
type Meta = {myCustomMetadata: string}
|
||||
uppy.on<'complete', Meta>('complete', (result) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const meta = result.successful[0].meta.myCustomMetadata
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ const AddFilesPanel = (props) => {
|
|||
<button
|
||||
className="uppy-DashboardContent-back"
|
||||
type="button"
|
||||
onClick={(ev) => props.toggleAddFilesPanel(false)}
|
||||
onClick={() => props.toggleAddFilesPanel(false)}
|
||||
>
|
||||
{props.i18n('back')}
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ const VirtualList = require('./VirtualList')
|
|||
function chunks (list, size) {
|
||||
const chunked = []
|
||||
let currentChunk = []
|
||||
list.forEach((item, i) => {
|
||||
list.forEach((item) => {
|
||||
if (currentChunk.length < size) {
|
||||
currentChunk.push(item)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -458,7 +458,7 @@ module.exports = class Dashboard extends UIPlugin {
|
|||
// Watch for Dashboard container (`.uppy-Dashboard-inner`) resize
|
||||
// and update containerWidth/containerHeight in plugin state accordingly.
|
||||
// Emits first event on initialization.
|
||||
this.resizeObserver = new ResizeObserver((entries, observer) => {
|
||||
this.resizeObserver = new ResizeObserver((entries) => {
|
||||
const uppyDashboardInnerEl = entries[0]
|
||||
|
||||
const { width, height } = uppyDashboardInnerEl.contentRect
|
||||
|
|
@ -586,7 +586,7 @@ module.exports = class Dashboard extends UIPlugin {
|
|||
this.uppy.iteratePlugins((plugin) => {
|
||||
if (plugin.type === 'acquirer') {
|
||||
// Every Plugin with .type acquirer can define handleRootPaste(event)
|
||||
plugin.handleRootPaste && plugin.handleRootPaste(event)
|
||||
plugin.handleRootPaste?.(event)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -634,7 +634,7 @@ module.exports = class Dashboard extends UIPlugin {
|
|||
}, 50)
|
||||
}
|
||||
|
||||
handleDrop = (event, dropCategory) => {
|
||||
handleDrop = (event) => {
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
||||
|
|
@ -651,7 +651,7 @@ module.exports = class Dashboard extends UIPlugin {
|
|||
this.uppy.iteratePlugins((plugin) => {
|
||||
if (plugin.type === 'acquirer') {
|
||||
// Every Plugin with .type acquirer can define handleRootDrop(event)
|
||||
plugin.handleRootDrop && plugin.handleRootDrop(event)
|
||||
plugin.handleRootDrop?.(event)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ module.exports = function createSuperFocus () {
|
|||
lastFocusWasOnSuperFocusableEl = true
|
||||
} else {
|
||||
const firstEl = overlayEl.querySelector(FOCUSABLE_ELEMENTS)
|
||||
firstEl && firstEl.focus({ preventScroll: true })
|
||||
firstEl?.focus({ preventScroll: true })
|
||||
lastFocusWasOnSuperFocusableEl = false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ import Dashboard from '..'
|
|||
})
|
||||
|
||||
uppy.on('dashboard:file-edit-state', (file) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const fileName = file.name
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
const { UIPlugin } = require('@uppy/core')
|
||||
const Translator = require('@uppy/utils/lib/Translator')
|
||||
const toArray = require('@uppy/utils/lib/toArray')
|
||||
const isDragDropSupported = require('@uppy/utils/lib/isDragDropSupported')
|
||||
const getDroppedFiles = require('@uppy/utils/lib/getDroppedFiles')
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
const { UIPlugin } = require('@uppy/core')
|
||||
const toArray = require('@uppy/utils/lib/toArray')
|
||||
const Translator = require('@uppy/utils/lib/Translator')
|
||||
const { h } = require('preact')
|
||||
|
||||
module.exports = class FileInput extends UIPlugin {
|
||||
|
|
@ -67,11 +66,11 @@ module.exports = class FileInput extends UIPlugin {
|
|||
event.target.value = null
|
||||
}
|
||||
|
||||
handleClick (ev) {
|
||||
handleClick () {
|
||||
this.input.click()
|
||||
}
|
||||
|
||||
render (state) {
|
||||
render () {
|
||||
/* http://tympanus.net/codrops/2015/09/15/styling-customizing-file-inputs-smart-way/ */
|
||||
const hiddenInputStyle = {
|
||||
width: '0.1px',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
const prettierBytes = require('@transloadit/prettier-bytes')
|
||||
|
||||
const indexedDB = typeof window !== 'undefined'
|
||||
&& (window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.OIndexedDB || window.msIndexedDB)
|
||||
|
||||
|
|
@ -210,7 +208,6 @@ class IndexedDBStore {
|
|||
request.onsuccess = (event) => {
|
||||
const cursor = event.target.result
|
||||
if (cursor) {
|
||||
const entry = cursor.value
|
||||
cursor.delete() // Ignoring return value … it's not terrible if this goes wrong.
|
||||
cursor.continue()
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ module.exports = class Editor extends Component {
|
|||
}
|
||||
|
||||
render () {
|
||||
const { currentImage, i18n, opts } = this.props
|
||||
const { currentImage, opts } = this.props
|
||||
const { actions } = opts
|
||||
const imageURL = URL.createObjectURL(currentImage.data)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
const { UIPlugin } = require('@uppy/core')
|
||||
const Translator = require('@uppy/utils/lib/Translator')
|
||||
const { h } = require('preact')
|
||||
const Editor = require('./Editor')
|
||||
|
||||
|
|
|
|||
|
|
@ -9,9 +9,11 @@ import ImageEditor from '..'
|
|||
uppy.use(ImageEditor)
|
||||
|
||||
uppy.on('file-editor:start', (file) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const fileName = file.name
|
||||
})
|
||||
uppy.on('file-editor:complete', (file) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const fileName = file.name
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ hu_HU.strings = {
|
|||
openFolderNamed: 'Nyitott mappa %{name}',
|
||||
}
|
||||
|
||||
hu_HU.pluralize = function pluralize (n) {
|
||||
hu_HU.pluralize = function pluralize () {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ ko_KR.strings = {
|
|||
youHaveToAtLeastSelectX: '최소 %{smart_count}개의 파일을 선택해야 합니다',
|
||||
}
|
||||
|
||||
ko_KR.pluralize = function pluralize (n) {
|
||||
ko_KR.pluralize = function pluralize () {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ zh_CN.strings = {
|
|||
}
|
||||
|
||||
// There is just one form.
|
||||
zh_CN.pluralize = function pluralize (n) { return 0 }
|
||||
zh_CN.pluralize = function pluralize () { return 0 }
|
||||
|
||||
if (typeof window !== 'undefined' && typeof window.Uppy !== 'undefined') {
|
||||
window.Uppy.locales.zh_CN = zh_CN
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
const { h } = require('preact')
|
||||
const generateFileID = require('@uppy/utils/lib/generateFileID')
|
||||
const getFileType = require('@uppy/utils/lib/getFileType')
|
||||
const findIndex = require('@uppy/utils/lib/findIndex')
|
||||
const isPreviewSupported = require('@uppy/utils/lib/isPreviewSupported')
|
||||
const AuthView = require('./AuthView')
|
||||
const Header = require('./Header')
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ export default class UppyReactNativeFilePicker extends React.Component {
|
|||
<TouchableOpacity
|
||||
style={styles.providerButton}
|
||||
key={item.title}
|
||||
onPress={ev => this.chooseProvider(item.id)}
|
||||
onPress={() => this.chooseProvider(item.id)}
|
||||
>
|
||||
<Text style={styles.providerButtonText}>{item.title}</Text>
|
||||
</TouchableOpacity>
|
||||
|
|
@ -120,7 +120,7 @@ export default class UppyReactNativeFilePicker extends React.Component {
|
|||
})}
|
||||
<TouchableOpacity
|
||||
style={styles.cancelButton}
|
||||
onPress={ev => this.props.onRequestClose()}
|
||||
onPress={() => this.props.onRequestClose()}
|
||||
>
|
||||
<Text style={styles.cancelButtonText}>Cancel</Text>
|
||||
</TouchableOpacity>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export default class Example extends React.Component {
|
|||
// staticDimension={300}
|
||||
// fixed
|
||||
// spacing={20}
|
||||
renderItem={({ item, index }) => (
|
||||
renderItem={({ item }) => (
|
||||
<View style={[styles.itemContainer, { backgroundColor: item.code }]}>
|
||||
<Text style={styles.itemName}>{item.name}</Text>
|
||||
<Text style={styles.itemCode}>{item.code}</Text>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as DocumentPicker from 'expo-document-picker'
|
||||
|
||||
function selectDocumentWithExpo (options) {
|
||||
function selectDocumentWithExpo () {
|
||||
return DocumentPicker.getDocumentAsync({
|
||||
copyToCacheDirectory: false,
|
||||
}).then((result) => {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ export default class UppyRNUrl extends React.Component {
|
|||
</TouchableOpacity>
|
||||
<TouchableOpacity
|
||||
style={styles.buttonCancel}
|
||||
onPress={ev => this.props.onDone()}
|
||||
onPress={() => this.props.onDone()}
|
||||
>
|
||||
<Text style={styles.buttonCancelText}>Cancel</Text>
|
||||
</TouchableOpacity>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ module.exports = class ReduxDevTools extends UIPlugin {
|
|||
this.initDevTools = this.initDevTools.bind(this)
|
||||
}
|
||||
|
||||
handleStateChange (prevState, nextState, patch) {
|
||||
handleStateChange (prevState, nextState) {
|
||||
this.devTools.send('UPPY_STATE_UPDATE', nextState)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
const { h } = require('preact')
|
||||
const { UIPlugin } = require('@uppy/core')
|
||||
const Translator = require('@uppy/utils/lib/Translator')
|
||||
const getFileTypeExtension = require('@uppy/utils/lib/getFileTypeExtension')
|
||||
const ScreenRecIcon = require('./ScreenRecIcon')
|
||||
const CaptureScreen = require('./CaptureScreen')
|
||||
|
|
@ -148,7 +147,7 @@ module.exports = class ScreenCapture extends UIPlugin {
|
|||
this.videoStream = videoStream
|
||||
|
||||
// add event listener to stop recording if stream is interrupted
|
||||
this.videoStream.addEventListener('inactive', (event) => {
|
||||
this.videoStream.addEventListener('inactive', () => {
|
||||
this.streamInactivated()
|
||||
})
|
||||
|
||||
|
|
@ -275,7 +274,7 @@ module.exports = class ScreenCapture extends UIPlugin {
|
|||
}
|
||||
|
||||
stopRecording () {
|
||||
const stopped = new Promise((resolve, reject) => {
|
||||
const stopped = new Promise((resolve) => {
|
||||
this.recorder.addEventListener('stop', () => {
|
||||
resolve()
|
||||
})
|
||||
|
|
@ -385,7 +384,7 @@ module.exports = class ScreenCapture extends UIPlugin {
|
|||
return Promise.resolve(file)
|
||||
}
|
||||
|
||||
render (state) {
|
||||
render () {
|
||||
// get screen recorder state
|
||||
const recorderState = this.getPluginState()
|
||||
|
||||
|
|
|
|||
|
|
@ -383,7 +383,7 @@ const ProgressBarUploading = (props) => {
|
|||
)
|
||||
}
|
||||
|
||||
const ProgressBarComplete = ({ totalProgress, i18n }) => {
|
||||
const ProgressBarComplete = ({ i18n }) => {
|
||||
return (
|
||||
<div className="uppy-StatusBar-content" role="status" title={i18n('complete')}>
|
||||
<div className="uppy-StatusBar-status">
|
||||
|
|
@ -398,7 +398,7 @@ const ProgressBarComplete = ({ totalProgress, i18n }) => {
|
|||
)
|
||||
}
|
||||
|
||||
const ProgressBarError = ({ error, retryAll, hideRetryButton, i18n }) => {
|
||||
const ProgressBarError = ({ error, i18n }) => {
|
||||
function displayErrorAlert () {
|
||||
const errorMessage = `${i18n('uploadFailed')} \n\n ${error}`
|
||||
// eslint-disable-next-line no-alert
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
const { UIPlugin } = require('@uppy/core')
|
||||
const Translator = require('@uppy/utils/lib/Translator')
|
||||
const getSpeed = require('@uppy/utils/lib/getSpeed')
|
||||
const getBytesRemaining = require('@uppy/utils/lib/getBytesRemaining')
|
||||
const getTextDirection = require('@uppy/utils/lib/getTextDirection')
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
const { UIPlugin } = require('@uppy/core')
|
||||
const Translator = require('@uppy/utils/lib/Translator')
|
||||
const dataURItoBlob = require('@uppy/utils/lib/dataURItoBlob')
|
||||
const isObjectURL = require('@uppy/utils/lib/isObjectURL')
|
||||
const isPreviewSupported = require('@uppy/utils/lib/isPreviewSupported')
|
||||
|
|
@ -66,7 +65,7 @@ module.exports = class ThumbnailGenerator extends UIPlugin {
|
|||
})
|
||||
})
|
||||
|
||||
const orientationPromise = exifr.rotation(file.data).catch(_err => 1)
|
||||
const orientationPromise = exifr.rotation(file.data).catch(() => 1)
|
||||
|
||||
return Promise.all([onload, orientationPromise])
|
||||
.then(([image, orientation]) => {
|
||||
|
|
@ -347,7 +346,7 @@ module.exports = class ThumbnailGenerator extends UIPlugin {
|
|||
})
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise((resolve) => {
|
||||
if (this.queueProcessing) {
|
||||
this.uppy.once('thumbnail:all-generated', () => {
|
||||
emitPreprocessCompleteForAll()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
const Translator = require('@uppy/utils/lib/Translator')
|
||||
const hasProperty = require('@uppy/utils/lib/hasProperty')
|
||||
const { BasePlugin } = require('@uppy/core')
|
||||
const Tus = require('@uppy/tus')
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ describe('Transloadit', () => {
|
|||
it('Does not leave lingering progress if getAssemblyOptions fails', () => {
|
||||
const uppy = new Core()
|
||||
uppy.use(Transloadit, {
|
||||
getAssemblyOptions (file) {
|
||||
getAssemblyOptions () {
|
||||
return Promise.reject(new Error('Failure!'))
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -26,11 +26,13 @@ const validParams = {
|
|||
},
|
||||
})
|
||||
// Access to both transloadit events and core events
|
||||
uppy.on('transloadit:assembly-created', (assembly, fileIDs) => {
|
||||
uppy.on('transloadit:assembly-created', (assembly) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const status = assembly.ok
|
||||
})
|
||||
|
||||
uppy.on('complete', (result) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const success = result.successful
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ module.exports = class Tus extends BasePlugin {
|
|||
* @param {number} total number of files in a queue
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
upload (file, current, total) {
|
||||
upload (file) {
|
||||
this.resetUploaderReferences(file.id)
|
||||
|
||||
// Create a new tus upload
|
||||
|
|
@ -584,7 +584,7 @@ module.exports = class Tus extends BasePlugin {
|
|||
* @param {function(): void} cb
|
||||
*/
|
||||
onRetryAll (fileID, cb) {
|
||||
this.uploaderEvents[fileID].on('retry-all', (filesToRetry) => {
|
||||
this.uploaderEvents[fileID].on('retry-all', () => {
|
||||
if (!this.uppy.getFile(fileID)) return
|
||||
cb()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
const { UIPlugin } = require('@uppy/core')
|
||||
const Translator = require('@uppy/utils/lib/Translator')
|
||||
const { h } = require('preact')
|
||||
const { RequestClient } = require('@uppy/companion-client')
|
||||
const UrlUI = require('./UrlUI.js')
|
||||
|
|
@ -170,7 +169,7 @@ module.exports = class Url extends UIPlugin {
|
|||
})
|
||||
}
|
||||
|
||||
render (state) {
|
||||
render () {
|
||||
return <UrlUI i18n={this.i18n} addFile={this.addFile} />
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
const { h } = require('preact')
|
||||
|
||||
module.exports = (props) => {
|
||||
module.exports = () => {
|
||||
return (
|
||||
<svg aria-hidden="true" focusable="false" fill="#0097DC" width="66" height="55" viewBox="0 0 66 55">
|
||||
<path d="M57.3 8.433c4.59 0 8.1 3.51 8.1 8.1v29.7c0 4.59-3.51 8.1-8.1 8.1H8.7c-4.59 0-8.1-3.51-8.1-8.1v-29.7c0-4.59 3.51-8.1 8.1-8.1h9.45l4.59-7.02c.54-.54 1.35-1.08 2.16-1.08h16.2c.81 0 1.62.54 2.16 1.08l4.59 7.02h9.45zM33 14.64c-8.62 0-15.393 6.773-15.393 15.393 0 8.62 6.773 15.393 15.393 15.393 8.62 0 15.393-6.773 15.393-15.393 0-8.62-6.773-15.393-15.393-15.393zM33 40c-5.648 0-9.966-4.319-9.966-9.967 0-5.647 4.318-9.966 9.966-9.966s9.966 4.319 9.966 9.966C42.966 35.681 38.648 40 33 40z" fillRule="evenodd" />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
const { BasePlugin } = require('@uppy/core')
|
||||
const { nanoid } = require('nanoid')
|
||||
const Translator = require('@uppy/utils/lib/Translator')
|
||||
const { Provider, RequestClient, Socket } = require('@uppy/companion-client')
|
||||
const emitSocketProgress = require('@uppy/utils/lib/emitSocketProgress')
|
||||
const getSocketHost = require('@uppy/utils/lib/getSocketHost')
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ describe('XHRUpload', () => {
|
|||
})
|
||||
|
||||
const core = new Core()
|
||||
const validateStatus = jest.fn((status, responseText, response) => {
|
||||
const validateStatus = jest.fn((status, responseText) => {
|
||||
return JSON.parse(responseText).code !== 40000
|
||||
})
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ describe('XHRUpload', () => {
|
|||
endpoint: 'https://fake-endpoint.uppy.io',
|
||||
some: 'option',
|
||||
validateStatus,
|
||||
getResponseError (responseText, xhr) {
|
||||
getResponseError (responseText) {
|
||||
return JSON.parse(responseText).message
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ class TusService {
|
|||
period: 20,
|
||||
rate: 200 * 1024 / 50,
|
||||
})),
|
||||
}, (err) => { // eslint-disable-line node/handle-callback-err
|
||||
}, (err) => { // eslint-disable-line node/handle-callback-err,no-unused-vars
|
||||
// ignore, typically a cancelled request
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ exports.config = {
|
|||
* @param {Array.<object>} capabilities list of capabilities details
|
||||
* @param {Array<string>} specs List of spec file paths that are to be run
|
||||
*/
|
||||
before (capabilities, specs) {
|
||||
before (capabilities) {
|
||||
const chai = require('chai')
|
||||
global.expect = chai.expect
|
||||
global.capabilities = capabilities
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ function parseExamplesBrowserify (data, options, callback) {
|
|||
const tmpFile = `/tmp/${slug}.js`
|
||||
const cmd = `node ${browserifyScript} ${data.path} ${tmpFile} --colors`
|
||||
// hexo.log.i('hexo-renderer-uppyexamples: change detected in examples. running: ' + cmd);
|
||||
exec(cmd, (err, stdout, stderr) => {
|
||||
exec(cmd, (err, stdout) => {
|
||||
if (err) {
|
||||
return callback(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue