Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update prettier for TS 3.7 #7528

Merged
merged 2 commits into from Nov 15, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion buildutils/package.json
Expand Up @@ -51,7 +51,7 @@
"mini-css-extract-plugin": "~0.6.0",
"package-json": "^6.3.0",
"path": "~0.12.7",
"prettier": "^1.18.2",
"prettier": "^1.19.1",
"semver": "^6.1.0",
"sort-package-json": "~1.22.1",
"typescript": "~3.7.2",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -99,7 +99,7 @@
"husky": "^2.3.0",
"lerna": "^3.13.2",
"lint-staged": "^8.1.5",
"prettier": "^1.18.2",
"prettier": "^1.19.1",
"tslint": "^5.15.0",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.0.1",
Expand Down
15 changes: 6 additions & 9 deletions packages/application/src/lab.ts
Expand Up @@ -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 };
Expand Down
8 changes: 3 additions & 5 deletions packages/apputils/src/printing.ts
Expand Up @@ -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);
}

Expand Down
11 changes: 4 additions & 7 deletions packages/completer/src/connector.ts
Expand Up @@ -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 => {
Expand Down
11 changes: 4 additions & 7 deletions packages/completer/src/model.ts
Expand Up @@ -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.
Expand Down
18 changes: 11 additions & 7 deletions packages/console-extension/src/index.ts
Expand Up @@ -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
Expand Down Expand Up @@ -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}`);
}
Expand Down
11 changes: 4 additions & 7 deletions packages/coreutils/src/statedb.ts
Expand Up @@ -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 });
}

/**
Expand Down
21 changes: 9 additions & 12 deletions packages/coreutils/src/url.ts
Expand Up @@ -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 });
}

/**
Expand Down
14 changes: 8 additions & 6 deletions packages/filebrowser-extension/src/index.ts
Expand Up @@ -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;
Expand Down
13 changes: 7 additions & 6 deletions packages/help-extension/src/index.tsx
Expand Up @@ -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 => ({
Expand Down
10 changes: 7 additions & 3 deletions packages/logconsole-extension/src/index.tsx
Expand Up @@ -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() }))
}
/>
</>
Expand Down
10 changes: 8 additions & 2 deletions packages/mathjax2/src/index.ts
Expand Up @@ -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
},
Expand Down
8 changes: 5 additions & 3 deletions packages/notebook-extension/src/index.ts
Expand Up @@ -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
});
Expand Down
6 changes: 4 additions & 2 deletions packages/notebook/src/default-toolbar.tsx
Expand Up @@ -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();
}
};
Expand Down
4 changes: 1 addition & 3 deletions packages/rendermime/src/factories.ts
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion packages/services/src/kernel/future.ts
Expand Up @@ -451,7 +451,8 @@ namespace Private {

private _hooks: (
| ((msg: T) => boolean | PromiseLike<boolean>)
| null)[] = [];
| null
)[] = [];
private _compactScheduled: boolean;
private _processing: Promise<void>;
}
Expand Down
7 changes: 6 additions & 1 deletion tests/test-console/src/history.spec.ts
Expand Up @@ -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']
]
}
};

Expand Down
6 changes: 3 additions & 3 deletions tests/test-csvviewer/src/model.spec.ts
Expand Up @@ -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',
Expand Down
7 changes: 6 additions & 1 deletion yarn.lock
Expand Up @@ -9763,11 +9763,16 @@ prettier-linter-helpers@^1.0.0:
dependencies:
fast-diff "^1.1.2"

prettier@^1.17.0, prettier@^1.18.2:
prettier@^1.17.0:
version "1.18.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==

prettier@^1.19.1:
version "1.19.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==

pretty-error@^2.0.2:
version "2.1.1"
resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3"
Expand Down