From 80e9f129d84aee7162fe15614845299d474d0b0e Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Thu, 1 Mar 2018 21:36:45 -0800 Subject: [PATCH] ignore some lint warnings --- app/base.css | 1 + app/dragManager.js | 6 +++--- app/fileManager.js | 3 +++ app/pages/welcome/index.js | 3 ++- common/locales.js | 3 ++- server/middleware/language.js | 4 ++++ 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/base.css b/app/base.css index 93e26a13..4168c387 100644 --- a/app/base.css +++ b/app/base.css @@ -123,6 +123,7 @@ a { cursor: pointer; /* Force flat button look */ + /* stylelint-disable-next-line plugin/no-unsupported-browser-features */ appearance: none; font-size: 15px; padding-bottom: 3px; diff --git a/app/dragManager.js b/app/dragManager.js index 3d4d810e..905f14a3 100644 --- a/app/dragManager.js +++ b/app/dragManager.js @@ -19,6 +19,7 @@ export default function(state, emitter) { return; } if (target.files.length > 1) { + // eslint-disable-next-line no-alert return alert(state.translate('uploadPageMultipleFilesAlert')); } const file = target.files[0]; @@ -26,9 +27,8 @@ export default function(state, emitter) { return; } if (file.size > MAXFILESIZE) { - window.alert( - state.translate('fileTooBig', { size: bytes(MAXFILESIZE) }) - ); + // eslint-disable-next-line no-alert + alert(state.translate('fileTooBig', { size: bytes(MAXFILESIZE) })); return; } emitter.emit('upload', { file, type: 'drop' }); diff --git a/app/fileManager.js b/app/fileManager.js index d1860c1d..0dab3cba 100644 --- a/app/fileManager.js +++ b/app/fileManager.js @@ -111,6 +111,7 @@ export default function(state, emitter) { openLinksInNewTab(links, false); emitter.emit('pushState', `/share/${ownedFile.id}`); } catch (err) { + // eslint-disable-next-line no-console console.error(err); if (err.message === '0') { @@ -136,6 +137,7 @@ export default function(state, emitter) { metrics.addedPassword({ size: file.size }); await delay(1000); } catch (err) { + // eslint-disable-next-line no-console console.error(err); state.passwordSetError = err; } finally { @@ -186,6 +188,7 @@ export default function(state, emitter) { state.transfer.reset(); return render(); } + // eslint-disable-next-line no-console console.error(err); state.transfer = null; const location = err.message === '404' ? '/404' : '/error'; diff --git a/app/pages/welcome/index.js b/app/pages/welcome/index.js index 22da7656..6711cf43 100644 --- a/app/pages/welcome/index.js +++ b/app/pages/welcome/index.js @@ -73,7 +73,8 @@ module.exports = function(state, emit) { return; } if (file.size > MAXFILESIZE) { - window.alert(state.translate('fileTooBig', { size: bytes(MAXFILESIZE) })); + // eslint-disable-next-line no-alert + alert(state.translate('fileTooBig', { size: bytes(MAXFILESIZE) })); return; } diff --git a/common/locales.js b/common/locales.js index 17eb9c2a..ba1476de 100644 --- a/common/locales.js +++ b/common/locales.js @@ -4,7 +4,7 @@ const isServer = typeof gen === 'function'; const prefix = isServer ? '/' : ''; let manifest = {}; try { - //eslint-disable-next-line node/no-missing-require + // eslint-disable-next-line node/no-missing-require manifest = require('../dist/manifest.json'); } catch (e) { // use middleware @@ -17,6 +17,7 @@ function getLocale(name) { } function serverTranslator(name) { + // eslint-disable-next-line security/detect-non-literal-require return require(`../dist/${locales[`public/locales/${name}/send.ftl`]}`); } diff --git a/server/middleware/language.js b/server/middleware/language.js index 88282642..7cbe2ecb 100644 --- a/server/middleware/language.js +++ b/server/middleware/language.js @@ -4,6 +4,10 @@ const fs = require('fs'); const path = require('path'); const { negotiateLanguages } = require('fluent-langneg'); const langData = require('cldr-core/supplemental/likelySubtags.json'); + +// We return early in the middleware if the lang header is long. +// If that ever changes we should re-evaluate this regex. +// eslint-disable-next-line security/detect-unsafe-regex const acceptLanguages = /(([a-zA-Z]+(-[a-zA-Z0-9]+){0,2})|\*)(;q=[0-1](\.[0-9]+)?)?/g; function allLangs() {