Skip to content

Commit

Permalink
fix: linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jairo-bc committed Sep 12, 2024
1 parent 4afd56d commit 7ceb007
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 288 deletions.
7 changes: 5 additions & 2 deletions lib/BuildConfigManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { once } from 'lodash-es';
import { fork } from 'child_process';
import path from 'path';
import fsModule from 'fs';
import { createRequire } from "node:module";
import { createRequire } from 'node:module';
import { THEME_PATH } from '../constants.js';

const require = createRequire(import.meta.url);
Expand Down Expand Up @@ -44,9 +44,12 @@ class BuildConfigManager {

_getConfig(configPath, oldConfigPath) {
if (this._fs.existsSync(configPath)) {
// eslint-disable-next-line import/no-dynamic-require
return require(configPath);
} else if (this._fs.existsSync(oldConfigPath)) {
}
if (this._fs.existsSync(oldConfigPath)) {
this._moveOldConfig(configPath, oldConfigPath);
// eslint-disable-next-line import/no-dynamic-require
return require(configPath);
}
return {};
Expand Down
2 changes: 1 addition & 1 deletion lib/BuildConfigManager.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {jest} from '@jest/globals';
import { jest } from '@jest/globals';
import { promisify } from 'util';
import BuildConfigManager from './BuildConfigManager.js';

Expand Down
5 changes: 1 addition & 4 deletions lib/bundle-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ const MAX_SIZE_COMPOSED = 1024 * 1024 * 2; // 2MB
const MAX_SIZE_MOBILE = 1024 * 1024; // 1MB
const MAX_SIZE_DESKTOP = 1024 * 1024 * 5; // 5MB


const privateThemeConfigUrl = new URL('./schemas/privateThemeConfig.json', import.meta.url);
const privateThemeConfigValidationSchema = JSON.parse(
fs.readFileSync(privateThemeConfigUrl),
);
const privateThemeConfigValidationSchema = JSON.parse(fs.readFileSync(privateThemeConfigUrl));

const themeConfigValidationSchemaUrl = new URL('./schemas/themeConfig.json', import.meta.url);
const themeConfigValidationSchema = JSON.parse(fs.readFileSync(themeConfigValidationSchemaUrl));
Expand Down
2 changes: 1 addition & 1 deletion lib/lang-assembler.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {jest} from '@jest/globals';
import { jest } from '@jest/globals';
import fs from 'fs';
import langAssemble from './lang-assembler.js';

Expand Down
2 changes: 1 addition & 1 deletion lib/stencil-start.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {jest} from '@jest/globals';
import { jest } from '@jest/globals';
import path from 'path';
import StencilStart from './stencil-start.js';
import stencilPushUtilsModule from './stencil-push.utils.js';
Expand Down
6 changes: 4 additions & 2 deletions lib/theme-config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import { fileURLToPath } from 'node:url';
import ThemeConfig from './theme-config.js';
import { parseJsonFile } from './utils/fsUtils.js';

const __dirname = dirname(fileURLToPath(import.meta.url));
const getDirname = dirname(fileURLToPath(import.meta.url));

const originalSchema = JSON.parse(fs.readFileSync(path.join(__dirname, '../test/_mocks/themes/valid/schema.json')));
const originalSchema = JSON.parse(
fs.readFileSync(path.join(getDirname, '../test/_mocks/themes/valid/schema.json')),
);
const themePath = path.join(process.cwd(), 'test/_mocks/themes/valid');
const missingVariationsThemePath = path.join(process.cwd(), 'test/_mocks/themes/missing-variation');
const bareBonesThemePath = path.join(process.cwd(), 'test/_mocks/themes/bare-bones');
Expand Down
4 changes: 3 additions & 1 deletion lib/validator/schema-translations.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ const schema = JSON.parse(readFileSync(`${process.cwd()}/test/_mocks/themes/vali
const schemaTranslations = JSON.parse(
readFileSync(`${process.cwd()}/test/_mocks/themes/valid/schemaTranslations.json`),
);
const validationsTranslations = JSON.parse(readFileSync(`${process.cwd()}/lib/schemas/schemaTranslations.json`));
const validationsTranslations = JSON.parse(
readFileSync(`${process.cwd()}/lib/schemas/schemaTranslations.json`),
);

const validatorSchemaTranslations = () => {
return new ValidatorSchemaTranslations();
Expand Down
Loading

0 comments on commit 7ceb007

Please sign in to comment.