I would like to clarify a question about VSCode indentation.
My employee is using the Prettier extension for code formatting.
A function that was supposed to look like this:
function evaluateCandidate(age, salary, experience, educationLevel) {
if (age < 18) {
return "Age below the minimum required.";
} else if (age > 65) {
return "Age above the allowed limit.";
}
if (salary < 3000) {
return "Salary below the minimum acceptable.";
} else if (salary > 10000) {
return "Salary above the maximum acceptable.";
}
if (experience < 2) {
return "Insufficient experience.";
}
if (educationLevel !== "Bachelor's Degree" && educationLevel !== "Master's Degree" && educationLevel !== "PhD") {
return "Education level not met.";
}
return "Candidate approved!";
}
Is being formatted like this:
function evaluateCandidate(
age,
salary,
experience,
educationLevel,
) {
if (
age < 18
) {
return "Age below the minimum required.";
} else if (
age > 65
) {
return "Age above the allowed limit.";
}
if (
salary < 3000
) {
return "Salary below the minimum acceptable.";
} else if (
salary > 10000
) {
return "Salary above the maximum acceptable.";
}
if (
experience < 2
) {
return "Insufficient experience.";
}
if (
educationLevel !== "Bachelor's Degree" &&
educationLevel !== "Master's Degree" &&
educationLevel !== "PhD"
) {
return "Education level not met.";
}
return "Candidate approved!";
}
For a simple function like this, it might not make much difference. But in a large project, it makes a significant impact because other employees waste time adjusting the indentation and trying to understand what this ****** is doing.
I would like to know if there is a way for other employees to configure something to remove or override Prettier’s indentation.
If there is no way, I will need to dismiss him.
I have already tried configuring Prettier to undo the default settings it applies, but it doesn’t work.