eslint: prefer-const, no-loop-func, no-const-assign, no-var

This commit is contained in:
Alex Gleason
2021-08-03 12:10:42 -05:00
parent 249c76ffaa
commit a310197a5a
53 changed files with 136 additions and 136 deletions

View File

@ -25,7 +25,7 @@ const backendEndpoints = [
];
const makeProxyConfig = () => {
let proxyConfig = {};
const proxyConfig = {};
proxyConfig['/api/patron'] = {
target: patronUrl,
secure: secureProxy,

View File

@ -105,7 +105,7 @@ manageTranslations({
/* eslint-disable no-console */
function findVariablesinAST(tree) {
let result = new Set();
const result = new Set();
tree.forEach((element) => {
switch (element.type) {
case parser.TYPE.argument:
@ -114,7 +114,7 @@ function findVariablesinAST(tree) {
break;
case parser.TYPE.plural:
result.add(element.value);
let subTrees = Object.values(element.options).map((option) => option.value);
const subTrees = Object.values(element.options).map((option) => option.value);
subTrees.forEach((subtree) => {
findVariablesinAST(subtree).forEach((variable) => {
result.add(variable);
@ -139,7 +139,7 @@ const extractedMessagesFiles = readMessageFiles(translationsDirectory);
const extractedMessages = extractedMessagesFiles.reduce((acc, messageFile) => {
messageFile.descriptors.forEach((descriptor) => {
descriptor.descriptors.forEach((item) => {
let variables = findVariables(item.defaultMessage);
const variables = findVariables(item.defaultMessage);
acc.push({
id: item.id,
defaultMessage: item.defaultMessage,
@ -172,7 +172,7 @@ function pushIfUnique(arr, newItem) {
const problems = translations.reduce((acc, translation) => {
extractedMessages.forEach((message) => {
try {
let translationVariables = findVariables(translation.data[message.id]);
const translationVariables = findVariables(translation.data[message.id]);
if ([...difference(translationVariables, message.variables)].length > 0) {
pushIfUnique(acc, {
language: translation.language,
@ -206,7 +206,7 @@ if (problems.length > 0) {
console.error('-'.repeat(60));
problems.forEach((problem) => {
let color = (problem.severity === 'error') ? '\x1b[31m' : '';
const color = (problem.severity === 'error') ? '\x1b[31m' : '';
console.error(`${color}${problem.language}\t${problem.type}\t${problem.id}\x1b[0m`);
});
console.error('\n');