Skip to content

Commit 1ccb0b7

Browse files
authored
Merge pull request #654 from contentstack/code/refactor
eslint problems refactored
2 parents ef81125 + 0c9457f commit 1ccb0b7

File tree

10 files changed

+14
-16
lines changed

10 files changed

+14
-16
lines changed

upload-api/migration-wordpress/libs/content_types.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ var globalPrefix = '';
3232
const generateUid = (suffix) => {
3333
const isPresent = restrictedUid?.find((item) => item === globalPrefix);
3434

35-
return isPresent
36-
? `${globalPrefix
35+
return isPresent ? `${globalPrefix
3736
.replace(/^\d+/, '')
3837
.replace(/[^a-zA-Z0-9]+/g, '_')
3938
.replace(/(^_+)|(_+$)/g, '')
@@ -519,8 +518,7 @@ async function extractContentTypes(affix) {
519518

520519
const isPresent = restrictedUid?.find((item) => item === affix);
521520
globalPrefix = isPresent ? affix : '';
522-
const schemaJson = ContentTypesSchema.map(({ title, uid, schema, options }, index) => {
523-
//console.log(`Mapping item at index ${index}:`, generateSchema(title, uid, schema, options));
521+
const schemaJson = ContentTypesSchema.map(({ title, uid, schema, options },) => {
524522
return generateSchema(title, uid, schema, options);
525523
});
526524

upload-api/migration-wordpress/libs/extractLocale.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ const extractLocale = (path) => {
2323
const items = jsonData?.rss?.channel?.item || [];
2424
items.forEach((item) => {
2525
if (item['wp:postmeta']) {
26-
const postMeta = Array.isArray(item['wp:postmeta'])
27-
? item['wp:postmeta']
26+
const postMeta = Array.isArray(item['wp:postmeta'])? item['wp:postmeta']
2827
: [item['wp:postmeta']];
2928
postMeta.forEach((meta) => {
3029
if (meta['wp:meta_key']?.toLowerCase() === 'language' && meta['wp:meta_value']) {

upload-api/src/controllers/sitecore/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const createSitecoreMapper = async (filePath: string = "", projectId: string | s
7878
data: JSON.stringify(fieldMapping),
7979
};
8080

81-
const {data, status} = await axios.request(config);
81+
const {data} = await axios.request(config);
8282

8383
if (data?.data?.content_mapper?.length) {
8484
deleteFolderSync(infoMap?.path);

upload-api/src/controllers/wordpress/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { extractContentTypes, contentTypeMaker, extractLocale } = require('migrat
66

77

88

9-
const createWordpressMapper = async (filePath: string = "", projectId: string | string[], app_token: string | string[], affix: string | string[], config: object) => {
9+
const createWordpressMapper = async (filePath: string = "", projectId: string | string[], app_token: string | string[], affix: string | string[]) => {
1010
try {
1111

1212
const localeData = await extractLocale(filePath);
@@ -31,7 +31,7 @@ const createWordpressMapper = async (filePath: string = "", projectId: string |
3131
},
3232
data: JSON.stringify(fieldMapping),
3333
};
34-
const {data, status} = await axios.request(config);
34+
const {data} = await axios.request(config);
3535
if (data?.data?.content_mapper?.length) {
3636
logger.info('Validation success:', {
3737
status: HTTP_CODES?.OK,

upload-api/src/helper/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import rateLimit from "express-rate-limit";
22
import fs from "fs";
33
import path from "path";
44
import xml2js from 'xml2js'
5-
import { HTTP_TEXTS, HTTP_CODES, MIGRATION_DATA_CONFIG } from '../constants';
5+
import { HTTP_TEXTS, HTTP_CODES} from '../constants';
66
import logger from "../utils/logger";
77

88
const getFileName = (params: { Key: string }) => {

upload-api/src/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { cliux, messageHandler } from '@contentstack/cli-utilities';
22
import isEmpty from 'lodash.isempty';
33

4-
const migFunction = () => {
5-
console.log('test');
6-
};
4+
// const migFunction = () => {
5+
// console.log('test');
6+
// };
77

88
function inquireRequireFieldValidation(input: any): string | boolean {
99
if (isEmpty(input)) {

upload-api/src/services/contentful/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const createContentfulMapper = async (
3030
},
3131
data: JSON.stringify(initialMapper)
3232
};
33-
const { data, status } = await axios.request(req);
33+
const { data} = await axios.request(req);
3434
if (data?.data?.content_mapper?.length) {
3535
logger.info('Validation success:', {
3636
status: HTTP_CODES?.OK,

upload-api/src/services/createMapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const createMapper = async (
2121
}
2222

2323
case 'wordpress': {
24-
return createWordpressMapper(filePath, projectId, app_token, affix, config);
24+
return createWordpressMapper(filePath, projectId, app_token, affix);
2525
}
2626

2727
// case 'aem': {

upload-api/src/validators/aem/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async function aemValidator({ data }: ValidatorProps) {
2323
for (const fileName of fileNames) {
2424
const file: any = data?.files?.[fileName];
2525
if (!file?.dir) {
26-
const content = await file.async('string');
26+
// const content = await file.async('string');
2727
if (`content.${test}.root`) {
2828
return true;
2929
}

upload-api/src/validators/wordpress/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-unused-vars */
12
import Config from '../../models/wordpress.json';
23
import * as Cheerio from 'cheerio';
34

0 commit comments

Comments
 (0)