Skip to content

Commit

Permalink
refactor: Rename variable to more meaningful name
Browse files Browse the repository at this point in the history
  • Loading branch information
maxreichmann committed Sep 26, 2024
1 parent 199f616 commit 703100c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/linter/fileTypes/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ const deprecatedViewFileTypes = [
];

export default async function lintFileTypes({workspace, context}: LinterParameters) {
let xmlResources: Resource[];
let potentialDeprecatedResources: Resource[];
const pathsToLint = context.getPathsToLint();
if (pathsToLint?.length) {
xmlResources = [];
potentialDeprecatedResources = [];
await Promise.all(pathsToLint.map(async (resourcePath) => {
if (!deprecatedViewFileTypes.some((type) => resourcePath.endsWith(type))) {
return;
Expand All @@ -26,13 +26,14 @@ export default async function lintFileTypes({workspace, context}: LinterParamete
if (!resource) {
throw new Error(`Resource not found: ${resourcePath}`);
}
xmlResources.push(resource);
potentialDeprecatedResources.push(resource);
}));
} else {
xmlResources = await workspace.byGlob(`**/{${deprecatedViewFileTypes.map((type) => `*${type}`).join(",")}}`);
potentialDeprecatedResources =
await workspace.byGlob(`**/{${deprecatedViewFileTypes.map((type) => `*${type}`).join(",")}}`);
}

xmlResources.forEach((resource: Resource) => {
potentialDeprecatedResources.forEach((resource: Resource) => {
const fileSuffix = resource.getPath().split(".").pop()!.toUpperCase();
context.addLintingMessage(resource.getPath(), MESSAGE.DEPRECATED_VIEW_TYPE, {viewType: fileSuffix});
});
Expand Down

0 comments on commit 703100c

Please sign in to comment.