From 47348d02454f2010737b9d5b4fc59a1030827a3e Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 22 Aug 2022 18:27:21 +0200 Subject: [PATCH] meta: fix linter failures --- .eslintignore | 2 +- examples/transloadit/main.js | 10 ++- examples/transloadit/rollup.config.js | 70 ------------------- .../transloadit/{server.cjs => server.js} | 5 +- 4 files changed, 11 insertions(+), 76 deletions(-) delete mode 100644 examples/transloadit/rollup.config.js rename examples/transloadit/{server.cjs => server.js} (97%) diff --git a/.eslintignore b/.eslintignore index 00a0045697..ed4050d1e7 100644 --- a/.eslintignore +++ b/.eslintignore @@ -9,7 +9,7 @@ website/themes/uppy/source/js/smooth-scroll.min.js website/themes/uppy/source/js/uppy.js website/themes/uppy/source/uppy/** test/endtoend/*/build -examples/dev/output +examples/svelte-example/public/build/ bundle-legacy.js website/src/_posts/201*.md website/src/_posts/2020-*.md diff --git a/examples/transloadit/main.js b/examples/transloadit/main.js index 23c3ae2506..8470c630a6 100644 --- a/examples/transloadit/main.js +++ b/examples/transloadit/main.js @@ -162,9 +162,13 @@ const dashboardModal = new Uppy({ }) dashboardModal.on('complete', ({ transloadit, successful, failed }) => { - console.log(transloadit) - console.log(successful) - console.error(failed) + if (failed?.length !== 0) { + // eslint-disable-next-line no-console + console.error('it failed', failed) + } else { + // eslint-disable-next-line no-console + console.log('success', { transloadit, successful }) + } }) function openModal () { diff --git a/examples/transloadit/rollup.config.js b/examples/transloadit/rollup.config.js deleted file mode 100644 index 11a02ae5d0..0000000000 --- a/examples/transloadit/rollup.config.js +++ /dev/null @@ -1,70 +0,0 @@ -import { spawn } from 'node:child_process' - -import commonjs from '@rollup/plugin-commonjs' -import resolve from '@rollup/plugin-node-resolve' -import livereload from 'rollup-plugin-livereload' -import { terser } from 'rollup-plugin-terser' -import css from 'rollup-plugin-css-only' - -const production = !process.env.ROLLUP_WATCH - -function serve () { - let server - - function toExit () { - if (server) server.kill(0) - } - - return { - writeBundle () { - if (server) return - server = spawn('npm', ['run', 'serve', '--', '--dev'], { - stdio: ['ignore', 'inherit', 'inherit'], - shell: true, - }) - - process.on('SIGTERM', toExit) - process.on('exit', toExit) - }, - } -} - -export default { - input: 'main.js', - output: { - sourcemap: true, - format: 'iife', - name: 'app', - file: 'bundle.js', - }, - plugins: [ - // we'll extract any component CSS out into - // a separate file - better for performance - css({ output: 'uppy.min.css' }), - - // If you have external dependencies installed from - // npm, you'll most likely need these plugins. In - // some cases you'll need additional configuration - - // consult the documentation for details: - // https://github.com/rollup/plugins/tree/master/packages/commonjs - resolve({ - browser: true, - }), - commonjs(), - - // In dev mode, call `npm run start` once - // the bundle has been generated - !production && serve(), - - // Watch the `public` directory and refresh the - // browser on changes when not in production - !production && livereload('public'), - - // If we're building for production (npm run build - // instead of npm run dev), minify - production && terser(), - ], - watch: { - clearScreen: false, - }, -} diff --git a/examples/transloadit/server.cjs b/examples/transloadit/server.js similarity index 97% rename from examples/transloadit/server.cjs rename to examples/transloadit/server.js index 748a03856b..0dbddb8f0a 100755 --- a/examples/transloadit/server.cjs +++ b/examples/transloadit/server.js @@ -86,10 +86,11 @@ function FormFields (fields) { let isValueJSON = false if (value.startsWith('{') || value.startsWith('[')) { try { + // eslint-disable-next-line no-param-reassign value = JSON.stringify( JSON.parse(value), - null, - 2 + null, + 2, ) isValueJSON = true } catch {