update prettier

pull/9230/head
Niklas Fiekas 2021-06-21 17:46:54 +02:00
parent 80922827d7
commit 8d70325325
13 changed files with 72 additions and 70 deletions

View File

@ -43,8 +43,7 @@ db.user4
posts: [
{
id: Math.random().toString(36).substring(2, 10),
text:
'You are most welcome to join us!\n\nhttps://lichess.org/blog/W-nQzxYAAC8AaUUo/lichess-london-meetup-on-the-24th-november\n\nYou received this message because you connected from the UK, Ireland, France or Belgium.',
text: 'You are most welcome to join us!\n\nhttps://lichess.org/blog/W-nQzxYAAC8AaUUo/lichess-london-meetup-on-the-24th-november\n\nYou received this message because you connected from the UK, Ireland, France or Belgium.',
isByCreator: true,
isRead: false,
createdAt: new Date(),

View File

@ -1,6 +1,7 @@
const ids = 'BJy6fEDf fE4k21MW 8yadFPpU PDkQDt6u 96Lij7wH Rg2cMBZ6 9ogFv8Ac tuoBxVE5 Qj281y1p MnsJEWnI RUQASaZm o734CNqp ITWY4GN2 9cKgYrHb g1fxVZu9 s5pLU7Of xebrDvFe A4ujYOer pt20yRkT MkDViieT 9c6GrCTk Z1DKk4Rl'.split(
' '
);
const ids =
'BJy6fEDf fE4k21MW 8yadFPpU PDkQDt6u 96Lij7wH Rg2cMBZ6 9ogFv8Ac tuoBxVE5 Qj281y1p MnsJEWnI RUQASaZm o734CNqp ITWY4GN2 9cKgYrHb g1fxVZu9 s5pLU7Of xebrDvFe A4ujYOer pt20yRkT MkDViieT 9c6GrCTk Z1DKk4Rl'.split(
' '
);
ids.forEach(id => {
var study = db.study.findOne({ _id: id });

View File

@ -2,9 +2,10 @@ const fs = require('fs').promises;
const parseString = require('xml2js').parseString;
const baseDir = 'translation/source';
const dbs = 'site arena emails learn activity coordinates study clas contact patron coach broadcast streamer tfa settings preferences team perfStat search tourname faq lag swiss puzzle puzzleTheme challenge storm'.split(
' '
);
const dbs =
'site arena emails learn activity coordinates study clas contact patron coach broadcast streamer tfa settings preferences team perfStat search tourname faq lag swiss puzzle puzzleTheme challenge storm'.split(
' '
);
function ucfirst(s) {
return s.charAt(0).toUpperCase() + s.slice(1);

View File

@ -22,7 +22,7 @@
"yarn": "^1"
},
"dependencies": {
"prettier": "2.2.1",
"prettier": "2.3.1",
"xml2js": "0.4.19"
},
"devDependencies": {

View File

@ -68,19 +68,13 @@ interface Lichess {
(data: any, trans: Trans, el: HTMLElement): void;
};
movetimeChart: any;
RoundNVUI?(
redraw: () => void
): {
RoundNVUI?(redraw: () => void): {
render(ctrl: any): any;
};
AnalyseNVUI?(
redraw: () => void
): {
AnalyseNVUI?(redraw: () => void): {
render(ctrl: any): any;
};
PuzzleNVUI?(
redraw: () => void
): {
PuzzleNVUI?(redraw: () => void): {
render(ctrl: any): any;
};
playMusic(): any;

View File

@ -280,9 +280,8 @@ export function view(ctrl: StudyChapterNewFormCtrl): VNode {
if (!file) return;
const reader = new FileReader();
reader.onload = function () {
(document.getElementById(
'chapter-pgn'
) as HTMLTextAreaElement).value = reader.result as string;
(document.getElementById('chapter-pgn') as HTMLTextAreaElement).value =
reader.result as string;
};
reader.readAsText(file);
}),

View File

@ -710,7 +710,7 @@ export default function (
redraw,
trans: ctrl.trans,
socketHandler: (t: string, d: any) => {
const handler = ((socketHandlers as any) as SocketHandlers)[t];
const handler = (socketHandlers as any as SocketHandlers)[t];
if (handler) {
handler(d);
return true;

View File

@ -245,11 +245,13 @@ export default function (ctrl: AnalyseCtrl, concealOf?: ConcealOf): VNode {
{
hook: mainHook(ctrl),
},
([
isEmpty(commentTags) ? null : h('interrupt', commentTags),
root.ply & 1 ? moveView.renderIndex(root.ply, false) : null,
root.ply & 1 ? emptyMove() : null,
] as MaybeVNodes).concat(
(
[
isEmpty(commentTags) ? null : h('interrupt', commentTags),
root.ply & 1 ? moveView.renderIndex(root.ply, false) : null,
root.ply & 1 ? emptyMove() : null,
] as MaybeVNodes
).concat(
renderChildrenOf(ctx, root, {
parentPath: '',
isMainline: true,

View File

@ -3,7 +3,8 @@
import { VNode, Hooks } from 'snabbdom';
// from https://github.com/bryanwoods/autolink-js/blob/master/autolink.js
export const linkRegex = /(^|[\s\n]|<[A-Za-z]*\/?>)((?:(?:https?|ftp):\/\/|lichess\.org)[\-A-Z0-9+\u0026\u2019@#\/%?=()~_|!:,.;]*[\-A-Z0-9+\u0026@#\/%=~()_|])/gi;
export const linkRegex =
/(^|[\s\n]|<[A-Za-z]*\/?>)((?:(?:https?|ftp):\/\/|lichess\.org)[\-A-Z0-9+\u0026\u2019@#\/%?=()~_|!:,.;]*[\-A-Z0-9+\u0026@#\/%=~()_|])/gi;
export const newLineRegex = /\n/g;
export const userPattern = /(^|[^\w@#/])@([a-z0-9][a-z0-9_-]{0,28}[a-z0-9])/gi;
@ -58,7 +59,8 @@ export function richHTML(text: string, newLines = true): Hooks {
const linkPattern = /\b\b(?:https?:\/\/)?(lichess\.org\/[-–—\w+&'@#\/%?=()~|!:,.;]+[\w+&@#\/%=~|])/gi;
const pawnDropPattern = /^[a-h][2-7]$/;
const movePattern = /\b(\d+)\s*(\.+)\s*(?:[o0-]+[o0]|[NBRQKP\u2654\u2655\u2656\u2657\u2658\u2659]?[a-h]?[1-8]?[x@]?[a-z][1-8](?:=[NBRQK\u2654\u2655\u2656\u2657\u2658\u2659])?)\+?#?[!\?=]{0,5}/gi;
const movePattern =
/\b(\d+)\s*(\.+)\s*(?:[o0-]+[o0]|[NBRQKP\u2654\u2655\u2656\u2657\u2658\u2659]?[a-h]?[1-8]?[x@]?[a-z][1-8](?:=[NBRQK\u2654\u2655\u2656\u2657\u2658\u2659])?)\+?#?[!\?=]{0,5}/gi;
function moveReplacer(match: string, turn: number, dots: string) {
if (turn < 1 || turn > 200) return match;

View File

@ -35,11 +35,13 @@ export interface StoredJsonProp<T> {
(v: T): T;
}
export const storedJsonProp = <T>(key: string, defaultValue: () => T): StoredJsonProp<T> => (v?: T) => {
if (defined(v)) {
storage.set(key, JSON.stringify(v));
return v;
}
const ret = JSON.parse(storage.get(key)!);
return ret !== null ? ret : defaultValue();
};
export const storedJsonProp =
<T>(key: string, defaultValue: () => T): StoredJsonProp<T> =>
(v?: T) => {
if (defined(v)) {
storage.set(key, JSON.stringify(v));
return v;
}
const ret = JSON.parse(storage.get(key)!);
return ret !== null ? ret : defaultValue();
};

View File

@ -14,34 +14,36 @@ export const playModifiers = (run: Run) => {
};
};
export const renderCombo = (config: Config, renderBonus: (bonus: number) => string) => (run: Run): VNode => {
const level = run.combo.level();
return h('div.puz-combo', [
h('div.puz-combo__counter', [
h('span.puz-combo__counter__value', run.combo.current),
h('span.puz-combo__counter__combo', 'COMBO'),
]),
h('div.puz-combo__bars', [
h('div.puz-combo__bar', [
h('div.puz-combo__bar__in', {
attrs: { style: `width:${run.combo.percent()}%` },
}),
h('div.puz-combo__bar__in-full'),
export const renderCombo =
(config: Config, renderBonus: (bonus: number) => string) =>
(run: Run): VNode => {
const level = run.combo.level();
return h('div.puz-combo', [
h('div.puz-combo__counter', [
h('span.puz-combo__counter__value', run.combo.current),
h('span.puz-combo__counter__combo', 'COMBO'),
]),
h(
'div.puz-combo__levels',
[0, 1, 2, 3].map(l =>
h(
'div.puz-combo__level',
{
class: {
active: l < level,
h('div.puz-combo__bars', [
h('div.puz-combo__bar', [
h('div.puz-combo__bar__in', {
attrs: { style: `width:${run.combo.percent()}%` },
}),
h('div.puz-combo__bar__in-full'),
]),
h(
'div.puz-combo__levels',
[0, 1, 2, 3].map(l =>
h(
'div.puz-combo__level',
{
class: {
active: l < level,
},
},
},
h('span', renderBonus(config.combo.levels[l + 1][1]))
h('span', renderBonus(config.combo.levels[l + 1][1]))
)
)
)
),
]),
]);
};
),
]),
]);
};

View File

@ -91,7 +91,7 @@ lichess.load.then(() => {
const $svg = $('<svg class="sparkline" height="80px" stroke-width="3">')
.attr('width', $(this).width() + 'px')
.prependTo($(this).empty());
sparkline(($svg[0] as unknown) as SVGSVGElement, $(this).data('points'), {
sparkline($svg[0] as unknown as SVGSVGElement, $(this).data('points'), {
interactive: true,
/* onmousemove(event, datapoint) { */
/* var svg = findClosest(event.target, "svg"); */

View File

@ -4055,10 +4055,10 @@ preserve@^0.2.0:
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=
prettier@2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5"
integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==
prettier@2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.1.tgz#76903c3f8c4449bc9ac597acefa24dc5ad4cbea6"
integrity sha512-p+vNbgpLjif/+D+DwAZAbndtRrR0md0MwfmOVN9N+2RgyACMT+7tfaRnT+WDPkqnuVwleyuBIG2XBxKDme3hPA==
pretty-bytes@^4.0.2:
version "4.0.2"