fix test lint

This commit is contained in:
Matteo Pagliazzi
2019-10-08 20:45:38 +02:00
parent e37f4467f8
commit 85fb5f33aa
367 changed files with 6635 additions and 6080 deletions
+6 -7
View File
@@ -1,21 +1,20 @@
'use strict';
let glob = require('glob').sync;
const glob = require('glob').sync;
describe('Locales files', () => {
it('do not contain duplicates of any keys', () => {
let translationFiles = glob('./website/common/locales/en/*.json');
const translationFiles = glob('./website/common/locales/en/*.json');
if (translationFiles.length === 0) {
throw new Error('Could not find any files in ./website/common/locales/en/*.json');
}
let keys = {};
const keys = {};
translationFiles.forEach((file) => {
let json = require(`../.${file}`); // eslint-disable-line global-require
translationFiles.forEach(file => {
const json = require(`../.${file}`); // eslint-disable-line global-require, import/no-dynamic-require
Object.keys(json).forEach((key) => {
Object.keys(json).forEach(key => {
if (keys[key]) {
throw new Error(`${key} in ${file} already exists in ${keys[key]}.`);
}
+5 -6
View File
@@ -1,20 +1,19 @@
'use strict';
let glob = require('glob').sync;
let readFile = require('fs').readFileSync;
const glob = require('glob').sync;
const readFile = require('fs').readFileSync;
const IMPORT_REGEX = /(import|require).*common\/script/;
describe('Use Proper Babel Paths', () => {
it('uses proper babel files in website/server', () => {
let websiteServerPaths = glob('./website/server/**/*.js');
const websiteServerPaths = glob('./website/server/**/*.js');
if (websiteServerPaths.length === 0) {
throw new Error('Could not find any files in website/server/**/*.js');
}
websiteServerPaths.forEach((filePath) => {
let file = readFile(filePath, {encoding: 'utf8'});
websiteServerPaths.forEach(filePath => {
const file = readFile(filePath, { encoding: 'utf8' });
try {
expect(file).to.not.match(IMPORT_REGEX);