diff --git a/src/extension/__tests__/__snapshots__/extension.ts.snap b/src/extension/__tests__/__snapshots__/extension.ts.snap index 69d1b0e1..d8a2299b 100644 --- a/src/extension/__tests__/__snapshots__/extension.ts.snap +++ b/src/extension/__tests__/__snapshots__/extension.ts.snap @@ -1,34 +1,34 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Extension entry point should create a language client 1`] = ` -Array [ +[ "Stylelint", - Object { - "debug": Object { + { + "debug": { "module": "mock-path", - "options": Object { - "execArgv": Array [ + "options": { + "execArgv": [ "--nolazy", "--inspect=6004", ], }, }, - "run": Object { + "run": { "module": "mock-path", }, }, - Object { + { "diagnosticCollectionName": "Stylelint", - "documentSelector": Array [ - Object { + "documentSelector": [ + { "scheme": "file", }, - Object { + { "scheme": "untitled", }, ], - "synchronize": Object { - "fileEvents": Array [ + "synchronize": { + "fileEvents": [ undefined, undefined, ], @@ -38,11 +38,11 @@ Array [ `; exports[`Extension entry point with an active text editor, should send auto-fix commands to the language server 1`] = ` -Array [ +[ "executeCommand", - Object { - "arguments": Array [ - Object { + { + "arguments": [ + { "uri": "file:///path/to/file.ts", "version": 1, }, diff --git a/src/extension/__tests__/extension.ts b/src/extension/__tests__/extension.ts index 8fa8d3c8..640a7a69 100644 --- a/src/extension/__tests__/extension.ts +++ b/src/extension/__tests__/extension.ts @@ -115,16 +115,12 @@ describe('Extension entry point', () => { await activate(mockExtensionContext); expect(mockWorkspace.createFileSystemWatcher).toHaveBeenCalledTimes(2); - expect(mockWorkspace.createFileSystemWatcher.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - "**/.stylelintrc{,.js,.json,.yaml,.yml}", - ] - `); - expect(mockWorkspace.createFileSystemWatcher.mock.calls[1]).toMatchInlineSnapshot(` - Array [ - "**/{stylelint.config.js,.stylelintignore}", - ] - `); + expect(mockWorkspace.createFileSystemWatcher.mock.calls[0]).toEqual([ + '**/.stylelintrc{,.js,.json,.yaml,.yml}', + ]); + expect(mockWorkspace.createFileSystemWatcher.mock.calls[1]).toEqual([ + '**/{stylelint.config.js,.stylelintignore}', + ]); }); it('should register an auto-fix command', async () => { @@ -138,12 +134,10 @@ describe('Extension entry point', () => { expect(mockCommands.registerCommand).toHaveBeenCalled(); // cspell:disable - expect(mockCommands.registerCommand.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - "stylelint.executeAutofix", - [Function], - ] - `); + expect(mockCommands.registerCommand.mock.calls[0]).toMatchObject([ + 'stylelint.executeAutofix', + expect.any(Function), + ]); // cspell:enable expect(subscriptions).toContain(disposable); }); @@ -182,11 +176,9 @@ describe('Extension entry point', () => { expect(sendRequest).toHaveBeenCalledTimes(1); expect(mockWindow.showErrorMessage).toHaveBeenCalledTimes(1); - expect(mockWindow.showErrorMessage.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - "Failed to apply Stylelint fixes to the document. Please consider opening an issue with steps to reproduce.", - ] - `); + expect(mockWindow.showErrorMessage.mock.calls[0]).toEqual([ + 'Failed to apply Stylelint fixes to the document. Please consider opening an issue with steps to reproduce.', + ]); }); it('should register a restart server command', async () => { @@ -199,12 +191,10 @@ describe('Extension entry point', () => { const { subscriptions } = mockExtensionContext; expect(mockCommands.registerCommand).toHaveBeenCalled(); - expect(mockCommands.registerCommand.mock.calls[1]).toMatchInlineSnapshot(` - Array [ - "stylelint.restart", - [Function], - ] - `); + expect(mockCommands.registerCommand.mock.calls[1]).toMatchObject([ + 'stylelint.restart', + expect.any(Function), + ]); expect(subscriptions).toContain(disposable); }); @@ -332,16 +322,8 @@ describe('Extension entry point', () => { await new Promise((resolve) => setImmediate(resolve)); expect(mockWindow.showErrorMessage).toHaveBeenCalledTimes(2); - expect(mockWindow.showErrorMessage.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - "Stylelint: Problem!", - ] - `); - expect(mockWindow.showErrorMessage.mock.calls[1]).toMatchInlineSnapshot(` - Array [ - "Stylelint: String problem!", - ] - `); + expect(mockWindow.showErrorMessage.mock.calls[0]).toEqual(['Stylelint: Problem!']); + expect(mockWindow.showErrorMessage.mock.calls[1]).toEqual(['Stylelint: String problem!']); }); it('should show an error message if restarting the language server fails', async () => { @@ -362,16 +344,8 @@ describe('Extension entry point', () => { await mockCommands.registerCommand.mock.calls[1][1](); expect(mockWindow.showErrorMessage).toHaveBeenCalledTimes(2); - expect(mockWindow.showErrorMessage.mock.calls[0]).toMatchInlineSnapshot(` - Array [ - "Stylelint: Problem!", - ] - `); - expect(mockWindow.showErrorMessage.mock.calls[1]).toMatchInlineSnapshot(` - Array [ - "Stylelint: String problem!", - ] - `); + expect(mockWindow.showErrorMessage.mock.calls[0]).toEqual(['Stylelint: Problem!']); + expect(mockWindow.showErrorMessage.mock.calls[1]).toEqual(['Stylelint: String problem!']); }); it('should stop language client on deactivate', async () => { diff --git a/src/server/__tests__/__snapshots__/server.ts.snap b/src/server/__tests__/__snapshots__/server.ts.snap index 894d30ca..ccd44d0f 100644 --- a/src/server/__tests__/__snapshots__/server.ts.snap +++ b/src/server/__tests__/__snapshots__/server.ts.snap @@ -1,23 +1,23 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`StylelintLanguageServer should accept server modules 1`] = ` -Object { - "context": Object { - "commands": Object { +{ + "context": { + "commands": { "__typed": [Function], "dispose": [MockFunction], "on": [MockFunction], "register": [MockFunction], }, - "connection": Object { + "connection": { "__typed": [Function], - "client": Object { + "client": { "connection": [Circular], "fillServerCapabilities": [MockFunction], "initialize": [MockFunction], "register": [MockFunction], }, - "console": Object { + "console": { "connection": [Circular], "debug": [MockFunction], "error": [MockFunction], @@ -28,59 +28,59 @@ Object { "warn": [MockFunction], }, "dispose": [MockFunction], - "languages": Object { + "languages": { "attachPartialResultProgress": [MockFunction], "attachWorkDoneProgress": [MockFunction], - "callHierarchy": Object { + "callHierarchy": { "onIncomingCalls": [MockFunction], "onOutgoingCalls": [MockFunction], "onPrepare": [MockFunction], }, "connection": [Circular], - "diagnostics": Object { + "diagnostics": { "on": [MockFunction], "onWorkspace": [MockFunction], "refresh": [MockFunction], }, "fillServerCapabilities": [MockFunction], - "foldingRange": Object { + "foldingRange": { "on": [MockFunction], "refresh": [MockFunction], }, "initialize": [MockFunction], - "inlayHint": Object { + "inlayHint": { "on": [MockFunction], "refresh": [MockFunction], "resolve": [MockFunction], }, - "inlineValue": Object { + "inlineValue": { "on": [MockFunction], "refresh": [MockFunction], }, - "moniker": Object { + "moniker": { "on": [MockFunction], }, "onLinkedEditingRange": [MockFunction], - "semanticTokens": Object { + "semanticTokens": { "on": [MockFunction], "onDelta": [MockFunction], "onRange": [MockFunction], "refresh": [MockFunction], }, - "typeHierarchy": Object { + "typeHierarchy": { "onPrepare": [MockFunction], "onSubtypes": [MockFunction], "onSupertypes": [MockFunction], }, }, "listen": [MockFunction], - "notebooks": Object { + "notebooks": { "attachPartialResultProgress": [MockFunction], "attachWorkDoneProgress": [MockFunction], - "connection": Object {}, + "connection": {}, "fillServerCapabilities": [MockFunction], "initialize": [MockFunction], - "synchronization": Object { + "synchronization": { "onDidChangeNotebookDocument": [MockFunction], "onDidCloseNotebookDocument": [MockFunction], "onDidOpenNotebookDocument": [MockFunction], @@ -135,19 +135,19 @@ Object { "sendNotification": [MockFunction], "sendProgress": [MockFunction], "sendRequest": [MockFunction], - "telemetry": Object { + "telemetry": { "connection": [Circular], "fillServerCapabilities": [MockFunction], "initialize": [MockFunction], "logEvent": [MockFunction], }, - "tracer": Object { + "tracer": { "connection": [Circular], "fillServerCapabilities": [MockFunction], "initialize": [MockFunction], "log": [MockFunction], }, - "window": Object { + "window": { "attachWorkDoneProgress": [MockFunction], "connection": [Circular], "createWorkDoneProgress": [MockFunction], @@ -158,7 +158,7 @@ Object { "showInformationMessage": [MockFunction], "showWarningMessage": [MockFunction], }, - "workspace": Object { + "workspace": { "applyEdit": [MockFunction], "connection": [Circular], "fillServerCapabilities": [MockFunction], @@ -175,7 +175,7 @@ Object { }, }, "displayError": [Function], - "documents": Object { + "documents": { "__typed": [Function], "all": [MockFunction], "get": [MockFunction], @@ -192,7 +192,7 @@ Object { "getModule": [Function], "getOptions": [Function], "lintDocument": [Function], - "notifications": Object { + "notifications": { "__typed": [Function], "dispose": [MockFunction], "on": [MockFunction], @@ -207,18 +207,18 @@ Object { `; exports[`StylelintLanguageServer should allow modules to get fixes for documents using context.getFixes 1`] = ` -Array [ - Array [ - Object {}, - Object { +[ + [ + {}, + { "uri": "file:///test.css", }, - Object { + { "maxWarnings": 1, }, - Object { - "codeAction": Object { - "disableRuleComment": Object { + { + "codeAction": { + "disableRuleComment": { "location": "separateLine", }, }, @@ -231,26 +231,26 @@ Array [ "reportDescriptionlessDisables": false, "reportInvalidScopeDisables": false, "reportNeedlessDisables": false, - "snippet": Array [ + "snippet": [ "css", "postcss", ], "stylelintPath": "", - "validate": Array [ + "validate": [ "css", "postcss", ], }, ], - Array [ - Object {}, - Object { + [ + {}, + { "uri": "file:///test.css", }, - Object {}, - Object { - "codeAction": Object { - "disableRuleComment": Object { + {}, + { + "codeAction": { + "disableRuleComment": { "location": "separateLine", }, }, @@ -263,12 +263,12 @@ Array [ "reportDescriptionlessDisables": false, "reportInvalidScopeDisables": false, "reportNeedlessDisables": false, - "snippet": Array [ + "snippet": [ "css", "postcss", ], "stylelintPath": "", - "validate": Array [ + "validate": [ "css", "postcss", ], @@ -278,17 +278,17 @@ Array [ `; exports[`StylelintLanguageServer should allow modules to lint documents using context.lintDocument 1`] = ` -Array [ - Array [ - Object { +[ + [ + { "uri": "file:///test.css", }, - Object { + { "maxWarnings": 1, }, - Object { - "codeAction": Object { - "disableRuleComment": Object { + { + "codeAction": { + "disableRuleComment": { "location": "separateLine", }, }, @@ -301,25 +301,25 @@ Array [ "reportDescriptionlessDisables": false, "reportInvalidScopeDisables": false, "reportNeedlessDisables": false, - "snippet": Array [ + "snippet": [ "css", "postcss", ], "stylelintPath": "", - "validate": Array [ + "validate": [ "css", "postcss", ], }, ], - Array [ - Object { + [ + { "uri": "file:///test.css", }, - Object {}, - Object { - "codeAction": Object { - "disableRuleComment": Object { + {}, + { + "codeAction": { + "disableRuleComment": { "location": "separateLine", }, }, @@ -332,12 +332,12 @@ Array [ "reportDescriptionlessDisables": false, "reportInvalidScopeDisables": false, "reportNeedlessDisables": false, - "snippet": Array [ + "snippet": [ "css", "postcss", ], "stylelintPath": "", - "validate": Array [ + "validate": [ "css", "postcss", ], @@ -347,16 +347,16 @@ Array [ `; exports[`StylelintLanguageServer should combine initialization results from modules 1`] = ` -Object { - "capabilities": Object { +{ + "capabilities": { "callHierarchyProvider": true, - "textDocumentSync": Object { + "textDocumentSync": { "change": 1, "openClose": true, }, "typeDefinitionProvider": true, - "workspace": Object { - "workspaceFolders": Object { + "workspace": { + "workspaceFolders": { "supported": true, }, }, @@ -366,16 +366,16 @@ Object { exports[`StylelintLanguageServer should not accept modules with a non-string ID 1`] = `"Module IDs must be strings"`; -exports[`StylelintLanguageServer should not accept modules with duplicate IDs 1`] = `"Module with ID \\"test-module\\" already registered"`; +exports[`StylelintLanguageServer should not accept modules with duplicate IDs 1`] = `"Module with ID "test-module" already registered"`; exports[`StylelintLanguageServer should not accept modules without an ID 1`] = `"Modules must have an ID"`; exports[`StylelintLanguageServer should prevent modules from modifying context properties 1`] = `"Cannot set read-only property"`; exports[`StylelintLanguageServer when workspace/configuration is available, context.getOptions should return resource-scoped options 1`] = ` -Object { - "codeAction": Object { - "disableRuleComment": Object { +{ + "codeAction": { + "disableRuleComment": { "location": "separateLine", }, }, @@ -388,12 +388,12 @@ Object { "reportDescriptionlessDisables": false, "reportInvalidScopeDisables": false, "reportNeedlessDisables": false, - "snippet": Array [ + "snippet": [ "css", "postcss", ], "stylelintPath": "", - "validate": Array [ + "validate": [ "css", "postcss", ], @@ -401,9 +401,9 @@ Object { `; exports[`StylelintLanguageServer when workspace/configuration is available, context.getOptions should return resource-scoped options 2`] = ` -Object { - "codeAction": Object { - "disableRuleComment": Object { +{ + "codeAction": { + "disableRuleComment": { "location": "separateLine", }, }, @@ -416,11 +416,11 @@ Object { "reportDescriptionlessDisables": false, "reportInvalidScopeDisables": false, "reportNeedlessDisables": false, - "snippet": Array [ + "snippet": [ "scss", ], "stylelintPath": "", - "validate": Array [ + "validate": [ "css", "postcss", ], @@ -428,9 +428,9 @@ Object { `; exports[`StylelintLanguageServer when workspace/configuration is not available, context.getOptions should gracefully handle missing section 1`] = ` -Object { - "codeAction": Object { - "disableRuleComment": Object { +{ + "codeAction": { + "disableRuleComment": { "location": "separateLine", }, }, @@ -443,12 +443,12 @@ Object { "reportDescriptionlessDisables": false, "reportInvalidScopeDisables": false, "reportNeedlessDisables": false, - "snippet": Array [ + "snippet": [ "css", "postcss", ], "stylelintPath": "", - "validate": Array [ + "validate": [ "css", "postcss", ], @@ -456,9 +456,9 @@ Object { `; exports[`StylelintLanguageServer when workspace/configuration is not available, context.getOptions should gracefully handle missing section 2`] = ` -Object { - "codeAction": Object { - "disableRuleComment": Object { +{ + "codeAction": { + "disableRuleComment": { "location": "separateLine", }, }, @@ -471,21 +471,21 @@ Object { "reportDescriptionlessDisables": false, "reportInvalidScopeDisables": false, "reportNeedlessDisables": false, - "snippet": Array [ + "snippet": [ "css", "postcss", ], "stylelintPath": "", - "validate": Array [ + "validate": [ "css", ], } `; exports[`StylelintLanguageServer when workspace/configuration is not available, context.getOptions should return global options 1`] = ` -Object { - "codeAction": Object { - "disableRuleComment": Object { +{ + "codeAction": { + "disableRuleComment": { "location": "separateLine", }, }, @@ -498,12 +498,12 @@ Object { "reportDescriptionlessDisables": false, "reportInvalidScopeDisables": false, "reportNeedlessDisables": false, - "snippet": Array [ + "snippet": [ "css", "postcss", ], "stylelintPath": "", - "validate": Array [ + "validate": [ "css", "postcss", ], diff --git a/src/server/modules/__tests__/__snapshots__/auto-fix.ts.snap b/src/server/modules/__tests__/__snapshots__/auto-fix.ts.snap index d99a0be3..2ce01fb2 100644 --- a/src/server/modules/__tests__/__snapshots__/auto-fix.ts.snap +++ b/src/server/modules/__tests__/__snapshots__/auto-fix.ts.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`AutoFixModule onInitialize should return results 1`] = ` -Object { - "capabilities": Object { - "executeCommandProvider": Object { - "commands": Array [ +{ + "capabilities": { + "executeCommandProvider": { + "commands": [ "stylelint.applyAutoFix", ], }, @@ -13,27 +13,27 @@ Object { `; exports[`AutoFixModule should auto-fix documents 1`] = ` -Array [ - Object { +[ + { "changeAnnotations": undefined, - "documentChanges": Array [ - Object { - "edits": Array [ - Object { + "documentChanges": [ + { + "edits": [ + { "newText": "text", - "range": Object { - "end": Object { + "range": { + "end": { "character": 0, "line": 0, }, - "start": Object { + "start": { "character": 0, "line": 0, }, }, }, ], - "textDocument": Object { + "textDocument": { "uri": "foo", "version": 1, }, diff --git a/src/server/modules/__tests__/__snapshots__/code-action.ts.snap b/src/server/modules/__tests__/__snapshots__/code-action.ts.snap index 2ca34bc3..fb50b32e 100644 --- a/src/server/modules/__tests__/__snapshots__/code-action.ts.snap +++ b/src/server/modules/__tests__/__snapshots__/code-action.ts.snap @@ -1,16 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`CodeActionModule onInitialize should return results 1`] = ` -Object { - "capabilities": Object { - "codeActionProvider": Object { - "codeActionKinds": Array [ +{ + "capabilities": { + "codeActionProvider": { + "codeActionKinds": [ "quickfix", "source.fixAll.stylelint", ], }, - "executeCommandProvider": Object { - "commands": Array [ + "executeCommandProvider": { + "commands": [ "stylelint.openRuleDoc", ], }, @@ -19,11 +19,11 @@ Object { `; exports[`CodeActionModule with action kind Source, should create fix-all code actions 1`] = ` -Array [ - Object { - "command": Object { - "arguments": Array [ - Object { +[ + { + "command": { + "arguments": [ + { "uri": "foo", "version": 1, }, @@ -38,27 +38,27 @@ Array [ `; exports[`CodeActionModule with action kind SourceFixAll, should create fix-all code actions 1`] = ` -Array [ - Object { - "edit": Object { - "documentChanges": Array [ - Object { - "edits": Array [ - Object { +[ + { + "edit": { + "documentChanges": [ + { + "edits": [ + { "newText": "text", - "range": Object { - "end": Object { + "range": { + "end": { "character": 0, "line": 0, }, - "start": Object { + "start": { "character": 0, "line": 0, }, }, }, ], - "textDocument": Object { + "textDocument": { "uri": "foo", "version": 1, }, @@ -72,27 +72,27 @@ Array [ `; exports[`CodeActionModule with action kind StylelintSourceFixAll, should create fix-all code actions 1`] = ` -Array [ - Object { - "edit": Object { - "documentChanges": Array [ - Object { - "edits": Array [ - Object { +[ + { + "edit": { + "documentChanges": [ + { + "edits": [ + { "newText": "text", - "range": Object { - "end": Object { + "range": { + "end": { "character": 0, "line": 0, }, - "start": Object { + "start": { "character": 0, "line": 0, }, }, }, ], - "textDocument": Object { + "textDocument": { "uri": "foo", "version": 1, }, @@ -106,29 +106,29 @@ Array [ `; exports[`CodeActionModule with no action kind, should create actions for each Stylelint diagnostic 1`] = ` -Array [ - Object { - "edit": Object { +[ + { + "edit": { "changeAnnotations": undefined, - "documentChanges": Array [ - Object { - "edits": Array [ - Object { + "documentChanges": [ + { + "edits": [ + { "newText": "/* stylelint-disable-next-line rule 1 */ ", - "range": Object { - "end": Object { + "range": { + "end": { "character": 0, "line": 0, }, - "start": Object { + "start": { "character": 0, "line": 0, }, }, }, ], - "textDocument": Object { + "textDocument": { "uri": "foo", "version": 1, }, @@ -138,28 +138,28 @@ Array [ "kind": "quickfix", "title": "Disable rule 1 for this line", }, - Object { - "edit": Object { + { + "edit": { "changeAnnotations": undefined, - "documentChanges": Array [ - Object { - "edits": Array [ - Object { + "documentChanges": [ + { + "edits": [ + { "newText": "/* stylelint-disable rule 1 */ ", - "range": Object { - "end": Object { + "range": { + "end": { "character": 0, "line": 0, }, - "start": Object { + "start": { "character": 0, "line": 0, }, }, }, ], - "textDocument": Object { + "textDocument": { "uri": "foo", "version": 1, }, @@ -169,10 +169,10 @@ Array [ "kind": "quickfix", "title": "Disable rule 1 for the entire file", }, - Object { - "command": Object { - "arguments": Array [ - Object { + { + "command": { + "arguments": [ + { "uri": "https://stylelint.io/user-guide/rules/rule", }, ], @@ -182,28 +182,28 @@ Array [ "kind": "quickfix", "title": "Show documentation for rule 1", }, - Object { - "edit": Object { + { + "edit": { "changeAnnotations": undefined, - "documentChanges": Array [ - Object { - "edits": Array [ - Object { + "documentChanges": [ + { + "edits": [ + { "newText": "/* stylelint-disable-next-line rule 3 */ ", - "range": Object { - "end": Object { + "range": { + "end": { "character": 0, "line": 0, }, - "start": Object { + "start": { "character": 0, "line": 0, }, }, }, ], - "textDocument": Object { + "textDocument": { "uri": "foo", "version": 1, }, @@ -213,28 +213,28 @@ Array [ "kind": "quickfix", "title": "Disable rule 3 for this line", }, - Object { - "edit": Object { + { + "edit": { "changeAnnotations": undefined, - "documentChanges": Array [ - Object { - "edits": Array [ - Object { + "documentChanges": [ + { + "edits": [ + { "newText": "/* stylelint-disable rule 3 */ ", - "range": Object { - "end": Object { + "range": { + "end": { "character": 0, "line": 0, }, - "start": Object { + "start": { "character": 0, "line": 0, }, }, }, ], - "textDocument": Object { + "textDocument": { "uri": "foo", "version": 1, }, diff --git a/src/server/modules/__tests__/__snapshots__/completion.ts.snap b/src/server/modules/__tests__/__snapshots__/completion.ts.snap index 4073629c..f54cb843 100644 --- a/src/server/modules/__tests__/__snapshots__/completion.ts.snap +++ b/src/server/modules/__tests__/__snapshots__/completion.ts.snap @@ -1,16 +1,16 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`CompletionModule onInitialize should return results 1`] = ` -Object { - "capabilities": Object { - "completionProvider": Object {}, +{ + "capabilities": { + "completionProvider": {}, }, } `; exports[`CompletionModule with diagnostics at the next line and cursor in a disable comment, should return rule completions 1`] = ` -Array [ - Object { +[ + { "detail": "disable indentation rule. (Stylelint)", "kind": 15, "label": "indentation", @@ -19,8 +19,8 @@ Array [ `; exports[`CompletionModule with diagnostics at the next line and cursor in a next-line disable comment, should return rule completions 1`] = ` -Array [ - Object { +[ + { "detail": "disable indentation rule. (Stylelint)", "kind": 15, "label": "indentation", @@ -29,10 +29,10 @@ Array [ `; exports[`CompletionModule with diagnostics at the next line, should return disable comment completions for rule 1`] = ` -Array [ - Object { +[ + { "detail": "Turn off Stylelint rules for individual lines only, after which you do not need to explicitly re-enable them. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable-line rule */ @@ -43,9 +43,9 @@ Array [ "kind": 15, "label": "stylelint-disable-line", }, - Object { + { "detail": "Turn off Stylelint rules for the next line only, after which you do not need to explicitly re-enable them. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable-next-line indentation */ @@ -56,9 +56,9 @@ Array [ "kind": 15, "label": "stylelint-disable-next-line", }, - Object { + { "detail": "Turn off all Stylelint or individual rules, after which you do not need to re-enable Stylelint. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable rule */ @@ -75,8 +75,8 @@ Array [ `; exports[`CompletionModule with diagnostics at the same line and cursor in a line disable comment, should return rule completions 1`] = ` -Array [ - Object { +[ + { "detail": "disable indentation rule. (Stylelint)", "kind": 15, "label": "indentation", @@ -85,10 +85,10 @@ Array [ `; exports[`CompletionModule with diagnostics at the same line, should return disable comment completions for rule 1`] = ` -Array [ - Object { +[ + { "detail": "Turn off Stylelint rules for individual lines only, after which you do not need to explicitly re-enable them. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable-line indentation */ @@ -99,9 +99,9 @@ Array [ "kind": 15, "label": "stylelint-disable-line", }, - Object { + { "detail": "Turn off Stylelint rules for the next line only, after which you do not need to explicitly re-enable them. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable-next-line rule */ @@ -112,9 +112,9 @@ Array [ "kind": 15, "label": "stylelint-disable-next-line", }, - Object { + { "detail": "Turn off all Stylelint or individual rules, after which you do not need to re-enable Stylelint. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable rule */ @@ -131,10 +131,10 @@ Array [ `; exports[`CompletionModule with needless disables reported for a diagnostic, should return generic completions 1`] = ` -Array [ - Object { +[ + { "detail": "Turn off Stylelint rules for individual lines only, after which you do not need to explicitly re-enable them. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable-line rule */ @@ -145,9 +145,9 @@ Array [ "kind": 15, "label": "stylelint-disable-line", }, - Object { + { "detail": "Turn off Stylelint rules for the next line only, after which you do not need to explicitly re-enable them. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable-next-line rule */ @@ -158,9 +158,9 @@ Array [ "kind": 15, "label": "stylelint-disable-next-line", }, - Object { + { "detail": "Turn off all Stylelint or individual rules, after which you do not need to re-enable Stylelint. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable rule */ @@ -176,13 +176,13 @@ Array [ ] `; -exports[`CompletionModule with no diagnostics at same or next line and cursor in a disable comment, should not return completions 1`] = `Array []`; +exports[`CompletionModule with no diagnostics at same or next line and cursor in a disable comment, should not return completions 1`] = `[]`; exports[`CompletionModule with no diagnostics at the same or next line, should return generic completions 1`] = ` -Array [ - Object { +[ + { "detail": "Turn off Stylelint rules for individual lines only, after which you do not need to explicitly re-enable them. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable-line rule */ @@ -193,9 +193,9 @@ Array [ "kind": 15, "label": "stylelint-disable-line", }, - Object { + { "detail": "Turn off Stylelint rules for the next line only, after which you do not need to explicitly re-enable them. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable-next-line rule */ @@ -206,9 +206,9 @@ Array [ "kind": 15, "label": "stylelint-disable-next-line", }, - Object { + { "detail": "Turn off all Stylelint or individual rules, after which you do not need to re-enable Stylelint. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable rule */ @@ -225,10 +225,10 @@ Array [ `; exports[`CompletionModule without diagnostics, should return generic completions 1`] = ` -Array [ - Object { +[ + { "detail": "Turn off Stylelint rules for individual lines only, after which you do not need to explicitly re-enable them. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable-line rule */ @@ -239,9 +239,9 @@ Array [ "kind": 15, "label": "stylelint-disable-line", }, - Object { + { "detail": "Turn off Stylelint rules for the next line only, after which you do not need to explicitly re-enable them. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable-next-line rule */ @@ -252,9 +252,9 @@ Array [ "kind": 15, "label": "stylelint-disable-next-line", }, - Object { + { "detail": "Turn off all Stylelint or individual rules, after which you do not need to re-enable Stylelint. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable rule */ @@ -271,10 +271,10 @@ Array [ `; exports[`CompletionModule without the validator module, should return generic completions 1`] = ` -Array [ - Object { +[ + { "detail": "Turn off Stylelint rules for individual lines only, after which you do not need to explicitly re-enable them. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable-line rule */ @@ -285,9 +285,9 @@ Array [ "kind": 15, "label": "stylelint-disable-line", }, - Object { + { "detail": "Turn off Stylelint rules for the next line only, after which you do not need to explicitly re-enable them. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable-next-line rule */ @@ -298,9 +298,9 @@ Array [ "kind": 15, "label": "stylelint-disable-next-line", }, - Object { + { "detail": "Turn off all Stylelint or individual rules, after which you do not need to re-enable Stylelint. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable rule */ diff --git a/src/server/modules/__tests__/__snapshots__/formatter.ts.snap b/src/server/modules/__tests__/__snapshots__/formatter.ts.snap index a58ef49f..2815402f 100644 --- a/src/server/modules/__tests__/__snapshots__/formatter.ts.snap +++ b/src/server/modules/__tests__/__snapshots__/formatter.ts.snap @@ -1,15 +1,15 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`FormatterModule should format documents 1`] = ` -Array [ - Object { +[ + { "newText": "text", - "range": Object { - "end": Object { + "range": { + "end": { "character": 0, "line": 0, }, - "start": Object { + "start": { "character": 0, "line": 0, }, @@ -19,7 +19,7 @@ Array [ `; exports[`FormatterModule should format documents 2`] = ` -Array [ +[ FullTextDocument { "_content": "a {}", "_languageId": "bar", @@ -27,10 +27,10 @@ Array [ "_uri": "foo", "_version": 1, }, - Object { - "config": Object { - "rules": Object { - "indentation": Array [ + { + "config": { + "rules": { + "indentation": [ 2, ], "no-missing-end-of-source-newline": true, @@ -41,16 +41,16 @@ Array [ `; exports[`FormatterModule with client dynamic registration support, onInitialize should not request static registration 1`] = ` -Object { - "capabilities": Object { +{ + "capabilities": { "documentFormattingProvider": false, }, } `; exports[`FormatterModule without client dynamic registration support, onInitialize should request static registration 1`] = ` -Object { - "capabilities": Object { +{ + "capabilities": { "documentFormattingProvider": true, }, } diff --git a/src/server/modules/__tests__/__snapshots__/old-stylelint-warning.ts.snap b/src/server/modules/__tests__/__snapshots__/old-stylelint-warning.ts.snap index ceb68b66..7755714f 100644 --- a/src/server/modules/__tests__/__snapshots__/old-stylelint-warning.ts.snap +++ b/src/server/modules/__tests__/__snapshots__/old-stylelint-warning.ts.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`OldStylelintWarningModule with openDocument support, if Stylelint version is less than 14.x and user clicks button, should warn and open URL 1`] = ` -Array [ - Object { +[ + { "external": true, "uri": "https://github.com/stylelint/vscode-stylelint#migrating-from-vscode-stylelint-0xstylelint-13x", }, @@ -10,7 +10,7 @@ Array [ `; exports[`OldStylelintWarningModule without openDocument support, if Stylelint version is less than 14.x, should warn and provide link to migration guide 1`] = ` -Array [ +[ "Stylelint version 13.0.0 is no longer supported. While it may continue to work for a while, you may encounter unexpected behavior. Please upgrade to version 14.0.0 or newer. See the migration guide for more information.", ] `; diff --git a/src/utils/__tests__/__snapshots__/processes.ts.snap b/src/utils/__tests__/__snapshots__/processes.ts.snap index fdbf8c4c..11c0b1c1 100644 --- a/src/utils/__tests__/__snapshots__/processes.ts.snap +++ b/src/utils/__tests__/__snapshots__/processes.ts.snap @@ -4,6 +4,6 @@ exports[`runProcessFindLine should throw an error if the command is not found 1` exports[`runProcessFindLine should throw an error if the matcher throws an error before the process exits 1`] = `"error"`; -exports[`runProcessFindLine should throw an error when the process exits due to a signal 1`] = `"Command \\"foo\\" exited with code SIGHUP."`; +exports[`runProcessFindLine should throw an error when the process exits due to a signal 1`] = `"Command "foo" exited with code SIGHUP."`; -exports[`runProcessFindLine should throw an error when the process exits with a non-zero exit code 1`] = `"Command \\"foo\\" exited with code 1."`; +exports[`runProcessFindLine should throw an error when the process exits with a non-zero exit code 1`] = `"Command "foo" exited with code 1."`; diff --git a/src/utils/documents/__tests__/__snapshots__/create-text-edits.ts.snap b/src/utils/documents/__tests__/__snapshots__/create-text-edits.ts.snap index bced1fcd..b6249e74 100644 --- a/src/utils/documents/__tests__/__snapshots__/create-text-edits.ts.snap +++ b/src/utils/documents/__tests__/__snapshots__/create-text-edits.ts.snap @@ -1,15 +1,15 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`createTextEdits should create text edits for deletions 1`] = ` -Array [ - Object { +[ + { "newText": "", - "range": Object { - "end": Object { + "range": { + "end": { "character": 4, "line": 3, }, - "start": Object { + "start": { "character": 4, "line": 2, }, @@ -19,16 +19,16 @@ Array [ `; exports[`createTextEdits should create text edits for insertions 1`] = ` -Array [ - Object { +[ + { "newText": " font-size: 12px; ", - "range": Object { - "end": Object { + "range": { + "end": { "character": 3, "line": 3, }, - "start": Object { + "start": { "character": 3, "line": 3, }, @@ -38,119 +38,119 @@ Array [ `; exports[`createTextEdits should create text edits for insertions and deletions 1`] = ` -Array [ - Object { +[ + { "newText": "", - "range": Object { - "end": Object { + "range": { + "end": { "character": 17, "line": 2, }, - "start": Object { + "start": { "character": 16, "line": 2, }, }, }, - Object { + { "newText": "4", - "range": Object { - "end": Object { + "range": { + "end": { "character": 17, "line": 2, }, - "start": Object { + "start": { "character": 17, "line": 2, }, }, }, - Object { + { "newText": "", - "range": Object { - "end": Object { + "range": { + "end": { "character": 21, "line": 3, }, - "start": Object { + "start": { "character": 19, "line": 2, }, }, }, - Object { + { "newText": "", - "range": Object { - "end": Object { + "range": { + "end": { "character": 20, "line": 8, }, - "start": Object { + "start": { "character": 17, "line": 8, }, }, }, - Object { + { "newText": "e2e2e2", - "range": Object { - "end": Object { + "range": { + "end": { "character": 20, "line": 8, }, - "start": Object { + "start": { "character": 20, "line": 8, }, }, }, - Object { + { "newText": "'", - "range": Object { - "end": Object { + "range": { + "end": { "character": 25, "line": 8, }, - "start": Object { + "start": { "character": 25, "line": 8, }, }, }, - Object { + { "newText": "", - "range": Object { - "end": Object { + "range": { + "end": { "character": 29, "line": 8, }, - "start": Object { + "start": { "character": 26, "line": 8, }, }, }, - Object { + { "newText": "bar", - "range": Object { - "end": Object { + "range": { + "end": { "character": 29, "line": 8, }, - "start": Object { + "start": { "character": 29, "line": 8, }, }, }, - Object { + { "newText": "'", - "range": Object { - "end": Object { + "range": { + "end": { "character": 33, "line": 8, }, - "start": Object { + "start": { "character": 33, "line": 8, }, diff --git a/src/utils/documents/__tests__/__snapshots__/get-fixes.ts.snap b/src/utils/documents/__tests__/__snapshots__/get-fixes.ts.snap index 00e1a894..42ede16b 100644 --- a/src/utils/documents/__tests__/__snapshots__/get-fixes.ts.snap +++ b/src/utils/documents/__tests__/__snapshots__/get-fixes.ts.snap @@ -1,93 +1,93 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`getFixes should return edits if Stylelint made changes 1`] = ` -Array [ - Object { +[ + { "newText": "", - "range": Object { - "end": Object { + "range": { + "end": { "character": 4, "line": 2, }, - "start": Object { + "start": { "character": 3, "line": 2, }, }, }, - Object { + { "newText": " ", - "range": Object { - "end": Object { + "range": { + "end": { "character": 4, "line": 2, }, - "start": Object { + "start": { "character": 4, "line": 2, }, }, }, - Object { + { "newText": "", - "range": Object { - "end": Object { + "range": { + "end": { "character": 3, "line": 8, }, - "start": Object { + "start": { "character": 3, "line": 5, }, }, }, - Object { + { "newText": "", - "range": Object { - "end": Object { + "range": { + "end": { "character": 4, "line": 9, }, - "start": Object { + "start": { "character": 3, "line": 9, }, }, }, - Object { + { "newText": " ", - "range": Object { - "end": Object { + "range": { + "end": { "character": 4, "line": 9, }, - "start": Object { + "start": { "character": 4, "line": 9, }, }, }, - Object { + { "newText": "", - "range": Object { - "end": Object { + "range": { + "end": { "character": 4, "line": 10, }, - "start": Object { + "start": { "character": 3, "line": 10, }, }, }, - Object { + { "newText": " ", - "range": Object { - "end": Object { + "range": { + "end": { "character": 4, "line": 10, }, - "start": Object { + "start": { "character": 4, "line": 10, }, diff --git a/src/utils/lsp/__tests__/__snapshots__/create-disable-completion-item.ts.snap b/src/utils/lsp/__tests__/__snapshots__/create-disable-completion-item.ts.snap index 0f87fc16..75d02be3 100644 --- a/src/utils/lsp/__tests__/__snapshots__/create-disable-completion-item.ts.snap +++ b/src/utils/lsp/__tests__/__snapshots__/create-disable-completion-item.ts.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`createDisableCompletionItem should create a stylelint-disable completion item 1`] = ` -Object { +{ "detail": "Turn off all Stylelint or individual rules, after which you do not need to re-enable Stylelint. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable rule */ @@ -19,9 +19,9 @@ Object { `; exports[`createDisableCompletionItem should create a stylelint-disable completion item for a specific rule 1`] = ` -Object { +{ "detail": "Turn off all Stylelint or individual rules, after which you do not need to re-enable Stylelint. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable indentation */ @@ -37,9 +37,9 @@ Object { `; exports[`createDisableCompletionItem should create a stylelint-disable-line completion item 1`] = ` -Object { +{ "detail": "Turn off Stylelint rules for individual lines only, after which you do not need to explicitly re-enable them. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable-line rule */ @@ -53,9 +53,9 @@ Object { `; exports[`createDisableCompletionItem should create a stylelint-disable-line completion item for a specific rule 1`] = ` -Object { +{ "detail": "Turn off Stylelint rules for individual lines only, after which you do not need to explicitly re-enable them. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable-line indentation */ @@ -69,9 +69,9 @@ Object { `; exports[`createDisableCompletionItem should create a stylelint-disable-next-line completion item 1`] = ` -Object { +{ "detail": "Turn off Stylelint rules for the next line only, after which you do not need to explicitly re-enable them. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable-next-line rule */ @@ -85,9 +85,9 @@ Object { `; exports[`createDisableCompletionItem should create a stylelint-disable-next-line completion item for a specific rule 1`] = ` -Object { +{ "detail": "Turn off Stylelint rules for the next line only, after which you do not need to explicitly re-enable them. (Stylelint)", - "documentation": Object { + "documentation": { "kind": "markdown", "value": "\`\`\`css /* stylelint-disable-next-line indentation */ diff --git a/src/utils/lsp/__tests__/__snapshots__/create-disable-rule-file-code-action.ts.snap b/src/utils/lsp/__tests__/__snapshots__/create-disable-rule-file-code-action.ts.snap index c0637a55..d98ea0e1 100644 --- a/src/utils/lsp/__tests__/__snapshots__/create-disable-rule-file-code-action.ts.snap +++ b/src/utils/lsp/__tests__/__snapshots__/create-disable-rule-file-code-action.ts.snap @@ -1,28 +1,28 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`createDisableRuleFileCodeAction should create a code action to disable a rule for an entire file 1`] = ` -Object { - "edit": Object { +{ + "edit": { "changeAnnotations": undefined, - "documentChanges": Array [ - Object { - "edits": Array [ - Object { + "documentChanges": [ + { + "edits": [ + { "newText": "/* stylelint-disable rule */ ", - "range": Object { - "end": Object { + "range": { + "end": { "character": 0, "line": 0, }, - "start": Object { + "start": { "character": 0, "line": 0, }, }, }, ], - "textDocument": Object { + "textDocument": { "uri": "file:///home/user/src/file.css", "version": 1, }, @@ -35,28 +35,28 @@ Object { `; exports[`createDisableRuleFileCodeAction should place the code action on the second line if the file has a shebang 1`] = ` -Object { - "edit": Object { +{ + "edit": { "changeAnnotations": undefined, - "documentChanges": Array [ - Object { - "edits": Array [ - Object { + "documentChanges": [ + { + "edits": [ + { "newText": "/* stylelint-disable rule */ ", - "range": Object { - "end": Object { + "range": { + "end": { "character": 0, "line": 1, }, - "start": Object { + "start": { "character": 0, "line": 1, }, }, }, ], - "textDocument": Object { + "textDocument": { "uri": "file:///home/user/src/file.js", "version": 1, }, diff --git a/src/utils/lsp/__tests__/__snapshots__/create-disable-rule-line-code-action.ts.snap b/src/utils/lsp/__tests__/__snapshots__/create-disable-rule-line-code-action.ts.snap index aa35ccd5..54c44c4c 100644 --- a/src/utils/lsp/__tests__/__snapshots__/create-disable-rule-line-code-action.ts.snap +++ b/src/utils/lsp/__tests__/__snapshots__/create-disable-rule-line-code-action.ts.snap @@ -1,28 +1,28 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`createDisableRuleLineCodeAction should create a code action to disable a rule for a line using the previous line 1`] = ` -Object { - "edit": Object { +{ + "edit": { "changeAnnotations": undefined, - "documentChanges": Array [ - Object { - "edits": Array [ - Object { + "documentChanges": [ + { + "edits": [ + { "newText": "/* stylelint-disable-next-line rule */ ", - "range": Object { - "end": Object { + "range": { + "end": { "character": 0, "line": 0, }, - "start": Object { + "start": { "character": 0, "line": 0, }, }, }, ], - "textDocument": Object { + "textDocument": { "uri": "file:///home/user/src/file.css", "version": 1, }, @@ -35,27 +35,27 @@ Object { `; exports[`createDisableRuleLineCodeAction should create a code action to disable a rule for a line using the same line 1`] = ` -Object { - "edit": Object { +{ + "edit": { "changeAnnotations": undefined, - "documentChanges": Array [ - Object { - "edits": Array [ - Object { + "documentChanges": [ + { + "edits": [ + { "newText": " /* stylelint-disable-line rule */", - "range": Object { - "end": Object { + "range": { + "end": { "character": 2147483647, "line": 0, }, - "start": Object { + "start": { "character": 2147483647, "line": 0, }, }, }, ], - "textDocument": Object { + "textDocument": { "uri": "file:///home/user/src/file.css", "version": 1, }, diff --git a/src/utils/objects/__tests__/__snapshots__/merge-options-with-defaults.ts.snap b/src/utils/objects/__tests__/__snapshots__/merge-options-with-defaults.ts.snap new file mode 100644 index 00000000..df071122 --- /dev/null +++ b/src/utils/objects/__tests__/__snapshots__/merge-options-with-defaults.ts.snap @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`mergeOptionsWithDefaults with circular references, should not infinitely recurse 1`] = ` +{ + "a": 4, + "b": { + "c": 1, + "d": { + "a": 4, + "b": [Circular], + }, + }, +} +`; diff --git a/src/utils/objects/__tests__/merge-options-with-defaults.ts b/src/utils/objects/__tests__/merge-options-with-defaults.ts index 0f10cd8b..4305a08a 100644 --- a/src/utils/objects/__tests__/merge-options-with-defaults.ts +++ b/src/utils/objects/__tests__/merge-options-with-defaults.ts @@ -160,18 +160,7 @@ describe('mergeOptionsWithDefaults', () => { const result = mergeOptionsWithDefaults(options, defaults); - expect(result).toMatchInlineSnapshot(` - Object { - "a": 4, - "b": Object { - "c": 1, - "d": Object { - "a": 4, - "b": [Circular], - }, - }, - } - `); + expect(result).toMatchSnapshot(); }); it('should not merge properties on arrays', () => { diff --git a/src/utils/stylelint/__tests__/__snapshots__/process-linter-result.ts.snap b/src/utils/stylelint/__tests__/__snapshots__/process-linter-result.ts.snap index 7914674d..c30d479e 100644 --- a/src/utils/stylelint/__tests__/__snapshots__/process-linter-result.ts.snap +++ b/src/utils/stylelint/__tests__/__snapshots__/process-linter-result.ts.snap @@ -1,17 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`processLinterResult should return diagnostics for each warning 1`] = ` -Object { - "diagnostics": Array [ - Object { +{ + "diagnostics": [ + { "code": "unit-no-unknown", "message": "unit-no-unknown", - "range": Object { - "end": Object { + "range": { + "end": { "character": 1, "line": 0, }, - "start": Object { + "start": { "character": 0, "line": 0, }, @@ -19,15 +19,15 @@ Object { "severity": 1, "source": "Stylelint", }, - Object { + { "code": "at-rule-no-unknown", "message": "at-rule-no-unknown", - "range": Object { - "end": Object { + "range": { + "end": { "character": 1, "line": 0, }, - "start": Object { + "start": { "character": 0, "line": 0, }, @@ -35,15 +35,15 @@ Object { "severity": 1, "source": "Stylelint", }, - Object { + { "code": "alpha-value-notation", "message": "alpha-value-notation", - "range": Object { - "end": Object { + "range": { + "end": { "character": 1, "line": 0, }, - "start": Object { + "start": { "character": 0, "line": 0, }, @@ -56,17 +56,17 @@ Object { `; exports[`processLinterResult should return output if given 1`] = ` -Object { - "diagnostics": Array [ - Object { +{ + "diagnostics": [ + { "code": "unit-no-unknown", "message": "unit-no-unknown", - "range": Object { - "end": Object { + "range": { + "end": { "character": 1, "line": 0, }, - "start": Object { + "start": { "character": 0, "line": 0, }, diff --git a/src/utils/stylelint/__tests__/__snapshots__/stylelint-runner.ts.snap b/src/utils/stylelint/__tests__/__snapshots__/stylelint-runner.ts.snap index 51b53eb5..4b55de4f 100644 --- a/src/utils/stylelint/__tests__/__snapshots__/stylelint-runner.ts.snap +++ b/src/utils/stylelint/__tests__/__snapshots__/stylelint-runner.ts.snap @@ -1,10 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`StylelintRunner should call stylelint.lint with the document path and given options 1`] = ` -Object { +{ "code": "a {}", "codeFilename": "/path/to/file.scss", - "config": Object { + "config": { "customSyntax": "postcss-scss", }, "configBasedir": undefined, @@ -21,20 +21,20 @@ Object { `; exports[`StylelintRunner should return processed lint results from Stylelint with configured rules 1`] = ` -Object { - "diagnostics": Array [ - Object { +{ + "diagnostics": [ + { "code": "block-no-empty", - "codeDescription": Object { + "codeDescription": { "href": "https://stylelint.io/user-guide/rules/block-no-empty", }, "message": "Unexpected empty block (block-no-empty)", - "range": Object { - "end": Object { + "range": { + "end": { "character": 4, "line": 0, }, - "start": Object { + "start": { "character": 2, "line": 0, }, @@ -47,17 +47,17 @@ Object { `; exports[`StylelintRunner should return processed lint results from Stylelint without configured rules 1`] = ` -Object { - "diagnostics": Array [ - Object { +{ + "diagnostics": [ + { "code": "CssSyntaxError", "message": "Unclosed block (CssSyntaxError)", - "range": Object { - "end": Object { + "range": { + "end": { "character": 1, "line": 0, }, - "start": Object { + "start": { "character": 0, "line": 0, }, diff --git a/src/utils/stylelint/__tests__/__snapshots__/warning-to-diagnostic.ts.snap b/src/utils/stylelint/__tests__/__snapshots__/warning-to-diagnostic.ts.snap index 3bd2e790..801c56aa 100644 --- a/src/utils/stylelint/__tests__/__snapshots__/warning-to-diagnostic.ts.snap +++ b/src/utils/stylelint/__tests__/__snapshots__/warning-to-diagnostic.ts.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`warningToDiagnostic should add a rule documentation URL if a matching rule exists 1`] = ` -Object { +{ "code": "color-hex-case", - "codeDescription": Object { + "codeDescription": { "href": "https://stylelint.io/rules/color-hex-case", }, - "message": "Expected \\"#AAA\\" to be \\"#aaa\\" (color-hex-case)", - "range": Object { - "end": Object { + "message": "Expected "#AAA" to be "#aaa" (color-hex-case)", + "range": { + "end": { "character": 12, "line": 1, }, - "start": Object { + "start": { "character": 11, "line": 1, }, @@ -23,15 +23,15 @@ Object { `; exports[`warningToDiagnostic should convert a Stylelint warning to an LSP diagnostic 1`] = ` -Object { +{ "code": "color-hex-case", - "message": "Expected \\"#AAA\\" to be \\"#aaa\\" (color-hex-case)", - "range": Object { - "end": Object { + "message": "Expected "#AAA" to be "#aaa" (color-hex-case)", + "range": { + "end": { "character": 12, "line": 1, }, - "start": Object { + "start": { "character": 11, "line": 1, }, @@ -42,15 +42,15 @@ Object { `; exports[`warningToDiagnostic should convert a Stylelint warning to an LSP diagnostic 2`] = ` -Object { +{ "code": "color-hex-length", - "message": "Expected \\"#bbbbbb\\" to be \\"#bbb\\" (color-hex-length)", - "range": Object { - "end": Object { + "message": "Expected "#bbbbbb" to be "#bbb" (color-hex-length)", + "range": { + "end": { "character": 25, "line": 2, }, - "start": Object { + "start": { "character": 18, "line": 2, },