mirror of
https://github.com/zmkfirmware/zmk.git
synced 2026-03-23 22:45:17 -05:00
chore: Add typescript support to eslint, fix errors (#2923)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { SyntaxNode, Tree } from "web-tree-sitter";
|
||||
import type { Tree } from "web-tree-sitter";
|
||||
import { Devicetree, findCapture } from "./parser";
|
||||
import { getUpgradeEdits, MatchFunc, ReplaceFunc, TextEdit } from "./textedit";
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ function findBehaviorNodes(paramNode: SyntaxNode) {
|
||||
}
|
||||
|
||||
// Walk forward from the behavior to collect all its parameters.
|
||||
let nodes = [behavior];
|
||||
const nodes = [behavior];
|
||||
let param = behavior.nextNamedSibling;
|
||||
while (param && param.type !== "reference") {
|
||||
nodes.push(param);
|
||||
|
||||
@@ -133,7 +133,9 @@ export function findDevicetreeProperty(
|
||||
`(property name: (identifier) @name (#eq? @name "${name}")) @prop`
|
||||
);
|
||||
const matches = query.matches(node);
|
||||
const props = matches.map(({ captures }) => findCapture("prop", captures)!);
|
||||
const props = matches
|
||||
.map(({ captures }) => findCapture("prop", captures))
|
||||
.filter((node) => node !== null);
|
||||
|
||||
if (options?.recursive) {
|
||||
return props;
|
||||
|
||||
@@ -94,7 +94,7 @@ export function applyEdits(text: string, edits: TextEdit[]) {
|
||||
const chunks: TextChunk[] = [];
|
||||
let currentIndex = 0;
|
||||
|
||||
for (let edit of edits) {
|
||||
for (const edit of edits) {
|
||||
if (edit.startIndex < currentIndex) {
|
||||
console.warn("discarding overlapping edit", edit);
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user