diff --git a/server/src/linter.ts b/server/src/linter.ts index 19f98f0..d902348 100644 --- a/server/src/linter.ts +++ b/server/src/linter.ts @@ -17,6 +17,13 @@ const filters = [ const files = new Map() +type IncludeObj = { + lineNum: number, + lineNumParent: number, + parent: string, + match: RegExpMatchArray +} + export const ext = new Map([ ['.fsh', 'frag'], ['.gsh', 'geom'], @@ -95,7 +102,7 @@ function processIncludes(lines: string[], incStack: string[]) { } } -function mergeInclude(inc: {lineNum: number, lineNumParent: number, parent: string, match: RegExpMatchArray}, lines: string[], incStack: string[]) { +function mergeInclude(inc: IncludeObj, lines: string[], incStack: string[]) { const incPath = absPath(inc.parent, inc.match[1]) const dataLines = readFileSync(incPath).toString().split('\n') incStack.push(incPath) @@ -112,7 +119,7 @@ export const formatURI = (uri: string) => uri.replace(/^file:\/\//, '') // TODO no export function getIncludes(uri: string, lines: string[]) { - const out: {lineNum: number, lineNumParent: number, parent: string, match: RegExpMatchArray}[] = [] + const out: IncludeObj[] = [] const count = [0] // for each file we need to track the line number const parStack = [uri] // for each include we need to track its parent @@ -186,8 +193,7 @@ function lint(uri: string, lines: string[], includes: string[]) { const diagnostics = new Map([[uri, Array()]]) includes.forEach(obj => diagnostics.set(obj, [])) - const matches = filterMatches(out) - matches.forEach((match) => { + filterMatches(out).forEach((match) => { const [whole, type, file, line, msg] = match const diag: Diagnostic = { diff --git a/tslint.json b/tslint.json index 1831d3d..2f7c529 100644 --- a/tslint.json +++ b/tslint.json @@ -19,6 +19,7 @@ "object-literal-key-quotes": false, "eofline": false, "member-ordering": false, + "interface-over-type-literal": false, "trailing-comma": false, "no-var-requires": false, "max-line-length": {