mirror of
https://github.com/apache/druid.git
synced 2025-02-07 02:28:19 +00:00
9745d9e1c3
* Initial eslint config * I guess eslint sorts underscores differently * Trim curlies (in jsx) * Re-organize rules * Use consistent quote props * Restructure eslint rules as additions/overrides to recommended configs * Fix the 'recommended' stuff * Add prefer-readonly * Add prefer-object-spread * Prettify * Add eslint-plugin-react-hooks * Switch to eslint-plugin-simple-sort-order So much better * Add no-extraneous-dependencies * ban-tslint-comment for funzies * If we enabled no-shadow, we'd probably want this option * Not prefer-for-of * no-confusing-void-expression, no-confusing-non-null-assertion * Add some no-unnecessary-* rules * non-nullable-type-assertion-style! * prefer-includes * Reorganize * prefer-things * switch-exhaustiveness-check * We don't need the jsdoc plugin, prettier has our backs * Remove a useless rule * Drop TSLint and (temporarily) awesome-code-style * Removing Object.assign revealed a type issue * Bring back awesome-code-style for sasslint config * Disable react/jsx-no-target-blank * Add prettify-check script * Add license to eslint config * Format readme * Update README for eslint, IDE settings * Add 'autofix' script * Switch to @awesome-code-style
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
/*
|
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
* or more contributor license agreements. See the NOTICE file
|
|
* distributed with this work for additional information
|
|
* regarding copyright ownership. The ASF licenses this file
|
|
* to you under the Apache License, Version 2.0 (the
|
|
* "License"); you may not use this file except in compliance
|
|
* with the License. You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
function sleep(msec: number) {
|
|
return new Promise(resolve => setTimeout(resolve, msec));
|
|
}
|
|
|
|
export async function retryIfJestAssertionError(
|
|
callback: () => Promise<void>,
|
|
msec = 1000,
|
|
maxTries = 60,
|
|
) {
|
|
let i = 0;
|
|
// eslint-disable-next-line no-constant-condition
|
|
while (true) {
|
|
try {
|
|
await callback();
|
|
return;
|
|
} catch (e) {
|
|
i++;
|
|
if (e.constructor.name === 'JestAssertionError' && i < maxTries) {
|
|
await sleep(msec);
|
|
} else {
|
|
throw e;
|
|
}
|
|
}
|
|
}
|
|
}
|