updated eslint config

This commit is contained in:
Danny Coates 2019-08-02 12:03:53 -07:00
parent 20c063db7c
commit f036df5f47
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
9 changed files with 30 additions and 16 deletions

View File

@ -2,5 +2,6 @@ dist
assets assets
firefox firefox
coverage coverage
android/app/build
app/locale.js app/locale.js
app/capabilities.js app/capabilities.js

View File

@ -4,6 +4,7 @@ env:
extends: extends:
- eslint:recommended - eslint:recommended
- prettier
- plugin:node/recommended - plugin:node/recommended
- plugin:security/recommended - plugin:security/recommended
@ -22,13 +23,5 @@ rules:
security/detect-non-literal-fs-filename: off security/detect-non-literal-fs-filename: off
security/detect-object-injection: off security/detect-object-injection: off
eol-last: [error, always]
eqeqeq: error
no-alert: warn
no-console: warn
no-path-concat: error
no-unused-vars: [error, {argsIgnorePattern: "^_|err|event|next|reject"}] no-unused-vars: [error, {argsIgnorePattern: "^_|err|event|next|reject"}]
no-var: error require-atomic-updates: warn
one-var: [error, never]
prefer-const: error
quotes: [error, single, {avoidEscape: true}]

View File

@ -312,12 +312,13 @@ export function downloadStream(id, keychain) {
////////////////// //////////////////
function download(id, keychain, onprogress, canceller) { async function download(id, keychain, onprogress, canceller) {
const auth = await keychain.authHeader();
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
canceller.oncancel = function() { canceller.oncancel = function() {
xhr.abort(); xhr.abort();
}; };
return new Promise(async function(resolve, reject) { return new Promise(function(resolve, reject) {
xhr.addEventListener('loadend', function() { xhr.addEventListener('loadend', function() {
canceller.oncancel = function() {}; canceller.oncancel = function() {};
const authHeader = xhr.getResponseHeader('WWW-Authenticate'); const authHeader = xhr.getResponseHeader('WWW-Authenticate');
@ -337,7 +338,6 @@ function download(id, keychain, onprogress, canceller) {
onprogress(event.loaded); onprogress(event.loaded);
} }
}); });
const auth = await keychain.authHeader();
xhr.open('get', getApiUrl(`/api/download/blob/${id}`)); xhr.open('get', getApiUrl(`/api/download/blob/${id}`));
xhr.setRequestHeader('Authorization', auth); xhr.setRequestHeader('Authorization', auth);
xhr.responseType = 'blob'; xhr.responseType = 'blob';

View File

@ -1,4 +1,4 @@
/* global ReadableStream TransformStream */ /* global TransformStream */
export function transformStream(readable, transformer, oncancel) { export function transformStream(readable, transformer, oncancel) {
try { try {

17
package-lock.json generated
View File

@ -5591,6 +5591,23 @@
} }
} }
}, },
"eslint-config-prettier": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.0.0.tgz",
"integrity": "sha512-vDrcCFE3+2ixNT5H83g28bO/uYAwibJxerXPj+E7op4qzBCsAV36QfvdAyVOoNxKAH2Os/e01T/2x++V0LPukA==",
"dev": true,
"requires": {
"get-stdin": "^6.0.0"
},
"dependencies": {
"get-stdin": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz",
"integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==",
"dev": true
}
}
},
"eslint-plugin-es": { "eslint-plugin-es": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-1.4.0.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-1.4.0.tgz",

View File

@ -80,6 +80,7 @@
"css-mqpacker": "^7.0.0", "css-mqpacker": "^7.0.0",
"cssnano": "^4.1.10", "cssnano": "^4.1.10",
"eslint": "^6.1.0", "eslint": "^6.1.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-mocha": "^6.0.0", "eslint-plugin-mocha": "^6.0.0",
"eslint-plugin-node": "^9.1.0", "eslint-plugin-node": "^9.1.0",
"eslint-plugin-security": "^1.4.0", "eslint-plugin-security": "^1.4.0",

View File

@ -19,8 +19,8 @@ exec(cmd)
const locales = Object.keys(summary) const locales = Object.keys(summary)
.filter(locale => { .filter(locale => {
const loc = summary[locale]; const loc = summary[locale];
const hasMissing = loc.hasOwnProperty('missing'); const hasMissing = Object.prototype.hasOwnProperty.call(loc, 'missing');
const hasErrors = loc.hasOwnProperty('errors'); const hasErrors = Object.prototype.hasOwnProperty.call(loc, 'errors');
return !hasMissing && !hasErrors; return !hasMissing && !hasErrors;
}) })
.sort(); .sort();

View File

@ -33,7 +33,7 @@ function filterErrors(details) {
.sort() .sort()
.map(locale => { .map(locale => {
const data = details[locale] const data = details[locale]
.filter(item => item.hasOwnProperty('error')) .filter(item => Object.prototype.hasOwnProperty.call(item, 'error'))
.map(({ error }) => error); .map(({ error }) => error);
return { locale, data }; return { locale, data };
}) })

View File

@ -19,5 +19,7 @@ rules:
mocha/no-pending-tests: error mocha/no-pending-tests: error
mocha/no-return-and-callback: warn mocha/no-return-and-callback: warn
mocha/no-skipped-tests: error mocha/no-skipped-tests: error
mocha/no-setup-in-describe: off
mocha/no-hooks-for-single-case: off
no-console: off # ¯\_(ツ)_/¯ no-console: off # ¯\_(ツ)_/¯