diff --git a/editors/vscode/package-lock.json b/editors/vscode/package-lock.json index 85c2bca8e4f..92e8885dfbe 100644 --- a/editors/vscode/package-lock.json +++ b/editors/vscode/package-lock.json @@ -21,7 +21,7 @@ "vsce": "^2.11.0" }, "engines": { - "npm": "^8", + "npm": "^8 || ^9", "vscode": "^1.70.0" } }, diff --git a/editors/vscode/package.json b/editors/vscode/package.json index 713df69cd28..f43702e8999 100644 --- a/editors/vscode/package.json +++ b/editors/vscode/package.json @@ -10,19 +10,21 @@ "onLanguage:javascriptreact", "onLanguage:typescript", "onLanguage:typescriptreact", + "onLanguage:json", "onCommand:rome.syntaxTree" ], "main": "./out/main.js", "repository": { "type": "git", - "url": "https://github.com/rome/tools.git" + "url": "https://github.com/rome/tools.git", + "directory": "editors/vscode" }, "bugs": { "url": "https://github.com/rome/tools/issues" }, "engines": { "vscode": "^1.70.0", - "npm": "^8" + "npm": "^8 || ^9" }, "capabilities": { "untrustedWorkspaces": { @@ -150,4 +152,4 @@ "resolve": "^1.22.1", "vscode-languageclient": "^8.0.2" } -} \ No newline at end of file +} diff --git a/npm/js-api/tests/formatContent.test.ts b/npm/js-api/tests/formatContent.test.ts index e6825ea2b72..43c9325cb3b 100644 --- a/npm/js-api/tests/formatContent.test.ts +++ b/npm/js-api/tests/formatContent.test.ts @@ -13,7 +13,7 @@ describe("Rome WebAssembly formatContent", () => { rome.shutdown(); }); - it("should format content", () => { + it("should format JavaScript content", () => { const result = rome.formatContent("function f () { }", { filePath: "example.js", }); @@ -22,6 +22,20 @@ describe("Rome WebAssembly formatContent", () => { expect(result.diagnostics).toEqual([]); }); + it("should format JSON content", () => { + const result = rome.formatContent( + '{ "lorem": "ipsum", "foo": false, "bar": 23, "lorem": "ipsum", "foo": false, "bar": 23 }', + { + filePath: "example.json", + }, + ); + + expect(result.content).toEqual( + '{\n\t"lorem": "ipsum",\n\t"foo": false,\n\t"bar": 23,\n\t"lorem": "ipsum",\n\t"foo": false,\n\t"bar": 23\n}\n', + ); + expect(result.diagnostics).toEqual([]); + }); + it("should not format and have diagnostics", () => { const content = "function () { }"; const result = rome.formatContent(content, { diff --git a/npm/js-api/tsconfig.json b/npm/js-api/tsconfig.json index b495ae47b1b..cfeaaa64b89 100644 --- a/npm/js-api/tsconfig.json +++ b/npm/js-api/tsconfig.json @@ -11,7 +11,8 @@ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ "strict": true, /* Enable all strict type-checking options. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + "skipLibCheck": true, /* Skip type checking all .d.ts files. */ + "lib": ["ES2021"] }, "exclude": [ "./tests",