Skip to content

Commit

Permalink
Update prettier.
Browse files Browse the repository at this point in the history
  • Loading branch information
rictic committed Sep 17, 2024
1 parent 29abc5f commit 0e25060
Show file tree
Hide file tree
Showing 46 changed files with 384 additions and 384 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@
"eslint-plugin-no-only-tests": "^3.1.0",
"google_modes": "git+https://github.com/codemirror/google-modes.git#247b63cee78b3775f8a3173184bf706c5b006d25",
"playwright": "^1.46.1",
"prettier": "^2.0.5",
"prettier": "^3.2.2",
"rollup": "^3.2.5",
"rollup-plugin-copy": "^3.3.0",
"rollup-plugin-lit-css": "^4.0.0",
Expand Down
6 changes: 4 additions & 2 deletions playground-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,10 @@ div.CodeMirror-dragcursors {
margin: 0;
padding: 0;

box-shadow: rgba(0, 0, 0, 0.2) 0px 5px 5px -3px,
rgba(0, 0, 0, 0.14) 0px 8px 10px 1px, rgba(0, 0, 0, 0.12) 0px 3px 14px 2px;
box-shadow:
rgba(0, 0, 0, 0.2) 0px 5px 5px -3px,
rgba(0, 0, 0, 0.14) 0px 8px 10px 1px,
rgba(0, 0, 0, 0.12) 0px 3px 14px 2px;
border: 1px solid var(--playground-code-selection-background, silver);

background: var(--playground-code-background, white);
Expand Down
26 changes: 13 additions & 13 deletions scripts/theme-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import CleanCSS from 'clean-css';

const rootDir = pathlib.resolve(
pathlib.dirname(url.fileURLToPath(import.meta.url)),
'..'
'..',
);

const mkdirAndWriteUtf8 = async (path, data) => {
Expand Down Expand Up @@ -63,7 +63,7 @@ const postMinifyCss = (css) => {
// most of it.
css = css.replace(
/ none repeat scroll 0% 0%\s*\/\s*auto padding-box border-box/g,
''
'',
);
// The computed value of a `border` property includes all values even when
// width is 0. We can strip off the rest when width is 0.
Expand All @@ -73,12 +73,12 @@ const postMinifyCss = (css) => {

const makeThemeCss = (themeName, results, defaultResults) => {
const excludeDefaults = Object.values(results).filter(
(r) => defaultResults[r.to].value !== r.value
(r) => defaultResults[r.to].value !== r.value,
);
return postMinifyCss(
minifyCss(`.playground-theme-${themeName} {
${excludeDefaults.map(({to, value}) => ` ${to}: ${value};`).join('\n')}
}`)
}`),
);
};

Expand Down Expand Up @@ -121,7 +121,7 @@ const main = async () => {
]);
const themeFilenames = fs
.readdirSync(
pathlib.resolve(rootDir, 'node_modules', 'codemirror', 'theme')
pathlib.resolve(rootDir, 'node_modules', 'codemirror', 'theme'),
)
.filter((name) => !excludeThemes.has(name));
const themeNames = [];
Expand All @@ -131,17 +131,17 @@ const main = async () => {
const styleUrl = `/node_modules/codemirror/theme/${filename}`;
const results = await page.evaluate(
([themeName, styleUrl]) => window.probe(themeName, styleUrl),
[themeName, styleUrl]
[themeName, styleUrl],
);
const css = makeThemeCss(themeName, results, defaultResults);
writes.push(
mkdirAndWriteUtf8(pathlib.join(rootDir, 'themes', filename), css)
mkdirAndWriteUtf8(pathlib.join(rootDir, 'themes', filename), css),
);
writes.push(
mkdirAndWriteUtf8(
pathlib.join(rootDir, 'src', 'themes', `${filename}.ts`),
makeCssModule(css)
)
makeCssModule(css),
),
);
}

Expand All @@ -156,8 +156,8 @@ ${themeNames
(themeName) =>
`import t${themeName.replace(
/-/g,
'_'
)} from '../themes/${themeName}.css.js';`
'_',
)} from '../themes/${themeName}.css.js';`,
)
.join('\n')}
Expand All @@ -171,8 +171,8 @@ ${themeNames
writes.push(
mkdirAndWriteUtf8(
pathlib.join(rootDir, 'src', 'configurator', 'themes.ts'),
allThemesTs
)
allThemesTs,
),
);

await Promise.all([browser.close(), server.stop(), ...writes]);
Expand Down
4 changes: 2 additions & 2 deletions scripts/update-version-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const getServiceWorkerHash = async () => {
if (matches.length !== 1) {
throw new Error(
'Expected exactly one version string in playground-service-worker.js. ' +
`Found ${matches.length}.`
`Found ${matches.length}.`,
);
}
// We must remove the version string itself from the service worker code
Expand Down Expand Up @@ -79,7 +79,7 @@ const oldVersionModuleCode = await fs.readFile(versionModulePath, 'utf8');
if (oldVersionModuleCode !== newVersionModuleCode) {
await fs.writeFile(versionModulePath, newVersionModuleCode, 'utf8');
console.log(
'Updated src/shared/version.ts, please commit this change and rebuild.'
'Updated src/shared/version.ts, please commit this change and rebuild.',
);
// Fail to help the publisher remember to commit.
process.exit(1);
Expand Down
8 changes: 4 additions & 4 deletions src/configurator/knobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,25 @@ interface SelectKnob<Id extends string, T extends string>
}

function checkbox<Id extends string>(
def: Omit<CheckboxKnob<Id>, 'type'>
def: Omit<CheckboxKnob<Id>, 'type'>,
): CheckboxKnob<Id> {
return {type: 'checkbox', ...def};
}

function slider<Id extends string>(
def: Omit<SliderKnob<Id>, 'type'>
def: Omit<SliderKnob<Id>, 'type'>,
): SliderKnob<Id> {
return {type: 'slider', ...def};
}

function color<Id extends string>(
def: Omit<ColorKnob<Id>, 'type'>
def: Omit<ColorKnob<Id>, 'type'>,
): ColorKnob<Id> {
return {type: 'color', ...def};
}

function select<Id extends string, T extends string>(
def: Omit<SelectKnob<Id, T>, 'type'>
def: Omit<SelectKnob<Id, T>, 'type'>,
): SelectKnob<Id, T> {
return {type: 'select', ...def};
}
Expand Down
8 changes: 4 additions & 4 deletions src/configurator/playground-configurator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ export class PlaygroundConfigurator extends LitElement {
<div class="knobs">
${knobsBySection[section].map((knob) => this.knob(knob))}
</div>
</section>`
</section>`,
);
}

Expand Down Expand Up @@ -489,7 +489,7 @@ ${props.join('\n')}
(option) =>
html`<option value=${option} ?selected=${option === value}>
${option}
</option>`
</option>`,
)}
</select>
`;
Expand Down Expand Up @@ -570,7 +570,7 @@ ${props.join('\n')}
}

private async _onThemeDetectorApply(
event: CustomEvent<{properties: Map<string, string | null>}>
event: CustomEvent<{properties: Map<string, string | null>}>,
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const values = new Map<KnobId, any>();
Expand Down Expand Up @@ -670,7 +670,7 @@ const githubCorner = html`<a
*/
const toHex = (rgbStr: string): string => {
const match = rgbStr.match(
/^\s*rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/
/^\s*rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/,
);
if (!match) {
return '';
Expand Down
16 changes: 8 additions & 8 deletions src/configurator/playground-theme-detector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ export class PlaygroundThemeDetector extends LitElement {
class="color"
title=${prop}
style="background:${color ?? 'transparent'}"
></span>`
></span>`,
)}
</div>
<div id="buttons">
<button
@click=${this._onClickApply}
.disabled=${![...this._propertyValues.values()].some(
(val) => val !== null
(val) => val !== null,
)}
>
Apply
Expand All @@ -183,7 +183,7 @@ export class PlaygroundThemeDetector extends LitElement {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(this._playgroundWithUserText as any)._codemirror.setOption(
'viewportMargin',
Infinity
Infinity,
);
}

Expand Down Expand Up @@ -237,7 +237,7 @@ export class PlaygroundThemeDetector extends LitElement {
const fragmentToProperty = new Map<string, string[]>();
const ourWalker = document.createTreeWalker(
this._playgroundWithUserText.shadowRoot!,
NodeFilter.SHOW_TEXT
NodeFilter.SHOW_TEXT,
);
while (ourWalker.nextNode()) {
const textNode = ourWalker.currentNode;
Expand All @@ -248,7 +248,7 @@ export class PlaygroundThemeDetector extends LitElement {

let property;
const cmClasses = [...parent.classList].filter((c) =>
c.startsWith('cm-')
c.startsWith('cm-'),
);
if (cmClasses.length > 0) {
// The last CodeMirror class tends to be more specific (e.g. `callee` is
Expand Down Expand Up @@ -282,7 +282,7 @@ export class PlaygroundThemeDetector extends LitElement {
const doc = this._iframeWithUserHtml.contentDocument!;
const theirWalker = doc.createTreeWalker(
doc.body,
NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT
NodeFilter.SHOW_TEXT | NodeFilter.SHOW_ELEMENT,
);
let foundBackground = false;
while (theirWalker.nextNode()) {
Expand All @@ -298,7 +298,7 @@ export class PlaygroundThemeDetector extends LitElement {
} else if (!foundBackground && node.nodeType === Node.ELEMENT_NODE) {
// Use the first non-transparent background (depth first).
const background = window.getComputedStyle(
node as Element
node as Element,
).backgroundColor;
if (background !== 'rgba(0, 0, 0, 0)') {
foundBackground = true;
Expand All @@ -317,7 +317,7 @@ export class PlaygroundThemeDetector extends LitElement {
detail: {
properties: this._propertyValues,
},
})
}),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/internal/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class PlaygroundBuild {
throw new Error(
`Unexpected BuildOutput kind: ${
(unreachable(output) as BuildOutput).kind
}`
}`,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/internal/tab-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class PlaygroundInternalTabBar extends LitElement {
new CustomEvent<{tab?: PlaygroundInternalTab}>('tabchange', {
detail: {tab: undefined},
bubbles: true,
})
}),
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/internal/tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class PlaygroundInternalTab extends LitElement {
new CustomEvent<{tab?: PlaygroundInternalTab}>('tabchange', {
detail: {tab: this},
bubbles: true,
})
}),
);
}
}
Expand Down
Loading

0 comments on commit 0e25060

Please sign in to comment.