Lint the language service package

This commit is contained in:
Josh Gross
2023-03-15 16:52:56 -04:00
parent 7bb8ff9aae
commit 26f5eeede9
21 changed files with 66 additions and 54 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ function testFindToken(input: string): {
parent: getTokenInfo(r.parent),
key: getTokenInfo(r.keyToken),
token: getTokenInfo(r.token),
path: r.path.map(x => getTokenInfo(x)!)
path: r.path.map(x => getTokenInfo(x)!) // eslint-disable-line @typescript-eslint/no-non-null-assertion
};
}
+5 -4
View File
@@ -52,7 +52,7 @@ export function findToken(pos: Position, root?: TemplateToken): TokenResult {
];
while (s.length > 0) {
const result = s.shift()!;
const result = s.shift()!; // eslint-disable-line @typescript-eslint/no-non-null-assertion
const {parent, token, keyToken, path} = result;
if (!token) {
break;
@@ -67,7 +67,7 @@ export function findToken(pos: Position, root?: TemplateToken): TokenResult {
// Position is in token, enqueue children if there are any
switch (token.templateTokenType) {
case TokenType.Mapping:
case TokenType.Mapping: {
const mappingToken = token as MappingToken;
for (const {key, value} of mappingToken) {
// If the position is within the key, immediately return it as the token.
@@ -99,8 +99,8 @@ export function findToken(pos: Position, root?: TemplateToken): TokenResult {
});
}
continue;
case TokenType.Sequence:
}
case TokenType.Sequence: {
const sequenceToken = token as SequenceToken;
for (const token of sequenceToken) {
s.push({
@@ -111,6 +111,7 @@ export function findToken(pos: Position, root?: TemplateToken): TokenResult {
});
}
continue;
}
}
return {
@@ -43,8 +43,8 @@ function getLineCharCode(doc: TextDocument, lineNumber: number, index: number):
*--------------------------------------------------------------------------------------------*/
class SpacesDiffResult {
public spacesDiff: number = 0;
public looksLikeAlignment: boolean = false;
public spacesDiff = 0;
public looksLikeAlignment = false;
}
/**
+2 -1
View File
@@ -39,7 +39,8 @@ export async function fetchOrConvertWorkflowTemplate(
if (!template) {
template = await convertWorkflowTemplate(
parsedWorkflow.context,
parsedWorkflow.value!,
// TODO: @joshmgross We can't assume that the value is non-null here
parsedWorkflow.value!, // eslint-disable-line @typescript-eslint/no-non-null-assertion
config?.fileProvider,
options
);