From ff0a49dbb42cef25fbcce715d0b91fafecbb54fe Mon Sep 17 00:00:00 2001 From: Kevin van Zonneveld Date: Thu, 28 Oct 2021 13:12:36 +0200 Subject: [PATCH 01/10] Upgrade linting to 2.0.0-0 --- .eslintrc.js | 1 - bin/after-version-bump.js | 1 - bin/build-css.js | 6 ++---- bin/build-lib.js | 4 ++-- package.json | 7 ++++--- yarn.lock | 34 +++++++++++++++++++++------------- 6 files changed, 29 insertions(+), 24 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 260e6aa748..283110b56d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -43,7 +43,6 @@ module.exports = { rules: { // transloadit rules we are actually ok with in the uppy repo 'import/extensions': 'off', - 'no-await-in-loop': 'off', 'object-shorthand': ['error', 'always'], 'strict': 'off', 'key-spacing': 'off', diff --git a/bin/after-version-bump.js b/bin/after-version-bump.js index 206d4eebfe..e3cbac6d00 100755 --- a/bin/after-version-bump.js +++ b/bin/after-version-bump.js @@ -43,7 +43,6 @@ async function updateVersions (files, packageName) { console.log('replacing', replacements, 'in', files.length, 'files') for (const f of files) { - // eslint-disable-next-line no-await-in-loop await replaceInFile(f, replacements) } } diff --git a/bin/build-css.js b/bin/build-css.js index b656af0780..0cf01b6117 100644 --- a/bin/build-css.js +++ b/bin/build-css.js @@ -23,7 +23,6 @@ function handleErr (err) { async function compileCSS () { const files = await glob('packages/{,@uppy/}*/src/style.scss') - /* eslint-disable no-await-in-loop */ for (const file of files) { const importedFiles = new Set() const scssResult = await renderScss({ @@ -78,7 +77,7 @@ async function compileCSS () { await writeFile(outfile, postcssResult.css) console.info( chalk.green('✓ Built Uppy CSS:'), - chalk.magenta(path.relative(cwd, outfile)) + chalk.magenta(path.relative(cwd, outfile)), ) const minifiedResult = await postcss([ @@ -90,10 +89,9 @@ async function compileCSS () { await writeFile(outfile.replace(/\.css$/, '.min.css'), minifiedResult.css) console.info( chalk.green('✓ Minified Bundle CSS:'), - chalk.magenta(path.relative(cwd, outfile).replace(/\.css$/, '.min.css')) + chalk.magenta(path.relative(cwd, outfile).replace(/\.css$/, '.min.css')), ) } - /* eslint-enable no-await-in-loop */ } compileCSS().then(() => { diff --git a/bin/build-lib.js b/bin/build-lib.js index 08db0a7b5f..c2e617e516 100644 --- a/bin/build-lib.js +++ b/bin/build-lib.js @@ -34,7 +34,7 @@ async function buildLib () { const metaMtime = Math.max(...metaMtimes) const files = await glob(SOURCE) - /* eslint-disable no-await-in-loop, no-continue */ + /* eslint-disable no-continue */ for (const file of files) { if (IGNORE.test(file)) { continue @@ -60,7 +60,7 @@ async function buildLib () { ]) console.log(chalk.green('Compiled lib:'), chalk.magenta(libFile)) } - /* eslint-enable no-await-in-loop, no-continue */ + /* eslint-enable no-continue */ } console.log('Using Babel version:', require('@babel/core/package.json').version) diff --git a/package.json b/package.json index 04ad44fdf3..f4eb0ffc46 100644 --- a/package.json +++ b/package.json @@ -68,17 +68,18 @@ "deep-freeze": "^0.0.1", "disc": "^1.3.3", "eslint": "^8.0.0", - "eslint-config-transloadit": "^1.2.0", + "eslint-config-transloadit": "2.0.0-0", "eslint-plugin-compat": "^3.8.0", - "eslint-plugin-import": "^2.22.1", + "eslint-plugin-import": "^2.25.2", "eslint-plugin-jest": "^25.0.0", "eslint-plugin-jsdoc": "^36.0.0", "eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-markdown": "^2.2.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prefer-import": "^0.0.1", - "eslint-plugin-promise": "^5.1.0", + "eslint-plugin-promise": "^4.3.1", "eslint-plugin-react": "^7.22.0", + "eslint-plugin-react-hooks": "^4.2.0", "events.once": "^2.0.2", "exorcist": "^2.0.0", "fakefile": "^1.0.0", diff --git a/yarn.lock b/yarn.lock index 6dc3427125..544b969627 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18949,9 +18949,9 @@ __metadata: languageName: node linkType: hard -"eslint-config-transloadit@npm:^1.2.0": - version: 1.2.1 - resolution: "eslint-config-transloadit@npm:1.2.1" +"eslint-config-transloadit@npm:2.0.0-0": + version: 2.0.0-0 + resolution: "eslint-config-transloadit@npm:2.0.0-0" dependencies: eslint-config-airbnb: ^18.2.1 peerDependencies: @@ -18966,7 +18966,7 @@ __metadata: eslint-plugin-promise: ^4.3.1 eslint-plugin-react: ^7.22.0 eslint-plugin-react-hooks: ^4.2.0 - checksum: c09edfcf19cc8ac8da8e7ee08a75699edea5a1e34b87b3590b63646824cf34211e6084125ae843f9f01768ae54a23744f3946c910ec0c49d8c4ecda70fd81425 + checksum: 12bb5f9f7c18c8ea060b094ca5792e7984ed7d650bb74a2a6ec7dc5c935f1eb4e322902255fa35f28a6323328d5c6d043bc6f38a0e884354cdb46fbe7b8e8173 languageName: node linkType: hard @@ -19047,7 +19047,7 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-import@npm:^2.22.1": +"eslint-plugin-import@npm:^2.22.1, eslint-plugin-import@npm:^2.25.2": version: 2.25.2 resolution: "eslint-plugin-import@npm:2.25.2" dependencies: @@ -19168,12 +19168,19 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-promise@npm:^5.1.0": - version: 5.1.0 - resolution: "eslint-plugin-promise@npm:5.1.0" +"eslint-plugin-promise@npm:^4.3.1": + version: 4.3.1 + resolution: "eslint-plugin-promise@npm:4.3.1" + checksum: 3a6f4180008bb3b7106371ed49060c9bca06ba5cffa82fb249f83d2c4fcf94bbefd468a837bff1164dd52066fe1be7ff2d126b212aaa8fe13e681916e78b1618 + languageName: node + linkType: hard + +"eslint-plugin-react-hooks@npm:^4.2.0": + version: 4.2.0 + resolution: "eslint-plugin-react-hooks@npm:4.2.0" peerDependencies: - eslint: ^7.0.0 - checksum: e62947aaea6882951a1a9f5fe3e3c7925b8dcc222338f7979bd1495ba0f0dc701820116b108be1e801f6e5156eb9a928142f29c659fd21a5d65a4be495bb327d + eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 + checksum: ead5c5be3ded82a0cf295b064376adb1998a43e2262b605eecc0efc88283dec4e159ca39307fafb3d8e661dd08e5a4c8cdfed97eea78f923954f72bad6e20397 languageName: node linkType: hard @@ -42746,17 +42753,18 @@ typescript@4.3.4: deep-freeze: ^0.0.1 disc: ^1.3.3 eslint: ^8.0.0 - eslint-config-transloadit: ^1.2.0 + eslint-config-transloadit: 2.0.0-0 eslint-plugin-compat: ^3.8.0 - eslint-plugin-import: ^2.22.1 + eslint-plugin-import: ^2.25.2 eslint-plugin-jest: ^25.0.0 eslint-plugin-jsdoc: ^36.0.0 eslint-plugin-jsx-a11y: ^6.4.1 eslint-plugin-markdown: ^2.2.0 eslint-plugin-node: ^11.1.0 eslint-plugin-prefer-import: ^0.0.1 - eslint-plugin-promise: ^5.1.0 + eslint-plugin-promise: ^4.3.1 eslint-plugin-react: ^7.22.0 + eslint-plugin-react-hooks: ^4.2.0 events.once: ^2.0.2 exorcist: ^2.0.0 fakefile: ^1.0.0 From 467c3c8a374432c98d25e6e91e969cd1fe55eb71 Mon Sep 17 00:00:00 2001 From: Kevin van Zonneveld Date: Thu, 28 Oct 2021 13:47:21 +0200 Subject: [PATCH 02/10] Adjust so we can pass without error --- .eslintignore | 1 + .eslintrc.js | 1 + 2 files changed, 2 insertions(+) diff --git a/.eslintignore b/.eslintignore index 3700f6c4fe..553289d70d 100644 --- a/.eslintignore +++ b/.eslintignore @@ -19,3 +19,4 @@ website/src/_posts/2021-03-*.md website/src/_posts/2021-04-*.md website/src/_posts/2021-05-*.md website/src/_posts/2021-06-*.md +website/src/docs/react-dashboard.md diff --git a/.eslintrc.js b/.eslintrc.js index 283110b56d..6ec6360d8f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -78,6 +78,7 @@ module.exports = { 'global-require': ['warn'], 'import/no-unresolved': ['warn'], 'import/order': ['warn'], + 'max-classes-per-file': ['warn'], 'no-mixed-operators': ['warn'], 'no-param-reassign': ['warn'], 'no-redeclare': ['warn'], From 225110330d074373ac28524281b10586957b871b Mon Sep 17 00:00:00 2001 From: Kevin van Zonneveld Date: Thu, 28 Oct 2021 13:47:57 +0200 Subject: [PATCH 03/10] Fix linting --- bin/build-bundle.js | 14 ++++++------ bin/upload-to-cdn.js | 2 +- examples/redux/main.js | 2 +- examples/transloadit-textarea/main.js | 8 +++---- .../aws-s3-multipart/src/MultipartUploader.js | 2 +- packages/@uppy/aws-s3-multipart/src/index.js | 2 +- .../@uppy/aws-s3-multipart/src/index.test.js | 8 +++---- packages/@uppy/aws-s3/src/index.js | 2 +- .../@uppy/companion-client/src/Provider.js | 2 +- .../@uppy/companion-client/src/Socket.test.js | 2 +- packages/@uppy/companion/src/companion.js | 2 +- .../@uppy/companion/src/server/Uploader.js | 4 ++-- .../companion/src/server/controllers/s3.js | 2 +- .../companion/src/server/header-blacklist.js | 3 +-- .../companion/src/server/helpers/request.js | 2 +- .../src/server/provider/drive/index.js | 2 +- .../src/server/provider/unsplash/index.js | 3 +-- .../@uppy/companion/src/server/s3-client.js | 2 +- .../@uppy/companion/src/standalone/index.js | 2 +- packages/@uppy/core/src/Uppy.js | 9 ++++---- packages/@uppy/core/src/Uppy.test.js | 22 +++++++++---------- .../dashboard/src/components/FileList.js | 2 +- .../src/components/PickerPanelTopBar.js | 2 +- packages/@uppy/dashboard/src/index.test.js | 4 ++-- packages/@uppy/golden-retriever/src/index.js | 2 +- packages/@uppy/image-editor/src/Editor.js | 4 ++-- packages/@uppy/image-editor/src/index.js | 2 +- packages/@uppy/provider-views/src/Browser.js | 6 ++--- .../@uppy/provider-views/src/Item/index.js | 2 +- .../src/ProviderView/ProviderView.js | 2 +- .../SearchProviderView/SearchProviderView.js | 2 +- .../@uppy/provider-views/src/SharedHandler.js | 2 +- packages/@uppy/react/src/getHTMLProps.js | 2 +- packages/@uppy/status-bar/src/Components.js | 11 +++++----- packages/@uppy/status-bar/src/StatusBar.js | 11 ++++------ packages/@uppy/status-bar/src/index.js | 2 +- packages/@uppy/store-default/src/index.js | 2 +- .../thumbnail-generator/src/index.test.js | 2 +- packages/@uppy/transloadit/src/Assembly.js | 3 +-- .../@uppy/transloadit/src/AssemblyOptions.js | 4 ++-- .../transloadit/src/AssemblyOptions.test.js | 2 +- packages/@uppy/transloadit/src/index.js | 2 +- .../@uppy/transloadit/types/index.test-d.ts | 8 +++---- packages/@uppy/tus/src/index.js | 2 +- packages/@uppy/utils/src/Translator.test.js | 18 +++++++-------- .../@uppy/utils/src/generateFileID.test.js | 6 ++--- .../getFilesAndDirectoriesFromDirectory.js | 2 +- .../utils/webkitGetAsEntryApi/index.js | 4 ++-- .../@uppy/utils/src/getSocketHost.test.js | 8 +++---- packages/@uppy/utils/src/settle.js | 2 +- packages/@uppy/utils/src/settle.test.js | 4 ++-- packages/@uppy/webcam/src/formatSeconds.js | 2 +- packages/@uppy/webcam/src/index.test.js | 14 ++++++------ packages/@uppy/xhr-upload/src/index.js | 2 +- test/endtoend/providers/helper.js | 4 ++-- test/endtoend/providers/main.js | 2 +- .../providers/provider.instagram.test.js | 2 +- test/endtoend/thumbnails/test.js | 4 ++-- .../transloadit-assembly-options/test.js | 2 +- test/endtoend/transloadit/test.js | 2 +- test/resources/DeepFrozenStore.js | 2 +- website/inject.js | 6 ++--- website/themes/uppy/source/js/common.js | 7 +++--- 63 files changed, 131 insertions(+), 140 deletions(-) diff --git a/bin/build-bundle.js b/bin/build-bundle.js index 558bd8a39a..bb1183b7cf 100644 --- a/bin/build-bundle.js +++ b/bin/build-bundle.js @@ -96,17 +96,17 @@ const methods = [ buildBundle( './packages/uppy/index.js', './packages/uppy/dist/uppy.js', - { standalone: 'Uppy' } + { standalone: 'Uppy' }, ).then(minifyBundle), buildBundle( './packages/uppy/bundle.js', './packages/uppy/dist/uppy.legacy.js', - { standalone: 'Uppy (with polyfills)' } + { standalone: 'Uppy (with polyfills)' }, ).then(transpileDownForIE), buildBundle( './packages/@uppy/robodog/bundle.js', './packages/@uppy/robodog/dist/robodog.js', - { standalone: 'Robodog' } + { standalone: 'Robodog' }, ).then(minifyBundle), ] @@ -118,8 +118,8 @@ glob.sync(localePackagePath).forEach((localePath) => { buildBundle( `./packages/@uppy/locales/src/${localeName}.js`, `./packages/@uppy/locales/dist/${localeName}.min.js`, - { minify: true } - ) + { minify: true }, + ), ) }) @@ -127,8 +127,8 @@ glob.sync(localePackagePath).forEach((localePath) => { methods.push( fs.promises.copyFile( `${__dirname}/../BUNDLE-README.md`, - `./packages/uppy/dist/README.md` - ) + `./packages/uppy/dist/README.md`, + ), ) Promise.all(methods).then(() => { diff --git a/bin/upload-to-cdn.js b/bin/upload-to-cdn.js index 610dee8869..8ec9baff6b 100644 --- a/bin/upload-to-cdn.js +++ b/bin/upload-to-cdn.js @@ -85,7 +85,7 @@ async function getLocalDistFiles (packagePath) { files.map(async (f) => [ f, await readFile(path.join(packagePath, 'dist', f)), - ]) + ]), ) return new Map(entries) diff --git a/examples/redux/main.js b/examples/redux/main.js index 0cb6f96acf..8c3aa8e706 100644 --- a/examples/redux/main.js +++ b/examples/redux/main.js @@ -25,7 +25,7 @@ const reducer = combineReducers({ let enhancer = applyMiddleware( uppyReduxStore.middleware(), - logger + logger, ) if (typeof __REDUX_DEVTOOLS_EXTENSION__ !== 'undefined') { // eslint-disable-next-line no-undef diff --git a/examples/transloadit-textarea/main.js b/examples/transloadit-textarea/main.js index b3390a931d..4fa11f356c 100644 --- a/examples/transloadit-textarea/main.js +++ b/examples/transloadit-textarea/main.js @@ -26,7 +26,7 @@ class MarkdownTextarea { this.uploadLine.classList.add('mdtxt-upload') this.uploadLine.appendChild( - document.createTextNode('Upload an attachment') + document.createTextNode('Upload an attachment'), ) } @@ -111,7 +111,7 @@ class MarkdownTextarea { // Was cancelled if (result == null) return this.insertAttachments( - this.matchFilesAndThumbs(result.results) + this.matchFilesAndThumbs(result.results), ) }).catch((err) => { console.error(err) @@ -130,7 +130,7 @@ class MarkdownTextarea { // Was cancelled if (result == null) return this.insertAttachments( - this.matchFilesAndThumbs(result.results) + this.matchFilesAndThumbs(result.results), ) }).catch((err) => { console.error(err) @@ -140,7 +140,7 @@ class MarkdownTextarea { } const textarea = new MarkdownTextarea( - document.querySelector('#new textarea') + document.querySelector('#new textarea'), ) textarea.install() diff --git a/packages/@uppy/aws-s3-multipart/src/MultipartUploader.js b/packages/@uppy/aws-s3-multipart/src/MultipartUploader.js index a62d42e4c3..a5cbd1274e 100644 --- a/packages/@uppy/aws-s3-multipart/src/MultipartUploader.js +++ b/packages/@uppy/aws-s3-multipart/src/MultipartUploader.js @@ -254,7 +254,7 @@ class MultipartUploader { if (typeof result?.presignedUrls !== 'object') { throw new TypeError( - 'AwsS3/Multipart: Got incorrect result from `prepareUploadParts()`, expected an object `{ presignedUrls }`.' + 'AwsS3/Multipart: Got incorrect result from `prepareUploadParts()`, expected an object `{ presignedUrls }`.', ) } diff --git a/packages/@uppy/aws-s3-multipart/src/index.js b/packages/@uppy/aws-s3-multipart/src/index.js index 88c4b29fea..a1fa8e6676 100644 --- a/packages/@uppy/aws-s3-multipart/src/index.js +++ b/packages/@uppy/aws-s3-multipart/src/index.js @@ -294,7 +294,7 @@ module.exports = class AwsS3Multipart extends BasePlugin { protocol: 's3-multipart', size: file.data.size, metadata: file.meta, - } + }, ).then((res) => { this.uppy.setFileState(file.id, { serverToken: res.token }) file = this.uppy.getFile(file.id) diff --git a/packages/@uppy/aws-s3-multipart/src/index.test.js b/packages/@uppy/aws-s3-multipart/src/index.test.js index b250b1e5f4..1117ae71bd 100644 --- a/packages/@uppy/aws-s3-multipart/src/index.test.js +++ b/packages/@uppy/aws-s3-multipart/src/index.test.js @@ -28,7 +28,7 @@ describe('AwsS3Multipart', () => { const opts = {} expect(() => awsS3Multipart.opts.createMultipartUpload(file)).toThrow( - err + err, ) expect(() => awsS3Multipart.opts.listParts(file, opts)).toThrow(err) expect(() => awsS3Multipart.opts.completeMultipartUpload(file, opts)).toThrow(err) @@ -68,7 +68,7 @@ describe('AwsS3Multipart', () => { it('Calls the prepareUploadParts function totalChunks / limit times', async () => { const scope = nock( - 'https://bucket.s3.us-east-2.amazonaws.com' + 'https://bucket.s3.us-east-2.amazonaws.com', ).defaultReplyHeaders({ 'access-control-allow-method': 'PUT', 'access-control-allow-origin': '*', @@ -103,7 +103,7 @@ describe('AwsS3Multipart', () => { await core.upload() expect( - awsS3Multipart.opts.prepareUploadParts.mock.calls.length + awsS3Multipart.opts.prepareUploadParts.mock.calls.length, ).toEqual(1) scope.done() @@ -111,7 +111,7 @@ describe('AwsS3Multipart', () => { it('Calls prepareUploadParts with a Math.ceil(limit / 2) minimum, instead of one at a time for the remaining chunks after the first limit batch', async () => { const scope = nock( - 'https://bucket.s3.us-east-2.amazonaws.com' + 'https://bucket.s3.us-east-2.amazonaws.com', ).defaultReplyHeaders({ 'access-control-allow-method': 'PUT', 'access-control-allow-origin': '*', diff --git a/packages/@uppy/aws-s3/src/index.js b/packages/@uppy/aws-s3/src/index.js index 701a327db1..054dc717fc 100644 --- a/packages/@uppy/aws-s3/src/index.js +++ b/packages/@uppy/aws-s3/src/index.js @@ -141,7 +141,7 @@ module.exports = class AwsS3 extends BasePlugin { const metadata = Object.fromEntries( this.opts.metaFields .filter(key => file.meta[key] != null) - .map(key => [`metadata[${key}]`, file.meta[key].toString()]) + .map(key => [`metadata[${key}]`, file.meta[key].toString()]), ) const query = new URLSearchParams({ filename, type, ...metadata }) diff --git a/packages/@uppy/companion-client/src/Provider.js b/packages/@uppy/companion-client/src/Provider.js index 1cf9f9f2c8..36cf7c3230 100644 --- a/packages/@uppy/companion-client/src/Provider.js +++ b/packages/@uppy/companion-client/src/Provider.js @@ -29,7 +29,7 @@ module.exports = class Provider extends RequestClient { if (this.companionKeysParams) { authHeaders['uppy-credentials-params'] = btoa( - JSON.stringify({ params: this.companionKeysParams }) + JSON.stringify({ params: this.companionKeysParams }), ) } return { ...headers, ...authHeaders } diff --git a/packages/@uppy/companion-client/src/Socket.test.js b/packages/@uppy/companion-client/src/Socket.test.js index 255cb14a07..b4e92599aa 100644 --- a/packages/@uppy/companion-client/src/Socket.test.js +++ b/packages/@uppy/companion-client/src/Socket.test.js @@ -43,7 +43,7 @@ describe('Socket', () => { expect( new UppySocket({ target: 'foo', - }) instanceof UppySocket + }) instanceof UppySocket, ) }) diff --git a/packages/@uppy/companion/src/companion.js b/packages/@uppy/companion/src/companion.js index 6cd313d58a..7f2868430c 100644 --- a/packages/@uppy/companion/src/companion.js +++ b/packages/@uppy/companion/src/companion.js @@ -236,7 +236,7 @@ const validateConfig = (companionOptions) => { fs.accessSync(`${companionOptions.filePath}`, fs.R_OK | fs.W_OK) // eslint-disable-line no-bitwise } catch (err) { throw new Error( - `No access to "${companionOptions.filePath}". Please ensure the directory exists and with read/write permissions.` + `No access to "${companionOptions.filePath}". Please ensure the directory exists and with read/write permissions.`, ) } diff --git a/packages/@uppy/companion/src/server/Uploader.js b/packages/@uppy/companion/src/server/Uploader.js index 318d513f7c..af5034a07f 100644 --- a/packages/@uppy/companion/src/server/Uploader.js +++ b/packages/@uppy/companion/src/server/Uploader.js @@ -365,7 +365,7 @@ class Uploader { logger.debug( `${bytesUploaded} ${illusiveBytesUploaded} ${bytesTotal}`, 'uploader.illusive.progress', - this.shortToken + this.shortToken, ) this.emitProgress(illusiveBytesUploaded, bytesTotal) } @@ -385,7 +385,7 @@ class Uploader { logger.debug( `${bytesUploaded} ${bytesTotal} ${formatPercentage}%`, 'uploader.upload.progress', - this.shortToken + this.shortToken, ) const dataToEmit = { diff --git a/packages/@uppy/companion/src/server/controllers/s3.js b/packages/@uppy/companion/src/server/controllers/s3.js index f7bc8723fe..7dd5849c83 100644 --- a/packages/@uppy/companion/src/server/controllers/s3.js +++ b/packages/@uppy/companion/src/server/controllers/s3.js @@ -248,7 +248,7 @@ module.exports = function s3 (config) { Body: '', Expires: config.expires, }) - }) + }), ).then((urls) => { const presignedUrls = Object.create(null) for (let index = 0; index < partNumbersArray.length; index++) { diff --git a/packages/@uppy/companion/src/server/header-blacklist.js b/packages/@uppy/companion/src/server/header-blacklist.js index 1c7ac5a7aa..8d2ed0a6bb 100644 --- a/packages/@uppy/companion/src/server/header-blacklist.js +++ b/packages/@uppy/companion/src/server/header-blacklist.js @@ -40,8 +40,7 @@ const forbiddenRegex = [/^proxy-.*$/, /^sec-.*$/] */ const isForbiddenHeader = (header) => { const headerLower = header.toLowerCase() - const forbidden - = forbiddenNames.indexOf(headerLower) >= 0 + const forbidden = forbiddenNames.indexOf(headerLower) >= 0 || forbiddenRegex.findIndex((regex) => regex.test(headerLower)) >= 0 if (forbidden) { diff --git a/packages/@uppy/companion/src/server/helpers/request.js b/packages/@uppy/companion/src/server/helpers/request.js index da312cd962..05b5f3e945 100644 --- a/packages/@uppy/companion/src/server/helpers/request.js +++ b/packages/@uppy/companion/src/server/helpers/request.js @@ -98,7 +98,7 @@ module.exports.getRedirectEvaluator = (rawRequestURL, blockPrivateIPs) => { const shouldRedirect = redirectURL.protocol === requestURL.protocol if (!shouldRedirect) { logger.info( - `blocking redirect from ${requestURL} to ${redirectURL}`, 'redirect.protection' + `blocking redirect from ${requestURL} to ${redirectURL}`, 'redirect.protection', ) } diff --git a/packages/@uppy/companion/src/server/provider/drive/index.js b/packages/@uppy/companion/src/server/provider/drive/index.js index ef8d8231cc..4dc8b76168 100644 --- a/packages/@uppy/companion/src/server/provider/drive/index.js +++ b/packages/@uppy/companion/src/server/provider/drive/index.js @@ -176,7 +176,7 @@ class Drive extends Provider { sharedDrives, directory, query, - isRoot && !query.cursor // we can only show it on the first page request, or else we will have duplicates of it + isRoot && !query.cursor, // we can only show it on the first page request, or else we will have duplicates of it ) } diff --git a/packages/@uppy/companion/src/server/provider/unsplash/index.js b/packages/@uppy/companion/src/server/provider/unsplash/index.js index 4cf2085df9..355f3485ea 100644 --- a/packages/@uppy/companion/src/server/provider/unsplash/index.js +++ b/packages/@uppy/companion/src/server/provider/unsplash/index.js @@ -137,8 +137,7 @@ class Unsplash extends SearchProvider { error (err, resp) { if (resp) { const fallbackMessage = `request to Unsplash returned ${resp.statusCode}` - const msg - = resp.body && resp.body.errors ? `${resp.body.errors}` : fallbackMessage + const msg = resp.body && resp.body.errors ? `${resp.body.errors}` : fallbackMessage return new ProviderApiError(msg, resp.statusCode) } diff --git a/packages/@uppy/companion/src/server/s3-client.js b/packages/@uppy/companion/src/server/s3-client.js index 015f93ac52..b7d09a79c2 100644 --- a/packages/@uppy/companion/src/server/s3-client.js +++ b/packages/@uppy/companion/src/server/s3-client.js @@ -35,7 +35,7 @@ module.exports = (companionOptions) => { s3ClientOptions.credentials = new AWS.Credentials( s3ProviderOptions.key, s3ProviderOptions.secret, - s3ProviderOptions.sessionToken + s3ProviderOptions.sessionToken, ) } s3Client = new S3(s3ClientOptions) diff --git a/packages/@uppy/companion/src/standalone/index.js b/packages/@uppy/companion/src/standalone/index.js index 2d36b5256e..4d0349905f 100644 --- a/packages/@uppy/companion/src/standalone/index.js +++ b/packages/@uppy/companion/src/standalone/index.js @@ -119,7 +119,7 @@ module.exports = function server (inputCompanionOptions = {}) { if (companionOptions.redisUrl) { const RedisStore = require('connect-redis')(session) const redisClient = redis.client( - merge({ url: companionOptions.redisUrl }, companionOptions.redisOptions) + merge({ url: companionOptions.redisUrl }, companionOptions.redisOptions), ) sessionOptions.store = new RedisStore({ client: redisClient }) } diff --git a/packages/@uppy/core/src/Uppy.js b/packages/@uppy/core/src/Uppy.js index 2a687a61d3..14dabe2948 100644 --- a/packages/@uppy/core/src/Uppy.js +++ b/packages/@uppy/core/src/Uppy.js @@ -418,7 +418,7 @@ class Uppy { const inProgressFiles = files.filter(({ progress }) => !progress.uploadComplete && progress.uploadStarted) const newFiles = files.filter((file) => !file.progress.uploadStarted) const startedFiles = files.filter( - file => file.progress.uploadStarted || file.progress.preprocess || file.progress.postprocess + file => file.progress.uploadStarted || file.progress.preprocess || file.progress.postprocess, ) const uploadStartedFiles = files.filter((file) => file.progress.uploadStarted) const pausedFiles = files.filter((file) => file.isPaused) @@ -1286,10 +1286,9 @@ class Uppy { } updateOnlineStatus () { - const online - = typeof window.navigator.onLine !== 'undefined' - ? window.navigator.onLine - : true + const online = typeof window.navigator.onLine !== 'undefined' + ? window.navigator.onLine + : true if (!online) { this.emit('is-offline') this.info(this.i18n('noInternetConnection'), 'error', 0) diff --git a/packages/@uppy/core/src/Uppy.test.js b/packages/@uppy/core/src/Uppy.test.js index cb494523de..5124b99aae 100644 --- a/packages/@uppy/core/src/Uppy.test.js +++ b/packages/@uppy/core/src/Uppy.test.js @@ -476,12 +476,12 @@ describe('src/Core', () => { expect(postprocessor1.mock.calls[0][0].length).toEqual(1) expect(postprocessor1.mock.calls[0][0][0].substring(0, 17)).toEqual( - fileId.substring(0, 17) + fileId.substring(0, 17), ) expect(postprocessor2.mock.calls[0][0].length).toEqual(1) expect(postprocessor2.mock.calls[0][0][0].substring(0, 17)).toEqual( - fileId.substring(0, 17) + fileId.substring(0, 17), ) }) }) @@ -675,7 +675,7 @@ describe('src/Core', () => { }, }) }).toThrow( - "Cannot add the duplicate file 'foo.jpg', it already exists" + "Cannot add the duplicate file 'foo.jpg', it already exists", ) expect(core.getFiles().length).toEqual(1) }) @@ -717,7 +717,7 @@ describe('src/Core', () => { data: new File([sampleImage], { type: 'image/jpeg' }), }) }).toThrow( - 'Cannot add the file because onBeforeFileAdded returned false.' + 'Cannot add the file because onBeforeFileAdded returned false.', ) expect(core.getFiles().length).toEqual(0) }) @@ -742,7 +742,7 @@ describe('src/Core', () => { data: new File([sampleImage], { type: 'image/jpeg' }), }) }).toThrow( - /Cannot add more files/ + /Cannot add more files/, ) }) @@ -765,7 +765,7 @@ describe('src/Core', () => { data: new File([sampleImage], { type: 'image/jpeg' }), }) }).toThrow( - /Cannot add more files/ + /Cannot add more files/, ) }) @@ -956,7 +956,7 @@ describe('src/Core', () => { await expect(core.upload()).resolves.toBeDefined() await expect(core.upload()).rejects.toThrow( - /Cannot create a new upload: already uploading\./ + /Cannot create a new upload: already uploading\./, ) }) @@ -1660,7 +1660,7 @@ describe('src/Core', () => { data: new File([sampleImage], { type: 'image/jpeg' }), }) }).toThrowError( - new Error('foo1.jpg exceeds maximum allowed size of 33 KB') + new Error('foo1.jpg exceeds maximum allowed size of 33 KB'), ) }) @@ -1696,13 +1696,13 @@ describe('src/Core', () => { { result: false, reason: 'This file is smaller than the allowed size of 293 KB', - } + }, ) expect(validateRestrictions2).toMatchObject( { result: false, reason: 'You can only upload: image/png', - } + }, ) }) @@ -1775,7 +1775,7 @@ describe('src/Core', () => { { value: status, writable: true, - } + }, ) } diff --git a/packages/@uppy/dashboard/src/components/FileList.js b/packages/@uppy/dashboard/src/components/FileList.js index 4284b4d7bd..01babc17bc 100644 --- a/packages/@uppy/dashboard/src/components/FileList.js +++ b/packages/@uppy/dashboard/src/components/FileList.js @@ -22,7 +22,7 @@ module.exports = (props) => { const noFiles = props.totalFileCount === 0 const dashboardFilesClass = classNames( 'uppy-Dashboard-files', - { 'uppy-Dashboard-files--noFiles': noFiles } + { 'uppy-Dashboard-files--noFiles': noFiles }, ) // It's not great that this is hardcoded! diff --git a/packages/@uppy/dashboard/src/components/PickerPanelTopBar.js b/packages/@uppy/dashboard/src/components/PickerPanelTopBar.js index cbc7791e45..8fdd9cad81 100644 --- a/packages/@uppy/dashboard/src/components/PickerPanelTopBar.js +++ b/packages/@uppy/dashboard/src/components/PickerPanelTopBar.js @@ -50,7 +50,7 @@ function UploadStatus (props) { props.isAllErrored, props.isAllComplete, props.isAllPaused, - props.files + props.files, ) switch (uploadingState) { diff --git a/packages/@uppy/dashboard/src/index.test.js b/packages/@uppy/dashboard/src/index.test.js index 03e695b7ba..9016bf47d9 100644 --- a/packages/@uppy/dashboard/src/index.test.js +++ b/packages/@uppy/dashboard/src/index.test.js @@ -75,7 +75,7 @@ describe('Dashboard', () => { }) expect( - core.getPlugin('Dashboard').opts.width + core.getPlugin('Dashboard').opts.width, ).toEqual(300) }) @@ -95,7 +95,7 @@ describe('Dashboard', () => { }) expect( - core.getPlugin('Dashboard').i18n('myDevice') + core.getPlugin('Dashboard').i18n('myDevice'), ).toEqual('Май дивайс') }) diff --git a/packages/@uppy/golden-retriever/src/index.js b/packages/@uppy/golden-retriever/src/index.js index 5a5e0cad34..8a1c71a78a 100644 --- a/packages/@uppy/golden-retriever/src/index.js +++ b/packages/@uppy/golden-retriever/src/index.js @@ -44,7 +44,7 @@ module.exports = class GoldenRetriever extends BasePlugin { this.saveFilesStateToLocalStorage = throttle( this.saveFilesStateToLocalStorage.bind(this), 500, - { leading: true, trailing: true } + { leading: true, trailing: true }, ) this.restoreState = this.restoreState.bind(this) this.loadFileBlobsFromServiceWorker = this.loadFileBlobsFromServiceWorker.bind(this) diff --git a/packages/@uppy/image-editor/src/Editor.js b/packages/@uppy/image-editor/src/Editor.js index 5abc1fd76a..22e56e3b19 100644 --- a/packages/@uppy/image-editor/src/Editor.js +++ b/packages/@uppy/image-editor/src/Editor.js @@ -15,7 +15,7 @@ module.exports = class Editor extends Component { const { opts, storeCropperInstance } = this.props this.cropper = new Cropper( this.imgElement, - opts.cropperOptions + opts.cropperOptions, ) storeCropperInstance(this.cropper) @@ -42,7 +42,7 @@ module.exports = class Editor extends Component { .toBlob( (blob) => save(blob), currentImage.type, - opts.quality + opts.quality, ) } diff --git a/packages/@uppy/image-editor/src/index.js b/packages/@uppy/image-editor/src/index.js index 2c66faca72..c94eee605c 100644 --- a/packages/@uppy/image-editor/src/index.js +++ b/packages/@uppy/image-editor/src/index.js @@ -103,7 +103,7 @@ module.exports = class ImageEditor extends UIPlugin { this.cropper.getCroppedCanvas().toBlob( saveBlobCallback, currentImage.type, - this.opts.quality + this.opts.quality, ) } diff --git a/packages/@uppy/provider-views/src/Browser.js b/packages/@uppy/provider-views/src/Browser.js index ce305a4024..660e995133 100644 --- a/packages/@uppy/provider-views/src/Browser.js +++ b/packages/@uppy/provider-views/src/Browser.js @@ -39,14 +39,14 @@ function Browser (props) {
{headerComponent} @@ -100,7 +100,7 @@ function Browser (props) { {files.map((file) => { const validated = validateRestrictions( remoteFileObjToLocal(file), - [...uppyFiles, ...currentSelection] + [...uppyFiles, ...currentSelection], ) return Item({ diff --git a/packages/@uppy/provider-views/src/Item/index.js b/packages/@uppy/provider-views/src/Item/index.js index ab15420a16..93fa4fd28a 100644 --- a/packages/@uppy/provider-views/src/Item/index.js +++ b/packages/@uppy/provider-views/src/Item/index.js @@ -12,7 +12,7 @@ module.exports = (props) => { 'uppy-ProviderBrowserItem', { 'uppy-ProviderBrowserItem--selected': props.isChecked }, { 'uppy-ProviderBrowserItem--disabled': props.isDisabled }, - { 'uppy-ProviderBrowserItem--noPreview': itemIconString === 'video' } + { 'uppy-ProviderBrowserItem--noPreview': itemIconString === 'video' }, ) const itemIconEl = diff --git a/packages/@uppy/provider-views/src/ProviderView/ProviderView.js b/packages/@uppy/provider-views/src/ProviderView/ProviderView.js index 1046feb779..462b9c5325 100644 --- a/packages/@uppy/provider-views/src/ProviderView/ProviderView.js +++ b/packages/@uppy/provider-views/src/ProviderView/ProviderView.js @@ -103,7 +103,7 @@ module.exports = class ProviderView extends View { this.#updateFilesAndFolders(res, files, folders) this.plugin.setPluginState({ directories: updatedDirectories }) }, - this.handleError + this.handleError, ) } diff --git a/packages/@uppy/provider-views/src/SearchProviderView/SearchProviderView.js b/packages/@uppy/provider-views/src/SearchProviderView/SearchProviderView.js index 76a4bcf70b..aa71a0bbba 100644 --- a/packages/@uppy/provider-views/src/SearchProviderView/SearchProviderView.js +++ b/packages/@uppy/provider-views/src/SearchProviderView/SearchProviderView.js @@ -77,7 +77,7 @@ module.exports = class SearchProviderView extends View { (res) => { this.#updateFilesAndInputMode(res, []) }, - this.handleError + this.handleError, ) } diff --git a/packages/@uppy/provider-views/src/SharedHandler.js b/packages/@uppy/provider-views/src/SharedHandler.js index 11e8049a24..ca8accaac1 100644 --- a/packages/@uppy/provider-views/src/SharedHandler.js +++ b/packages/@uppy/provider-views/src/SharedHandler.js @@ -49,7 +49,7 @@ module.exports = class SharedHandler { const { uppy } = this.plugin const validatedRestrictions = uppy.validateRestrictions( remoteFileObjToLocal(item), - [...uppy.getFiles(), ...reducedCurrentSelection] + [...uppy.getFiles(), ...reducedCurrentSelection], ) if (validatedRestrictions.result) { reducedCurrentSelection.push(item) diff --git a/packages/@uppy/react/src/getHTMLProps.js b/packages/@uppy/react/src/getHTMLProps.js index 2436aa3baf..b6ce49ec02 100644 --- a/packages/@uppy/react/src/getHTMLProps.js +++ b/packages/@uppy/react/src/getHTMLProps.js @@ -257,7 +257,7 @@ const getHTMLProps = (props) => { // Gets all the React props return Object.fromEntries( Object.entries(props) - .filter(([key]) => validHTMLAttribute.test(key) || reactSupportedHtmlAttr.includes(key)) + .filter(([key]) => validHTMLAttribute.test(key) || reactSupportedHtmlAttr.includes(key)), ) } diff --git a/packages/@uppy/status-bar/src/Components.js b/packages/@uppy/status-bar/src/Components.js index 083a432567..cf65e2b469 100644 --- a/packages/@uppy/status-bar/src/Components.js +++ b/packages/@uppy/status-bar/src/Components.js @@ -28,13 +28,12 @@ function UploadBtn (props) { { 'uppy-c-btn-primary': uploadState === statusBarStates.STATE_WAITING, }, - { 'uppy-StatusBar-actionBtn--disabled': isSomeGhost } + { 'uppy-StatusBar-actionBtn--disabled': isSomeGhost }, ) - const uploadBtnText - = newFiles && isUploadStarted && !recoveredState - ? i18n('uploadXNewFiles', { smart_count: newFiles }) - : i18n('uploadXFiles', { smart_count: newFiles }) + const uploadBtnText = newFiles && isUploadStarted && !recoveredState + ? i18n('uploadXNewFiles', { smart_count: newFiles }) + : i18n('uploadXFiles', { smart_count: newFiles }) return (