Before save:
`['bud_1', 'pm_1', 'apm'].forEach((field) => {
let user = this.generalData.users.find((i) => i.sage_id == row[field])
if (user) {
row[`${field}_name`] = user.initials
}
})
// Mapping company fields together
['architect', 'client', 'engineer', 'owner_rep', 'other_company'].forEach(
(field) => {
let company = this.generalData.companies.find(
(i) => i.id == row[field]
)
if (company) {
row[`${field}_name`] = company.company
}
}
)`
After save:
`;['bud_1', 'pm_1', 'apm']
.forEach((field) => {
let user = this.generalData.users.find((i) => i.sage_id == row[field])
if (user) {
row[`${field}_name`] = user.initials
}
})
[
// Mapping company fields together
('architect', 'client', 'engineer', 'owner_rep', 'other_company')
].forEach((field) => {
let company = this.generalData.companies.find(
(i) => i.id == row[field]
)
if (company) {
row[`${field}_name`] = company.company
}
}`
My current settings:
{ "editor.tabSize": 2, "editor.detectIndentation": false, "editor.formatOnPaste": true, "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, "editor.formatOnType": true, "typescript.format.insertSpaceAfterConstructor": true, "typescript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": true, "typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": true, "typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": true, "typescript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": true, "typescript.format.insertSpaceAfterTypeAssertion": true, "typescript.format.insertSpaceBeforeFunctionParenthesis": true, "typescript.format.placeOpenBraceOnNewLineForControlBlocks": true, "typescript.format.placeOpenBraceOnNewLineForFunctions": true, "css.format.spaceAroundSelectorSeparator": true, "less.format.spaceAroundSelectorSeparator": true, "javascript.format.insertSpaceAfterConstructor": true, "javascript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": true, "javascript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": true, "javascript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces": false, "javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false, "html.format.indentInnerHtml": true, "html.format.indentHandlebars": true, "prettier.printWidth": 90, "prettier.semi": false }
I am not sure what is auto formatting to add semicolons and also putting the comments in the square brackets. Any advice would be helpful, thanks!