Przeglądaj źródła

meta: fix linter failures (#4029)

Antoine du Hamel 2 lat temu
rodzic
commit
70a4615a47

+ 1 - 1
.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

+ 7 - 3
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 () {

+ 0 - 70
examples/transloadit/rollup.config.js

@@ -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,
-  },
-}

+ 3 - 2
examples/transloadit/server.cjs → 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 {