Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions oxlint.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const disabledRules = [
"unicorn/filename-case",
"unicorn/no-array-callback-reference",
"unicorn/no-lonely-if",
"unicorn/no-negated-condition",
"unicorn/no-null",
"unicorn/no-object-as-default-parameter",
"unicorn/no-useless-undefined",
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@
},
"devDependencies": {
"@pnpm/meta-updater": "^2.0.6",
"@types/node": "^24.12.2",
"@types/node": "^24.12.4",
"esbuild": "^0.28.0",
"eslint-plugin-mocha": "^11.2.0",
"oxfmt": "^0.47.0",
"oxlint": "^1.62.0",
"oxfmt": "^0.49.0",
"oxlint": "^1.64.0",
"oxlint-tsgolint": "^0.22.1",
"stylelint": "^17.9.1",
"stylelint": "^17.11.0",
"stylelint-config-standard": "^40.0.0",
"stylelint-config-standard-scss": "^17.0.0",
"syncpack": "^14.3.1",
"syncpack": "^15.1.2",
"tsx": "^4.21.0",
"typescript": "^6.0.3"
},
Expand Down
10 changes: 5 additions & 5 deletions packages/app-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@
"itertools": "^2.6.0",
"lodash-es": "^4.18.1",
"nearley": "^2.20.1",
"semver": "^7.7.4",
"semver": "^7.8.0",
"trie-search": "^2.2.1",
"uuid": "^14.0.0",
"vscode-uri": "^3.1.0"
Expand All @@ -1329,14 +1329,14 @@
"@types/lodash-es": "^4.17.12",
"@types/mocha": "^10.0.10",
"@types/nearley": "^2.11.5",
"@types/node": "^24.12.2",
"@types/node": "^24.12.4",
"@types/semver": "^7.7.1",
"@types/sinon": "^21.0.1",
"@types/vscode": "1.98.0",
"esbuild": "^0.28.0",
"fast-xml-parser": "^5.7.2",
"fs-extra": "^11.3.4",
"sinon": "^21.1.2",
"fast-xml-parser": "^5.8.0",
"fs-extra": "^11.3.5",
"sinon": "^22.0.0",
"tsx": "^4.21.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function vscodeGetConfigurationString(path: string): string | undefined {
}

function evaluateStringVariables(value: string): string {
return value.replaceAll(/\${(\w+)}/g, (match, variable) => {
return value.replaceAll(/\$\{(\w+)\}/gu, (match, variable) => {
switch (variable) {
case "userHome":
return os.homedir();
Expand Down
24 changes: 12 additions & 12 deletions packages/app-vscode/src/ide/vscode/hats/VscodeHatRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,16 @@ export class VscodeHatRenderer {
let isOk = true;

if (
svg.match(/fill="(?!none)[^"]+"/) == null &&
svg.match(/fill:(?!none)[^;]+;/) == null
svg.match(/fill="(?!none)[^"]+"/u) == null &&
svg.match(/fill:(?!none)[^;]+;/u) == null
) {
void vscode.window.showErrorMessage(
`Raw svg '${shape}' is missing 'fill' property`,
);
isOk = false;
}

const viewBoxMatch = svg.match(/viewBox="([^"]+)"/);
const viewBoxMatch = svg.match(/viewBox="([^"]+)"/u);

if (viewBoxMatch == null) {
void vscode.window.showErrorMessage(
Expand All @@ -339,9 +339,9 @@ export class VscodeHatRenderer {
// so that you can be notified if/when it changes or is removed.
const [fill, stroke] = color.split("-");
let svg = originalSvg
.replaceAll(/fill="(?!none)[^"]+"/g, `fill="${fill}"`)
.replaceAll(/fill:(?!none)[^;]+;/g, `fill:${fill};`)
.replaceAll(/\r?\n/g, " ");
.replaceAll(/fill="(?!none)[^"]+"/gu, `fill="${fill}"`)
.replaceAll(/fill:(?!none)[^;]+;/gu, `fill:${fill};`)
.replaceAll(/\r?\n/gu, " ");
if (stroke !== undefined) {
svg = this.addInnerStrokeToSvg(svgInfo, svg, stroke);
}
Expand All @@ -357,7 +357,7 @@ export class VscodeHatRenderer {
stroke: string,
): string {
// All hat svgs have exactly one path element. Extract it.
const pathRegex = /<path[^>]*d="([^"]+)"[^>]*\/>/;
const pathRegex = /<path[^>]*d="([^"]+)"[^>]*\/>/u;
const pathMatch = pathRegex.exec(svg);
if (!pathMatch) {
console.error(`Could not find path in svg: ${svg}`);
Expand Down Expand Up @@ -446,9 +446,9 @@ export class VscodeHatRenderer {
const newViewBoxString = `${newViewBoxX} ${newViewBoxY} ${newViewBoxWidth} ${newViewBoxHeight}`;

const innerSvg = rawSvg
.replace(/width="[^"]+"/, ``)
.replace(/height="[^"]+"/, ``)
.replace(/viewBox="([^"]+)"/, `style="overflow:visible"`);
.replace(/width="[^"]+"/u, ``)
.replace(/height="[^"]+"/u, ``)
.replace(/viewBox="([^"]+)"/u, `style="overflow:visible"`);

const svg =
`<svg xmlns="http://www.w3.org/2000/svg" ` +
Expand All @@ -469,12 +469,12 @@ export class VscodeHatRenderer {
}

private getViewBoxDimensions(rawSvg: string) {
const viewBoxValue = rawSvg.match(/viewBox="([^"]+)"/)?.[1];
const viewBoxValue = rawSvg.match(/viewBox="([^"]+)"/u)?.[1];
if (viewBoxValue == null) {
throw new Error("Missing viewBox");
}

const viewBoxParts = viewBoxValue.trim().split(/\s+/);
const viewBoxParts = viewBoxValue.trim().split(/\s+/u);
// A valid viewBox should have 4 parts: min-x, min-y, width and height
if (viewBoxParts.length !== 4) {
throw new Error(`Invalid viewBox format: ${viewBoxValue}`);
Expand Down
8 changes: 4 additions & 4 deletions packages/app-vscode/src/scripts/preprocessSvgHats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ async function main() {
svgJson.svg["@_height"] = "1em";

if (
rawSvg.match(/fill="[^"]+"/) == null &&
rawSvg.match(/fill:[^;]+;/) == null
rawSvg.match(/fill="[^"]+"/u) == null &&
rawSvg.match(/fill:[^;]+;/u) == null
) {
svgJson.svg["@_fill"] = "#123456";
}

const outputSvg = dumper
.build(svgJson)
.replaceAll(/fill="(?!none)[^"]+"/g, 'fill="#666666"')
.replaceAll(/fill:(?!none)[^;]+;/g, "fill:#666666;");
.replaceAll(/fill="(?!none)[^"]+"/gu, 'fill="#666666"')
.replaceAll(/fill:(?!none)[^;]+;/gu, "fill:#666666;");

await fsp.writeFile(filePath, outputSvg);
}
Expand Down
8 changes: 4 additions & 4 deletions packages/app-web-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"build": "docusaurus build --out-dir out"
},
"dependencies": {
"@algolia/client-search": "^5.52.0",
"@algolia/client-search": "^5.52.1",
"@cursorless/lib-common": "workspace:*",
"@docsearch/react": "^4.6.3",
"@docusaurus/core": "^3.10.1",
Expand All @@ -36,8 +36,8 @@
"bootstrap": "^5.3.8",
"docusaurus-plugin-sass": "^0.2.6",
"prism-react-renderer": "^2.4.1",
"react": "^19.2.5",
"react-dom": "^19.2.5",
"react": "^19.2.6",
"react-dom": "^19.2.6",
"shiki": "^4.0.2",
"unist-util-visit": "^5.1.0"
},
Expand All @@ -47,7 +47,7 @@
"@docusaurus/types": "^3.10.1",
"@types/mdast": "^4.0.4",
"@types/mocha": "^10.0.10",
"@types/node": "^24.12.2",
"@types/node": "^24.12.4",
"@types/react": "^19.2.14",
"sass": "^1.99.0",
"typescript": "^6.0.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/app-web-docs/src/plugins/scope-tests-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ function parseTest(test: ScopeTestPath) {
.toString()
.replaceAll("\r\n", "\n");

const delimiterIndex = fixture.match(/^---$/m)?.index;
const delimiterIndex = fixture.match(/^---$/mu)?.index;

if (delimiterIndex === undefined) {
throw new Error(`Can't find delimiter '---' in scope fixture ${test.path}`);
}

const code = fixture.slice(0, delimiterIndex - 1);
const lines = fixture.slice(delimiterIndex + 4).split(/\n/);
const lines = fixture.slice(delimiterIndex + 4).split(/\n/u);
const scopes: Scope[] = [];
const unprocessedTypes: string[] = [];
let currentScopeIndex = "1";
Expand Down
4 changes: 2 additions & 2 deletions packages/app-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"wouter-preact": "^3.9.0"
},
"devDependencies": {
"@types/node": "^24.12.2",
"@types/node": "^24.12.4",
"typescript": "^6.0.3",
"vite": "^8.0.10",
"vite": "^8.0.12",
"vite-plugin-purgecss": "^0.2.13",
"vite-plugin-svgr": "^5.2.0"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/app-web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default defineConfig((): UserConfig => {
function formatMessage(message: string): string {
const maxLength = 1000;
const lines = message
.split(/\r?\n/)
.split(/\r?\n/u)
.map((l) => l.trimEnd())
.map((l) => (l.length > maxLength ? `${l.slice(0, maxLength)}...` : l));
return lines.join("\n");
Expand Down
6 changes: 3 additions & 3 deletions packages/lib-cheatsheet-local/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
},
"devDependencies": {
"@types/jest": "^30.0.0",
"@types/node": "^24.12.2",
"jest": "^30.3.0",
"@types/node": "^24.12.4",
"jest": "^30.4.2",
"typescript": "^6.0.3",
"vite": "^8.0.10",
"vite": "^8.0.12",
"vite-plugin-purgecss": "^0.2.13",
"vite-plugin-singlefile": "^2.3.3"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-cheatsheet-local/src/test/app.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ describe("App", () => {
render(<App />, container);
});

expect(container.textContent).toMatch(/Cursorless Cheatsheet/gi);
expect(container.textContent).toMatch(/Cursorless Cheatsheet/giu);
});
});
4 changes: 2 additions & 2 deletions packages/lib-cheatsheet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
},
"devDependencies": {
"@types/jest": "^30.0.0",
"jest": "^30.3.0",
"jest-environment-jsdom": "^30.3.0",
"jest": "^30.4.2",
"jest-environment-jsdom": "^30.4.1",
"ts-jest": "^29.4.9",
"typescript": "^6.0.3"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-cheatsheet/src/lib/utils/formatCaptures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ export function formatCaptures(input: string): ComponentChildren[] {
return parts;
}

const captureRegex = /<([^>]+)>/g;
const captureRegex = /<([^>]+)>/gu;
2 changes: 1 addition & 1 deletion packages/lib-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@types/mocha": "^10.0.10",
"@types/tinycolor2": "^1.4.6",
"cross-spawn": "^7.0.6",
"fast-check": "^4.7.0",
"fast-check": "^4.8.0",
"js-yaml": "^4.1.1",
"web-tree-sitter": "^0.26.8"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class InMemoryTextDocument implements TextDocument {
public readonly languageId: string,
text: string,
) {
this.filename = uri.path.split(/\\|\//g).at(-1) ?? "";
this.filename = uri.path.split(/\\|\//gu).at(-1) ?? "";
this._text = "";
this._eol = "LF";
this._version = -1;
Expand Down Expand Up @@ -115,7 +115,7 @@ export class InMemoryTextDocument implements TextDocument {
}

function createLines(text: string): InMemoryTextLine[] {
const documentParts = text.split(/(\r?\n)/g);
const documentParts = text.split(/(\r?\n)/gu);
const result: InMemoryTextLine[] = [];
let offset = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class InMemoryTextLine implements TextLine {
public text: string,
eol: string | undefined,
) {
this.isEmptyOrWhitespace = /^\s*$/.test(text);
this.isEmptyOrWhitespace = /^\s*$/u.test(text);
this.lengthIncludingEol = text.length + (eol?.length ?? 0);
const start = new Position(lineNumber, 0);
const end = new Position(lineNumber, text.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function createChangeEvents(
throw new Error("Overlapping ranges are not allowed!");
}

const text = edit.text.replaceAll(/\r?\n/g, eol);
const text = edit.text.replaceAll(/\r?\n/gu, eol);

changes.push(createChangeEvent(document, edit.range, text));
}
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-common/src/tooling/purgeCssOptions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const purgeCssOptions = {
safelist: {
greedy: [/data-bs-theme/],
greedy: [/data-bs-theme/u],
},
};
4 changes: 2 additions & 2 deletions packages/lib-common/src/util/regex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@
}

export function getLeadingWhitespace(text: string): string {
return text.match(/^\s+/)?.[0] ?? "";
return text.match(/^\s+/u)?.[0] ?? "";
}

export function getTrailingWhitespace(text: string): string {
return text.match(/\s+$/)?.[0] ?? "";
return text.match(/\s+$/u)?.[0] ?? "";

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on
library input
may run slow on strings with many repetitions of ' '.
This
regular expression
that depends on
library input
may run slow on strings with many repetitions of ' '.
This
regular expression
that depends on
library input
may run slow on strings with many repetitions of ' '.
This
regular expression
that depends on
library input
may run slow on strings with many repetitions of ' '.
Comment thread
AndreasArvidsson marked this conversation as resolved.
Dismissed
}
4 changes: 2 additions & 2 deletions packages/lib-common/src/util/stringUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
export function camelCaseToAllDown(input: string): string {
return input
.replaceAll(/(?<=[a-z0-9])([A-Z])/g, " $1")
.replaceAll(/(?<=[a-z0-9])([A-Z])/gu, " $1")
.split(" ")
.map((word) => word.toLowerCase())
.join(" ");
Expand Down Expand Up @@ -40,7 +40,7 @@ export function capitalize(str: string) {
export function uriEncodeHashId(text: string): string {
return camelCaseToAllDown(text)
.replaceAll(" ", "-")
.replaceAll(/[^a-z0-9-]/g, "");
.replaceAll(/[^a-z0-9-]/gu, "");
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/lib-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
"@cursorless/lib-node-common": "workspace:*",
"@cursorless/lib-sentence-parser": "workspace:*",
"@cursorless/talon-tools": "^0.11.0",
"immer": "^11.1.4",
"immer": "^11.1.8",
"immutability-helper": "^3.1.1",
"itertools": "^2.6.0",
"lodash-es": "^4.18.1",
"moo": "^0.5.3",
"nearley": "^2.20.1",
"uuid": "^14.0.0",
"zod": "^4.4.2"
"zod": "^4.4.3"
},
"devDependencies": {
"@types/js-yaml": "^4.0.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/lib-engine/src/actions/BreakLine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function getEdits(editor: TextEditor, contentRanges: Range[]): Edit[] {
);
const characterTrailingWhitespace = line.text
.slice(0, position.character)
.search(/\s+$/);
.search(/\s+$/u);
const replacementRange =
characterTrailingWhitespace > -1
? new Range(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export class GenerateSnippet {
const originalText = editor.document.getText(target.contentRange);

const snippetBodyText = editText(originalText, [
...matchAll(originalText, /\$|\\/g, (match) => ({
...matchAll(originalText, /\$|\\/gu, (match) => ({
offsets: {
start: match.index!,
end: match.index! + match[0].length,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function constructSnippetBody(
let currentTabCount = 0;
let currentIndentationString: string | null = null;

const [firstLine, ...remainingLines] = text.split(/\r?\n/);
const [firstLine, ...remainingLines] = text.split(/\r?\n/u);
const lines: Line[] = [
{
text: linePrefix + firstLine,
Expand All @@ -47,7 +47,7 @@ export function constructSnippetBody(
];

for (const { text, startIndex } of lines) {
const newIndentationString = text.match(/^\s*/)?.[0] ?? "";
const newIndentationString = text.match(/^\s*/u)?.[0] ?? "";
const firstNonWhitespaceCharacterIndex = newIndentationString.length;

if (currentIndentationString != null) {
Expand Down
Loading
Loading