Skip to content

Commit

Permalink
style: apply automated linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
megalinter-bot committed Sep 7, 2023
1 parent b7ed110 commit 7d24e8d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
6 changes: 3 additions & 3 deletions tests/helpers/diagnostics.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {validationHelper} from 'langium/test';
import {LangiumServices} from 'langium';
import {Diagnostic, DiagnosticSeverity} from 'vscode-languageserver-types';
import { validationHelper } from 'langium/test';
import { LangiumServices } from 'langium';
import { Diagnostic, DiagnosticSeverity } from 'vscode-languageserver-types';

/**
* Get syntax errors from a code snippet.
Expand Down
2 changes: 1 addition & 1 deletion tests/language/grammar/testGrammar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { AssertionError } from 'assert';
import { NodeFileSystem } from 'langium/node';
import { createGrammarTests } from './creator.js';
import { clearDocuments } from 'langium/test';
import {getSyntaxErrors} from "../../helpers/diagnostics.js";
import { getSyntaxErrors } from '../../helpers/diagnostics.js';

const services = createSafeDsServices(NodeFileSystem).SafeDs;

Expand Down
4 changes: 2 additions & 2 deletions tests/language/validation/creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ const validSeverities = ['error', 'warning', 'info', 'hint'] as const;
/**
* The severity of the issue.
*/
export type Severity = typeof validSeverities[number];
export type Severity = (typeof validSeverities)[number];

/**
* A test comment did not match the expected format.
Expand All @@ -199,6 +199,6 @@ class InvalidCommentError extends Error {
*/
class InvalidSeverityError extends Error {
constructor(readonly type: string) {
super(`Invalid severity (valid values are ${validSeverities.join(", ")}): ${type}`);
super(`Invalid severity (valid values are ${validSeverities.join(', ')}): ${type}`);
}
}
14 changes: 9 additions & 5 deletions tests/language/validation/testValidation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ describe('validation', async () => {
if (expectedIssue.presence === 'present') {
if (actualIssues.length === 0) {
throw new AssertionError({
message: `Expected to find a matching issue ${issueLocationToString(expectedIssue)} but found none.`,
message: `Expected to find a matching issue ${issueLocationToString(
expectedIssue,
)} but found none.`,
actual: [],
expected: [expectedIssue],
});
Expand All @@ -42,7 +44,9 @@ describe('validation', async () => {
else {
if (actualIssues.length > 0) {
throw new AssertionError({
message: `Expected to find no matching issue ${issueLocationToString(expectedIssue)} but found some.`,
message: `Expected to find no matching issue ${issueLocationToString(
expectedIssue,
)} but found some.`,
actual: actualIssues,
expected: [],
});
Expand Down Expand Up @@ -92,7 +96,7 @@ const getMatchingActualIssues = (expectedIssue: ExpectedIssue): Diagnostic[] =>
result = result.filter((d) => isRangeEqual(d.range, expectedIssue.range!));
}

return result
return result;
};

/**
Expand All @@ -102,8 +106,8 @@ const getMatchingActualIssues = (expectedIssue: ExpectedIssue): Diagnostic[] =>
*/
const issueLocationToString = (expectedIssue: ExpectedIssue): string => {
if (expectedIssue.range) {
return `at ${locationToString({uri: expectedIssue.uri, range: expectedIssue.range})}`;
return `at ${locationToString({ uri: expectedIssue.uri, range: expectedIssue.range })}`;
} else {
return `in ${expectedIssue.uri}`;
}
}
};

0 comments on commit 7d24e8d

Please sign in to comment.