Skip to content

Commit

Permalink
fix: Eslint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Jul 12, 2024
1 parent e333be1 commit 1a979d3
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions src/linter/html/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export async function extractJSScriptTags(contentStream: ReadStream) {
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type#attribute_is_not_set_default_an_empty_string_or_a_javascript_mime_type
return attr.name.value !== "type" ||
(attr.name.value === "type" &&
["",
"module",
"text/javascript",
"application/javascript", /* legacy */
].includes(attr.value.value.toLowerCase()));
["",
"module",
"text/javascript",
"application/javascript", /* legacy */
].includes(attr.value.value.toLowerCase()));
});

if (isJSScriptTag) {
Expand Down
4 changes: 2 additions & 2 deletions src/linter/ui5Types/SourceFileLinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class SourceFileLinter {
this.analyzeCallExpression(node as ts.CallExpression); // Check for deprecation
this.analyzeLibInitCall(node as ts.CallExpression); // Check for sap/ui/core/Lib.init usages
} else if (node.kind === ts.SyntaxKind.PropertyAccessExpression ||
node.kind === ts.SyntaxKind.ElementAccessExpression) {
node.kind === ts.SyntaxKind.ElementAccessExpression) {
this.analyzePropertyAccessExpression(
node as (ts.PropertyAccessExpression | ts.ElementAccessExpression)); // Check for global
this.analyzePropertyAccessExpressionForDeprecation(
Expand Down Expand Up @@ -304,7 +304,7 @@ export default class SourceFileLinter {
if (!apiVersionNode) { // No arguments or no 'apiVersion' property
nodeToHighlight = node;
} else if (ts.isPropertyAssignment(apiVersionNode) &&
apiVersionNode.initializer.getText() !== "2") { // String value would be "\"2\""
apiVersionNode.initializer.getText() !== "2") { // String value would be "\"2\""
nodeToHighlight = apiVersionNode;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function getModuleBody(
// node.expression));
}
} else if (ts.isExpressionStatement(node) && ts.isStringLiteral(node.expression) &&
node.expression.text === "use strict") {
node.expression.text === "use strict") {
// Ignore "use strict" directive
continue;
} else {
Expand Down Expand Up @@ -229,10 +229,10 @@ function getModuleBody(
body = [createDefaultExport(nodeFactory, moduleDeclaration.factory.body)];
}
} else if (ts.isClassDeclaration(moduleDeclaration.factory) ||
ts.isLiteralExpression(moduleDeclaration.factory) ||
ts.isArrayLiteralExpression(moduleDeclaration.factory) ||
ts.isObjectLiteralExpression(moduleDeclaration.factory) ||
ts.isPropertyAccessExpression(moduleDeclaration.factory)) {
ts.isLiteralExpression(moduleDeclaration.factory) ||
ts.isArrayLiteralExpression(moduleDeclaration.factory) ||
ts.isObjectLiteralExpression(moduleDeclaration.factory) ||
ts.isPropertyAccessExpression(moduleDeclaration.factory)) {
// Use factory directly
body = [createDefaultExport(nodeFactory, moduleDeclaration.factory)];
} else { // Identifier
Expand Down
2 changes: 1 addition & 1 deletion src/linter/ui5Types/amdTranspiler/rewriteExtendCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function getClassBodyFromArguments(
undefined,
prop.initializer.body);
} else if (ts.isObjectLiteralExpression(prop.initializer) &&
ts.isIdentifier(prop.name) && prop.name.text === "metadata") {
ts.isIdentifier(prop.name) && prop.name.text === "metadata") {
// Transform to *static* property declaration?
// This would align it with how UI5 projects should declare metadata in TypeScript,
// however it's unclear whether this helps our static analysis
Expand Down
4 changes: 2 additions & 2 deletions src/linter/ui5Types/asyncComponentFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ function doPropsCheck(metadata: ts.PropertyDeclaration, manifestContent: string
}

hasManifestDefinition = !!(componentManifest &&
ts.isPropertyAssignment(componentManifest) &&
componentManifest.initializer.getText() === "\"json\"");
ts.isPropertyAssignment(componentManifest) &&
componentManifest.initializer.getText() === "\"json\"");
}

return {
Expand Down
4 changes: 2 additions & 2 deletions src/linter/xmlTemplate/Parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ export default class Parser {

this.#generator.writeRequire(requireExpression);
} else if (resolvedNamespace === FESR_NAMESPACE ||
resolvedNamespace === SAP_BUILD_NAMESPACE || resolvedNamespace === SAP_UI_DT_NAMESPACE) {
resolvedNamespace === SAP_BUILD_NAMESPACE || resolvedNamespace === SAP_UI_DT_NAMESPACE) {
// Silently ignore FESR, sap.build and sap.ui.dt attributes
} else if (resolvedNamespace === CUSTOM_DATA_NAMESPACE) {
// Add custom data element and add it as an aggregation
Expand Down Expand Up @@ -515,7 +515,7 @@ export default class Parser {
}
return ownerAggregation;
} else if (this.#xmlDocumentKind === DocumentKind.Fragment && moduleName === "FragmentDefinition" &&
namespace === CORE_NAMESPACE) {
namespace === CORE_NAMESPACE) {
// This node declares a fragment definition
const node: FragmentDefinitionDeclaration = {
kind: NodeKind.FragmentDefinition,
Expand Down

0 comments on commit 1a979d3

Please sign in to comment.