chore: use prettier instead of clang-format (#7014)

* chore: add and configure prettier

* chore: remove clang-format

* chore: remove clang-format config

* chore: lint additional ts files

* chore: fix lint errors in blocks

* chore: add prettier-ignore where needed

* chore: ignore js blocks when formatting

* chore: fix playground html syntax

* chore: fix yaml spacing from merge

* chore: convert text blocks to use arrow functions

* chore: format everything with prettier

* chore: fix lint unused imports in blocks
This commit is contained in:
Maribeth Bottorff
2023-05-10 16:01:39 -07:00
committed by GitHub
parent af991f5e1b
commit 88ff901a72
425 changed files with 29170 additions and 21169 deletions

View File

@@ -7,7 +7,6 @@
import * as goog from '../../closure/goog/goog.js';
goog.declareModuleId('Blockly.utils.userAgent');
/** The raw useragent string. */
let rawUserAgent: string;
@@ -29,47 +28,47 @@ let isTablet: boolean;
let isMobile: boolean;
(function(raw) {
rawUserAgent = raw;
const rawUpper = rawUserAgent.toUpperCase();
/**
* Case-insensitive test of whether name is in the useragent string.
*
* @param name Name to test.
* @returns True if name is present.
*/
function has(name: string): boolean {
return rawUpper.indexOf(name.toUpperCase()) !== -1;
}
(function (raw) {
rawUserAgent = raw;
const rawUpper = rawUserAgent.toUpperCase();
/**
* Case-insensitive test of whether name is in the useragent string.
*
* @param name Name to test.
* @returns True if name is present.
*/
function has(name: string): boolean {
return rawUpper.indexOf(name.toUpperCase()) !== -1;
}
// Browsers. Logic from:
// https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/browser.js
// Useragent for JavaFX:
// Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.44
// (KHTML, like Gecko) JavaFX/8.0 Safari/537.44
isJavaFx = has('JavaFX');
// Browsers. Logic from:
// https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/browser.js
// Useragent for JavaFX:
// Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.44
// (KHTML, like Gecko) JavaFX/8.0 Safari/537.44
isJavaFx = has('JavaFX');
// Engines. Logic from:
// https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/engine.js
isWebKit = has('WebKit');
isGecko = has('Gecko') && !isWebKit;
// Engines. Logic from:
// https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/engine.js
isWebKit = has('WebKit');
isGecko = has('Gecko') && !isWebKit;
// Platforms. Logic from:
// https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/platform.js
// and
// https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/extra.js
isAndroid = has('Android');
const maxTouchPoints =
// Platforms. Logic from:
// https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/platform.js
// and
// https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/extra.js
isAndroid = has('Android');
const maxTouchPoints =
globalThis['navigator'] && globalThis['navigator']['maxTouchPoints'];
isIPad = has('iPad') || has('Macintosh') && maxTouchPoints > 0;
isIPhone = has('iPhone') && !isIPad;
isMac = has('Macintosh');
isIPad = has('iPad') || (has('Macintosh') && maxTouchPoints > 0);
isIPhone = has('iPhone') && !isIPad;
isMac = has('Macintosh');
// Devices. Logic from:
// https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/device.js
isTablet = isIPad || isAndroid && !has('Mobile') || has('Silk');
isMobile = !isTablet && (isIPhone || isAndroid);
})(globalThis['navigator'] && globalThis['navigator']['userAgent'] || '');
// Devices. Logic from:
// https://github.com/google/closure-library/blob/master/closure/goog/labs/useragent/device.js
isTablet = isIPad || (isAndroid && !has('Mobile')) || has('Silk');
isMobile = !isTablet && (isIPhone || isAndroid);
})((globalThis['navigator'] && globalThis['navigator']['userAgent']) || '');
export const raw: string = rawUserAgent;