From 273299693b85996878907ad256ed55f072ec3f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 9 Dec 2019 20:57:55 +0200 Subject: Code: enable prettier trailing commas --- .../src/test/utils/diagnotics/SuggestedFix.test.ts | 26 +++++------ .../diagnotics/SuggestedFixCollection.test.ts | 20 ++++----- .../code/src/test/utils/diagnotics/rust.test.ts | 52 +++++++++++----------- .../code/src/test/utils/diagnotics/vscode.test.ts | 24 +++++----- editors/code/src/test/utils/index.ts | 2 +- 5 files changed, 62 insertions(+), 62 deletions(-) (limited to 'editors/code/src/test/utils') diff --git a/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts b/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts index 6c7f436f3..96ec8c614 100644 --- a/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts +++ b/editors/code/src/test/utils/diagnotics/SuggestedFix.test.ts @@ -6,12 +6,12 @@ import SuggestedFix from '../../../utils/diagnostics/SuggestedFix'; const location1 = new vscode.Location( vscode.Uri.file('/file/1'), - new vscode.Range(new vscode.Position(1, 2), new vscode.Position(3, 4)) + new vscode.Range(new vscode.Position(1, 2), new vscode.Position(3, 4)), ); const location2 = new vscode.Location( vscode.Uri.file('/file/2'), - new vscode.Range(new vscode.Position(5, 6), new vscode.Position(7, 8)) + new vscode.Range(new vscode.Position(5, 6), new vscode.Position(7, 8)), ); describe('SuggestedFix', () => { @@ -20,13 +20,13 @@ describe('SuggestedFix', () => { const suggestion1 = new SuggestedFix( 'Replace me!', location1, - 'With this!' + 'With this!', ); const suggestion2 = new SuggestedFix( 'Replace me!', location1, - 'With this!' + 'With this!', ); assert(suggestion1.isEqual(suggestion2)); @@ -36,13 +36,13 @@ describe('SuggestedFix', () => { const suggestion1 = new SuggestedFix( 'Replace me!', location1, - 'With this!' + 'With this!', ); const suggestion2 = new SuggestedFix( 'Not the same title!', location1, - 'With this!' + 'With this!', ); assert(!suggestion1.isEqual(suggestion2)); @@ -52,13 +52,13 @@ describe('SuggestedFix', () => { const suggestion1 = new SuggestedFix( 'Replace me!', location1, - 'With this!' + 'With this!', ); const suggestion2 = new SuggestedFix( 'Replace me!', location1, - 'With something else!' + 'With something else!', ); assert(!suggestion1.isEqual(suggestion2)); @@ -68,13 +68,13 @@ describe('SuggestedFix', () => { const suggestion1 = new SuggestedFix( 'Replace me!', location1, - 'With this!' + 'With this!', ); const suggestion2 = new SuggestedFix( 'Replace me!', location2, - 'With this!' + 'With this!', ); assert(!suggestion1.isEqual(suggestion2)); @@ -85,14 +85,14 @@ describe('SuggestedFix', () => { 'Replace me!', location1, 'With this!', - SuggestionApplicability.MachineApplicable + SuggestionApplicability.MachineApplicable, ); const suggestion2 = new SuggestedFix( 'Replace me!', location2, 'With this!', - SuggestionApplicability.HasPlaceholders + SuggestionApplicability.HasPlaceholders, ); assert(!suggestion1.isEqual(suggestion2)); @@ -104,7 +104,7 @@ describe('SuggestedFix', () => { const suggestion = new SuggestedFix( 'Replace me!', location1, - 'With this!' + 'With this!', ); const codeAction = suggestion.toCodeAction(); diff --git a/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts b/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts index f0328893e..4c1467b57 100644 --- a/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts +++ b/editors/code/src/test/utils/diagnotics/SuggestedFixCollection.test.ts @@ -8,20 +8,20 @@ const uri1 = vscode.Uri.file('/file/1'); const uri2 = vscode.Uri.file('/file/2'); const mockDocument1 = ({ - uri: uri1 + uri: uri1, } as unknown) as vscode.TextDocument; const mockDocument2 = ({ - uri: uri2 + uri: uri2, } as unknown) as vscode.TextDocument; const range1 = new vscode.Range( new vscode.Position(1, 2), - new vscode.Position(3, 4) + new vscode.Position(3, 4), ); const range2 = new vscode.Range( new vscode.Position(5, 6), - new vscode.Position(7, 8) + new vscode.Position(7, 8), ); const diagnostic1 = new vscode.Diagnostic(range1, 'First diagnostic'); @@ -32,7 +32,7 @@ function suggestion1(): SuggestedFix { return new SuggestedFix( 'Replace me!', new vscode.Location(uri1, range1), - 'With this!' + 'With this!', ); } @@ -44,7 +44,7 @@ describe('SuggestedFixCollection', () => { // Specify the document and range that exactly matches const codeActions = suggestedFixes.provideCodeActions( mockDocument1, - range1 + range1, ); assert.strictEqual(codeActions.length, 1); @@ -66,7 +66,7 @@ describe('SuggestedFixCollection', () => { const codeActions = suggestedFixes.provideCodeActions( mockDocument1, - range2 + range2, ); assert(!codeActions || codeActions.length === 0); @@ -78,7 +78,7 @@ describe('SuggestedFixCollection', () => { const codeActions = suggestedFixes.provideCodeActions( mockDocument2, - range1 + range1, ); assert(!codeActions || codeActions.length === 0); @@ -91,7 +91,7 @@ describe('SuggestedFixCollection', () => { const codeActions = suggestedFixes.provideCodeActions( mockDocument1, - range1 + range1, ); assert(!codeActions || codeActions.length === 0); @@ -106,7 +106,7 @@ describe('SuggestedFixCollection', () => { const codeActions = suggestedFixes.provideCodeActions( mockDocument1, - range1 + range1, ); assert.strictEqual(codeActions.length, 1); diff --git a/editors/code/src/test/utils/diagnotics/rust.test.ts b/editors/code/src/test/utils/diagnotics/rust.test.ts index 327d15046..cee59061f 100644 --- a/editors/code/src/test/utils/diagnotics/rust.test.ts +++ b/editors/code/src/test/utils/diagnotics/rust.test.ts @@ -6,14 +6,14 @@ import { MappedRustDiagnostic, mapRustDiagnosticToVsCode, RustDiagnostic, - SuggestionApplicability + SuggestionApplicability, } from '../../../utils/diagnostics/rust'; function loadDiagnosticFixture(name: string): RustDiagnostic { const jsonText = fs .readFileSync( // We're actually in our JavaScript output directory, climb out - `${__dirname}/../../../../src/test/fixtures/rust-diagnostics/${name}.json` + `${__dirname}/../../../../src/test/fixtures/rust-diagnostics/${name}.json`, ) .toString(); @@ -33,12 +33,12 @@ function mapFixtureToVsCode(name: string): MappedRustDiagnostic { describe('mapRustDiagnosticToVsCode', () => { it('should map an incompatible type for trait error', () => { const { diagnostic, suggestedFixes } = mapFixtureToVsCode( - 'error/E0053' + 'error/E0053', ); assert.strictEqual( diagnostic.severity, - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); assert.strictEqual(diagnostic.source, 'rustc'); assert.strictEqual( @@ -46,8 +46,8 @@ describe('mapRustDiagnosticToVsCode', () => { [ `method \`next\` has an incompatible type for trait`, `expected type \`fn(&mut ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&ty::Ref>\``, - ` found type \`fn(&ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&'list ty::Ref>\`` - ].join('\n') + ` found type \`fn(&ty::list_iter::ListIterator<'list, M>) -> std::option::Option<&'list ty::Ref>\``, + ].join('\n'), ); assert.strictEqual(diagnostic.code, 'E0053'); assert.deepStrictEqual(diagnostic.tags, []); @@ -61,24 +61,24 @@ describe('mapRustDiagnosticToVsCode', () => { it('should map an unused variable warning', () => { const { diagnostic, suggestedFixes } = mapFixtureToVsCode( - 'warning/unused_variables' + 'warning/unused_variables', ); assert.strictEqual( diagnostic.severity, - vscode.DiagnosticSeverity.Warning + vscode.DiagnosticSeverity.Warning, ); assert.strictEqual( diagnostic.message, [ 'unused variable: `foo`', - '#[warn(unused_variables)] on by default' - ].join('\n') + '#[warn(unused_variables)] on by default', + ].join('\n'), ); assert.strictEqual(diagnostic.code, 'unused_variables'); assert.strictEqual(diagnostic.source, 'rustc'); assert.deepStrictEqual(diagnostic.tags, [ - vscode.DiagnosticTag.Unnecessary + vscode.DiagnosticTag.Unnecessary, ]); // No related information @@ -89,29 +89,29 @@ describe('mapRustDiagnosticToVsCode', () => { const [suggestedFix] = suggestedFixes; assert.strictEqual( suggestedFix.title, - 'consider prefixing with an underscore: `_foo`' + 'consider prefixing with an underscore: `_foo`', ); assert.strictEqual( suggestedFix.applicability, - SuggestionApplicability.MachineApplicable + SuggestionApplicability.MachineApplicable, ); }); it('should map a wrong number of parameters error', () => { const { diagnostic, suggestedFixes } = mapFixtureToVsCode( - 'error/E0061' + 'error/E0061', ); assert.strictEqual( diagnostic.severity, - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); assert.strictEqual( diagnostic.message, [ 'this function takes 2 parameters but 3 parameters were supplied', - 'expected 2 parameters' - ].join('\n') + 'expected 2 parameters', + ].join('\n'), ); assert.strictEqual(diagnostic.code, 'E0061'); assert.strictEqual(diagnostic.source, 'rustc'); @@ -132,12 +132,12 @@ describe('mapRustDiagnosticToVsCode', () => { it('should map a Clippy copy pass by ref warning', () => { const { diagnostic, suggestedFixes } = mapFixtureToVsCode( - 'clippy/trivially_copy_pass_by_ref' + 'clippy/trivially_copy_pass_by_ref', ); assert.strictEqual( diagnostic.severity, - vscode.DiagnosticSeverity.Warning + vscode.DiagnosticSeverity.Warning, ); assert.strictEqual(diagnostic.source, 'clippy'); assert.strictEqual( @@ -145,8 +145,8 @@ describe('mapRustDiagnosticToVsCode', () => { [ 'this argument is passed by reference, but would be more efficient if passed by value', '#[warn(clippy::trivially_copy_pass_by_ref)] implied by #[warn(clippy::all)]', - 'for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref' - ].join('\n') + 'for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref', + ].join('\n'), ); assert.strictEqual(diagnostic.code, 'trivially_copy_pass_by_ref'); assert.deepStrictEqual(diagnostic.tags, []); @@ -165,27 +165,27 @@ describe('mapRustDiagnosticToVsCode', () => { const [suggestedFix] = suggestedFixes; assert.strictEqual( suggestedFix.title, - 'consider passing by value instead: `self`' + 'consider passing by value instead: `self`', ); // Clippy does not mark this with any applicability assert.strictEqual( suggestedFix.applicability, - SuggestionApplicability.Unspecified + SuggestionApplicability.Unspecified, ); }); it('should map a mismatched type error', () => { const { diagnostic, suggestedFixes } = mapFixtureToVsCode( - 'error/E0308' + 'error/E0308', ); assert.strictEqual( diagnostic.severity, - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); assert.strictEqual( diagnostic.message, - ['mismatched types', 'expected usize, found u32'].join('\n') + ['mismatched types', 'expected usize, found u32'].join('\n'), ); assert.strictEqual(diagnostic.code, 'E0308'); assert.strictEqual(diagnostic.source, 'rustc'); diff --git a/editors/code/src/test/utils/diagnotics/vscode.test.ts b/editors/code/src/test/utils/diagnotics/vscode.test.ts index 542dec1f5..4944dd032 100644 --- a/editors/code/src/test/utils/diagnotics/vscode.test.ts +++ b/editors/code/src/test/utils/diagnotics/vscode.test.ts @@ -5,12 +5,12 @@ import { areDiagnosticsEqual } from '../../../utils/diagnostics/vscode'; const range1 = new vscode.Range( new vscode.Position(1, 2), - new vscode.Position(3, 4) + new vscode.Position(3, 4), ); const range2 = new vscode.Range( new vscode.Position(5, 6), - new vscode.Position(7, 8) + new vscode.Position(7, 8), ); describe('areDiagnosticsEqual', () => { @@ -18,13 +18,13 @@ describe('areDiagnosticsEqual', () => { const diagnostic1 = new vscode.Diagnostic( range1, 'Hello, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); const diagnostic2 = new vscode.Diagnostic( range1, 'Hello, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); assert(areDiagnosticsEqual(diagnostic1, diagnostic2)); @@ -34,14 +34,14 @@ describe('areDiagnosticsEqual', () => { const diagnostic1 = new vscode.Diagnostic( range1, 'Hello, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); diagnostic1.source = 'rustc'; const diagnostic2 = new vscode.Diagnostic( range1, 'Hello, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); diagnostic2.source = 'clippy'; @@ -52,13 +52,13 @@ describe('areDiagnosticsEqual', () => { const diagnostic1 = new vscode.Diagnostic( range1, 'Hello, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); const diagnostic2 = new vscode.Diagnostic( range2, 'Hello, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); assert(!areDiagnosticsEqual(diagnostic1, diagnostic2)); @@ -68,13 +68,13 @@ describe('areDiagnosticsEqual', () => { const diagnostic1 = new vscode.Diagnostic( range1, 'Hello, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); const diagnostic2 = new vscode.Diagnostic( range1, 'Goodbye!, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); assert(!areDiagnosticsEqual(diagnostic1, diagnostic2)); @@ -84,13 +84,13 @@ describe('areDiagnosticsEqual', () => { const diagnostic1 = new vscode.Diagnostic( range1, 'Hello, world!', - vscode.DiagnosticSeverity.Warning + vscode.DiagnosticSeverity.Warning, ); const diagnostic2 = new vscode.Diagnostic( range1, 'Hello, world!', - vscode.DiagnosticSeverity.Error + vscode.DiagnosticSeverity.Error, ); assert(!areDiagnosticsEqual(diagnostic1, diagnostic2)); diff --git a/editors/code/src/test/utils/index.ts b/editors/code/src/test/utils/index.ts index 16715a286..9927daaf6 100644 --- a/editors/code/src/test/utils/index.ts +++ b/editors/code/src/test/utils/index.ts @@ -17,7 +17,7 @@ import * as path from 'path'; export function run(): Promise { // Create the mocha test const mocha = new Mocha({ - ui: 'bdd' + ui: 'bdd', }); mocha.useColors(true); -- cgit v1.2.3