Browse Source

Formatting updates from the prettier upgrade.

Jason Grout 5 years ago
parent
commit
c9680aeea0

+ 6 - 9
packages/application/src/lab.ts

@@ -31,15 +31,12 @@ export class JupyterLab extends JupyterFrontEnd<ILabShell> {
       .catch(() => undefined);
 
     // Create an IInfo dictionary from the options to override the defaults.
-    const info = Object.keys(JupyterLab.defaultInfo).reduce(
-      (acc, val) => {
-        if (val in options) {
-          (acc as any)[val] = JSON.parse(JSON.stringify((options as any)[val]));
-        }
-        return acc;
-      },
-      {} as Partial<JupyterLab.IInfo>
-    );
+    const info = Object.keys(JupyterLab.defaultInfo).reduce((acc, val) => {
+      if (val in options) {
+        (acc as any)[val] = JSON.parse(JSON.stringify((options as any)[val]));
+      }
+      return acc;
+    }, {} as Partial<JupyterLab.IInfo>);
 
     // Populate application info.
     this._info = { ...JupyterLab.defaultInfo, ...info };

+ 3 - 5
packages/apputils/src/printing.ts

@@ -70,11 +70,9 @@ export namespace Printing {
    * @param url URL to load into an iframe.
    */
   export async function printURL(url: string): Promise<void> {
-    const text = await (await ServerConnection.makeRequest(
-      url,
-      {},
-      settings
-    )).text();
+    const text = await (
+      await ServerConnection.makeRequest(url, {}, settings)
+    ).text();
     return printContent(text);
   }
 

+ 4 - 7
packages/completer/src/connector.ts

@@ -90,13 +90,10 @@ namespace Private {
     const matches = kernel.matches.slice();
 
     // Cache all the kernel matches in a memo.
-    const memo = matches.reduce(
-      (acc, val) => {
-        acc[val] = null;
-        return acc;
-      },
-      {} as { [key: string]: string }
-    );
+    const memo = matches.reduce((acc, val) => {
+      acc[val] = null;
+      return acc;
+    }, {} as { [key: string]: string });
 
     // Add each context match that is not in the memo to the result.
     context.matches.forEach(match => {

+ 4 - 7
packages/completer/src/model.ts

@@ -419,13 +419,10 @@ namespace Private {
   /**
    * The map of known type annotations of completer matches.
    */
-  const KNOWN_MAP = KNOWN_TYPES.reduce(
-    (acc, type) => {
-      acc[type] = null;
-      return acc;
-    },
-    {} as Completer.TypeMap
-  );
+  const KNOWN_MAP = KNOWN_TYPES.reduce((acc, type) => {
+    acc[type] = null;
+    return acc;
+  }, {} as Completer.TypeMap);
 
   /**
    * A filtered completion menu matching result.

+ 11 - 7
packages/console-extension/src/index.ts

@@ -237,10 +237,12 @@ async function activateConsole(
       ...(options as Partial<ConsolePanel.IOptions>)
     });
 
-    const interactionMode: string = (await settingRegistry.get(
-      '@jupyterlab/console-extension:tracker',
-      'interactionMode'
-    )).composite as string;
+    const interactionMode: string = (
+      await settingRegistry.get(
+        '@jupyterlab/console-extension:tracker',
+        'interactionMode'
+      )
+    ).composite as string;
     panel.console.node.dataset.jpInteractionMode = interactionMode;
 
     // Add the console panel to the tracker. We want the panel to show up before
@@ -580,9 +582,11 @@ async function activateConsole(
     execute: async args => {
       const key = 'keyMap';
       try {
-        await settingRegistry.set(pluginId, 'interactionMode', args[
-          'interactionMode'
-        ] as string);
+        await settingRegistry.set(
+          pluginId,
+          'interactionMode',
+          args['interactionMode'] as string
+        );
       } catch (reason) {
         console.error(`Failed to set ${pluginId}:${key} - ${reason.message}`);
       }

+ 4 - 7
packages/coreutils/src/statedb.ts

@@ -149,13 +149,10 @@ export class StateDB<T extends ReadonlyJSONValue = ReadonlyJSONValue>
 
     const { ids, values } = await this._list();
 
-    return values.reduce(
-      (acc, val, idx) => {
-        acc[ids[idx]] = val;
-        return acc;
-      },
-      {} as { [id: string]: T }
-    );
+    return values.reduce((acc, val, idx) => {
+      acc[ids[idx]] = val;
+      return acc;
+    }, {} as { [id: string]: T });
   }
 
   /**

+ 9 - 12
packages/coreutils/src/url.ts

@@ -125,18 +125,15 @@ export namespace URLExt {
     return value
       .replace(/^\?/, '')
       .split('&')
-      .reduce(
-        (acc, val) => {
-          const [key, value] = val.split('=');
-
-          if (key.length > 0) {
-            acc[key] = decodeURIComponent(value || '');
-          }
-
-          return acc;
-        },
-        {} as { [key: string]: string }
-      );
+      .reduce((acc, val) => {
+        const [key, value] = val.split('=');
+
+        if (key.length > 0) {
+          acc[key] = decodeURIComponent(value || '');
+        }
+
+        return acc;
+      }, {} as { [key: string]: string });
   }
 
   /**

+ 8 - 6
packages/filebrowser-extension/src/index.ts

@@ -487,12 +487,14 @@ function addCommands(
     caption: args => (args.path ? `Open ${args.path}` : 'Open from path'),
     execute: async ({ path }: { path?: string }) => {
       if (!path) {
-        path = (await InputDialog.getText({
-          label: 'Path',
-          placeholder: '/path/relative/to/jlab/root',
-          title: 'Open Path',
-          okLabel: 'Open'
-        })).value;
+        path = (
+          await InputDialog.getText({
+            label: 'Path',
+            placeholder: '/path/relative/to/jlab/root',
+            title: 'Open Path',
+            okLabel: 'Open'
+          })
+        ).value;
       }
       if (!path) {
         return;

+ 7 - 6
packages/help-extension/src/index.tsx

@@ -156,15 +156,16 @@ function activate(
 
   // Populate the Help menu.
   const helpMenu = mainMenu.helpMenu;
-  const labGroup = [CommandIDs.about, CommandIDs.launchClassic].map(
-    command => ({ command })
-  );
+  const labGroup = [
+    CommandIDs.about,
+    CommandIDs.launchClassic
+  ].map(command => ({ command }));
   helpMenu.addGroup(labGroup, 0);
 
   // Contextual help in its own group
-  const contextualHelpGroup = [inspector ? 'inspector:open' : null].map(
-    command => ({ command })
-  );
+  const contextualHelpGroup = [
+    inspector ? 'inspector:open' : null
+  ].map(command => ({ command }));
   helpMenu.addGroup(contextualHelpGroup, 0);
 
   const resourcesGroup = RESOURCES.map(args => ({

+ 7 - 3
packages/logconsole-extension/src/index.tsx

@@ -381,9 +381,13 @@ export class LogLevelSwitcher extends ReactWidget {
           options={
             logger === null
               ? []
-              : ['Critical', 'Error', 'Warning', 'Info', 'Debug'].map(
-                  label => ({ label, value: label.toLowerCase() })
-                )
+              : [
+                  'Critical',
+                  'Error',
+                  'Warning',
+                  'Info',
+                  'Debug'
+                ].map(label => ({ label, value: label.toLowerCase() }))
           }
         />
       </>

+ 8 - 2
packages/mathjax2/src/index.ts

@@ -71,8 +71,14 @@ export class MathJaxTypesetter implements IRenderMime.ILatexTypesetter {
   private _onLoad(): void {
     MathJax.Hub.Config({
       tex2jax: {
-        inlineMath: [['$', '$'], ['\\(', '\\)']],
-        displayMath: [['$$', '$$'], ['\\[', '\\]']],
+        inlineMath: [
+          ['$', '$'],
+          ['\\(', '\\)']
+        ],
+        displayMath: [
+          ['$$', '$$'],
+          ['\\[', '\\]']
+        ],
         processEscapes: true,
         processEnvironments: true
       },

+ 5 - 3
packages/notebook-extension/src/index.ts

@@ -1702,9 +1702,11 @@ function addCommands(
         return;
       }
 
-      return Private.createConsole(commands, current, args[
-        'activate'
-      ] as boolean);
+      return Private.createConsole(
+        commands,
+        current,
+        args['activate'] as boolean
+      );
     },
     isEnabled
   });

+ 4 - 2
packages/notebook/src/default-toolbar.tsx

@@ -252,8 +252,10 @@ export class CellTypeSwitcher extends ReactWidget {
    */
   handleChange = (event: React.ChangeEvent<HTMLSelectElement>): void => {
     if (event.target.value !== '-') {
-      NotebookActions.changeCellType(this._notebook, event.target
-        .value as nbformat.CellType);
+      NotebookActions.changeCellType(
+        this._notebook,
+        event.target.value as nbformat.CellType
+      );
       this._notebook.activate();
     }
   };

+ 1 - 3
packages/rendermime/src/factories.ts

@@ -83,9 +83,7 @@ export const javaScriptRendererFactory: IRenderMime.IRendererFactory = {
 /**
  * The standard factories provided by the rendermime package.
  */
-export const standardRendererFactories: ReadonlyArray<
-  IRenderMime.IRendererFactory
-> = [
+export const standardRendererFactories: ReadonlyArray<IRenderMime.IRendererFactory> = [
   htmlRendererFactory,
   markdownRendererFactory,
   latexRendererFactory,

+ 2 - 1
packages/services/src/kernel/future.ts

@@ -451,7 +451,8 @@ namespace Private {
 
     private _hooks: (
       | ((msg: T) => boolean | PromiseLike<boolean>)
-      | null)[] = [];
+      | null
+    )[] = [];
     private _compactScheduled: boolean;
     private _processing: Promise<void>;
   }

+ 6 - 1
tests/test-console/src/history.spec.ts

@@ -30,7 +30,12 @@ const mockHistory: KernelMessage.IHistoryReplyMsg = {
   channel: 'shell',
   content: {
     status: 'ok',
-    history: [[0, 0, 'foo'], [0, 0, 'bar'], [0, 0, 'baz'], [0, 0, 'qux']]
+    history: [
+      [0, 0, 'foo'],
+      [0, 0, 'bar'],
+      [0, 0, 'baz'],
+      [0, 0, 'qux']
+    ]
   }
 };
 

+ 3 - 3
tests/test-csvviewer/src/model.spec.ts

@@ -84,9 +84,9 @@ describe('csvviewer/model', () => {
         expect(d.rowCount('body')).to.equal(1);
         expect(d.columnCount('row-header')).to.equal(1);
         expect(d.columnCount('body')).to.equal(3);
-        expect([0, 1, 2].map(i => d.data('column-header', 0, i))).to.deep.equal(
-          ['a', 'b', 'c']
-        );
+        expect(
+          [0, 1, 2].map(i => d.data('column-header', 0, i))
+        ).to.deep.equal(['a', 'b', 'c']);
         expect([0, 1, 2].map(i => d.data('body', 0, i))).to.deep.equal([
           'd',
           'e',