Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump eslint-plugin-unicorn from 52.0.0 to 53.0.0 #1336

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions @types/lib/metadataTypes/Automation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,12 @@ declare namespace Automation {
template: boolean;
};
'steps[].annotation': {
/**
* manages post retrieve steps
*
* @param {AutomationItem} metadata a single automation
* @returns {AutomationItem | void} parsed item
*/
isCreateable: boolean;
isUpdateable: boolean;
retrieving: boolean;
Expand Down
2 changes: 1 addition & 1 deletion @types/lib/metadataTypes/Automation.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ class Mcdev {
File.removeSync(filename);
}

const regex = new RegExp('(\\w+-){4}\\w+');
const regex = new RegExp(String.raw`(\w+-){4}\w+`);
await File.ensureDir(retrieveDir);
const metadata = Deployer.readBUMetadata(retrieveDir, null, true);
let output = '# List of Metadata with Name-Key mismatches\n';
Expand Down
2 changes: 1 addition & 1 deletion lib/metadataTypes/Asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ class Asset extends MetadataType {
mode
) {
// * because asset's _mergeCode() is overwriting 'metadata', clone it to ensure the main file is not modified by what we do in here
metadata = JSON.parse(JSON.stringify(metadata));
metadata = structuredClone(metadata);

// #1 text extracts
// define asset's subtype
Expand Down
4 changes: 2 additions & 2 deletions lib/metadataTypes/Automation.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ class Automation extends MetadataType {
);
}
} catch {
val = JSON.parse(JSON.stringify(details));
val = structuredClone(details);
}
if (val === null) {
throw new Error(
Expand Down Expand Up @@ -508,7 +508,7 @@ class Automation extends MetadataType {
}
}
}
return JSON.parse(JSON.stringify(metadata));
return structuredClone(metadata);
} catch (ex) {
Util.logger.warn(
` - ${this.definition.typeName} '${metadata[this.definition.nameField]}': ${
Expand Down
4 changes: 2 additions & 2 deletions lib/metadataTypes/DataExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -1486,8 +1486,8 @@ class DataExtension extends MetadataType {
metadata[key].Fields.sort((a, b) => a.Ordinal - b.Ordinal);

const originalKey = key;
const metadataCleaned = JSON.parse(
JSON.stringify(await this.postRetrieveTasks(metadata[key]))
const metadataCleaned = structuredClone(
await this.postRetrieveTasks(metadata[key])
);

this.keepTemplateFields(metadataCleaned);
Expand Down
4 changes: 2 additions & 2 deletions lib/metadataTypes/DataExtensionField.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class DataExtensionField extends MetadataType {
}
}
// share fields with fixShared logic
this.fixShared_fields[deKey][item.Name] = JSON.parse(JSON.stringify(item));
this.fixShared_fields[deKey][item.Name] = structuredClone(item);
this.fixShared_fields[deKey][item.Name].FieldType = itemOld.FieldType;

if (!changeFound) {
Expand Down Expand Up @@ -227,7 +227,7 @@ class DataExtensionField extends MetadataType {
// Field doesn't exist in target, therefore Remove ObjectID if present
delete item.ObjectID;

this.fixShared_fields[deKey][item.Name] = JSON.parse(JSON.stringify(item));
this.fixShared_fields[deKey][item.Name] = structuredClone(item);
}
if (Util.isTrue(item.IsPrimaryKey) && Util.isFalse(item.IsRequired)) {
// applicable: with or without data
Expand Down
2 changes: 1 addition & 1 deletion lib/metadataTypes/DataExtract.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class DataExtract extends MetadataType {
` - ${this.definition.type} ${metadata[this.definition.keyField]}: ${ex.message}`
);
}
return JSON.parse(JSON.stringify(metadata));
return structuredClone(metadata);
}
/**
* helper to allow us to select single metadata entries via REST
Expand Down
6 changes: 3 additions & 3 deletions lib/metadataTypes/Folder.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class Folder extends MetadataType {
* @returns {Promise.<object>} Promise of saved metadata
*/
static async upsert(metadata) {
const orignalMetadata = JSON.parse(JSON.stringify(metadata));
const orignalMetadata = structuredClone(metadata);
let updateCount = 0;
let updateFailedCount = 0;
let createCount = 0;
Expand Down Expand Up @@ -265,7 +265,7 @@ class Folder extends MetadataType {

let result;
// since deployableMetadata will be modified for deploy, make a copy for reference
const beforeMetadata = JSON.parse(JSON.stringify(deployableMetadata));
const beforeMetadata = structuredClone(deployableMetadata);
if (existingId) {
// if an existing folder exists with the same name/path then use that
deployableMetadata.ID = existingId;
Expand Down Expand Up @@ -590,7 +590,7 @@ class Folder extends MetadataType {
* @returns {MetadataTypeItem} cloned metadata
*/
static postRetrieveTasks(metadata) {
return JSON.parse(JSON.stringify(metadata));
return structuredClone(metadata);
}
/**
* Helper for writing Metadata to disk, used for Retrieve and deploy
Expand Down
10 changes: 5 additions & 5 deletions lib/metadataTypes/MetadataType.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class MetadataType {
* @returns {MetadataTypeItem} cloned metadata
*/
static postRetrieveTasks(metadata, targetDir, isTemplating) {
return JSON.parse(JSON.stringify(metadata));
return structuredClone(metadata);
}
/**
* generic script that retrieves the folder path from cache and updates the given metadata with it after retrieve
Expand Down Expand Up @@ -529,7 +529,7 @@ class MetadataType {
return true;
}
// we do need the full set in other places and hence need to work with a clone here
const clonedMetada = JSON.parse(JSON.stringify(metadata));
const clonedMetada = structuredClone(metadata);
this.removeNotUpdateableFields(clonedMetada);
// iterate over what we want to upload rather than what we cached to avoid false positives
for (const prop in clonedMetada) {
Expand Down Expand Up @@ -577,7 +577,7 @@ class MetadataType {
* @returns {Promise.<MetadataTypeMap>} keyField => metadata map
*/
static async upsert(metadataMap, deployDir) {
const orignalMetadataMap = JSON.parse(JSON.stringify(metadataMap));
const orignalMetadataMap = structuredClone(metadataMap);
const metadataToUpdate = [];
const metadataToCreate = [];
let filteredByPreDeploy = 0;
Expand Down Expand Up @@ -893,7 +893,7 @@ class MetadataType {
* @returns {Promise.<object> | null} Promise of API response or null in case of an error
*/
static async createREST(metadataEntry, uri, handleOutside) {
const metadataClone = JSON.parse(JSON.stringify(metadataEntry));
const metadataClone = structuredClone(metadataEntry);
this.removeNotCreateableFields(metadataEntry);
try {
// set to empty object in case API returned nothing to be able to update it in helper classes
Expand Down Expand Up @@ -1787,7 +1787,7 @@ class MetadataType {
// we dont store Id on local disk, but we need it for caching logic,
// so its in retrieve but not in save. Here we put into the clone so that the original
// object used for caching doesnt have the Id removed.
const saveClone = JSON.parse(JSON.stringify(results[originalKey]));
const saveClone = structuredClone(results[originalKey]);
if (
!this.definition.keepId &&
this.definition.idField !== this.definition.keyField
Expand Down
2 changes: 1 addition & 1 deletion lib/util/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function setupSDK(sessionKey, authObject) {
Util.logger.errorStack(ex);
},
logRequest: (req) => {
const msg = JSON.parse(JSON.stringify(req));
const msg = structuredClone(req);
if (msg.url === '/Service.asmx') {
msg.data = msg.data.replaceAll(
/<fueloauth(.*)<\/fueloauth>/gim,
Expand Down
6 changes: 3 additions & 3 deletions lib/util/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ export const Util = {

sortable.sort((a, b) => b[1].length - a[1].length);
for (const pair of sortable) {
const escVal = pair[1].toString().replaceAll(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
const escVal = pair[1].toString().replaceAll(/[-/\\^$*+?.()|[\]{}]/g, String.raw`\$&`);
const regString = new RegExp(escVal, 'g');
str = str.replace(regString, '{{{' + pair[0] + '}}}');
}
Expand Down Expand Up @@ -875,8 +875,8 @@ export const Util = {
}
// Remove special chars
search = search.replaceAll(
new RegExp('([\\.\\\\\\+\\*\\?\\[\\^\\]\\$\\(\\)\\{\\}\\=\\!\\<\\>\\|\\:\\-])', 'g'),
'\\$1'
new RegExp(String.raw`([\.\\\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:\-])`, 'g'),
String.raw`\$1`
);
// Replace % and _ with equivalent regex
search = search.replaceAll('%', '.*').replaceAll('_', '.');
Expand Down
Loading
Loading