Skip to content

Commit

Permalink
Merge branch 'main' into renovate/core-js-3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
jtoar authored Oct 3, 2022
2 parents aad29b4 + fc8ee95 commit c1bd6ff
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 13 deletions.
9 changes: 6 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const findBabelConfig = (cwd = process.cwd()) => {
module.exports = {
extends: path.join(__dirname, 'packages/eslint-config/shared.js'),
parserOptions: {
ecmaVersion: 'latest',
babelOptions: {
configFile: findBabelConfig(),
},
Expand All @@ -31,6 +32,11 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 'off',
curly: 'error',
},
env: {
// We use the most modern environment available. Then we rely on Babel to
// transpile it to something that can run on all node versions we support
es2022: true,
},
overrides: [
{
files: ['packages/structure/src/**'],
Expand All @@ -56,7 +62,6 @@ module.exports = {
'packages/web/src/**',
],
env: {
es6: true,
browser: true,
},
globals: {
Expand Down Expand Up @@ -100,7 +105,6 @@ module.exports = {
{
files: ['packages/web/src/entry/index.js'],
env: {
es6: true,
browser: true,
},
globals: {
Expand All @@ -125,7 +129,6 @@ module.exports = {
'packages/telemetry/src/**',
],
env: {
es6: true,
node: true,
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/validations/validations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ export async function validateUniqueness(
model: string,
fields: Record<string, unknown>,
optionsOrCallback: UniquenessValidatorOptions,
callback: (tx: PrismaClient) => Promise<any>
callback?: (tx: PrismaClient) => Promise<any>
): Promise<any>
export async function validateUniqueness(
model: string,
Expand Down
2 changes: 0 additions & 2 deletions packages/cli/src/commands/generate/service/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const scenarioFieldValue = (field) => {

switch (field.type) {
case 'BigInt':
// eslint-disable-next-line no-undef
return `${BigInt(randInt)}n`
case 'Boolean':
return true
Expand Down Expand Up @@ -210,7 +209,6 @@ export const fieldsToUpdate = async (model) => {
// depending on the field type, append/update the value to something different
switch (field.type) {
case 'BigInt':
// eslint-disable-next-line no-undef
newValue = `${newValue + 1n}`
break
case 'Boolean': {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const flightcontrolConfig = {
$schema: 'https://app.flightcontrol.dev/schema.json',
environments: [
{
id: 'development',
Expand All @@ -12,10 +13,9 @@ export const flightcontrolConfig = {
id: 'redwood-api',
name: 'Redwood API',
type: 'fargate',
buildType: 'nixpacks',
cpu: 0.25,
memory: 0.5,
installCommand:
'yarn set version stable && NODE_ENV=development yarn install --immutable',
buildCommand: 'yarn rw deploy flightcontrol api',
startCommand: 'yarn rw deploy flightcontrol api --serve',
postBuildCommand: 'echo 0',
Expand All @@ -31,9 +31,8 @@ export const flightcontrolConfig = {
id: 'redwood-web',
name: 'Redwood Web',
type: 'static',
buildType: 'nixpacks',
singlePageApp: true,
installCommand:
'yarn set version stable && NODE_ENV=development yarn install --immutable',
buildCommand: 'yarn rw deploy flightcontrol web',
outputDirectory: 'web/dist',
envVariables: {
Expand Down
26 changes: 23 additions & 3 deletions packages/router/src/__tests__/router.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ describe('slow imports', () => {
}) => (
<Router
useAuth={mockUseAuth({ isAuthenticated: authenticated, hasRole })}
pageLoadingDelay={100}
pageLoadingDelay={200}
>
<Route
path="/"
Expand Down Expand Up @@ -264,7 +264,7 @@ describe('slow imports', () => {
)

beforeAll(() => {
mockDelay = 200
mockDelay = 400
})

afterAll(() => {
Expand Down Expand Up @@ -436,15 +436,35 @@ describe('slow imports', () => {
})

test('usePageLoadingContext', async () => {
// We want to show a loading indicator if loading pages is taking a long
// time. But at the same time we don't want to show it right away, because
// then there'll be a flash of the loading indicator on every page load.
// So we have a `pageLoadingDelay` delay to control how long it waits
// before showing the loading state (default is 1000 ms).
//
// RW lazy loads pages by default, that's why it could potentially take a
// while to load a page. But during tests we don't do that. So we have to
// fake a delay. That's what `mockDelay` is for. `mockDelay` has to be
// longer than `pageLoadingDelay`, but not too long so the test takes
// longer than it has to, and also not too long so the entire test times
// out.

// Had to increase this to make the test pass on Windows
mockDelay = 500
mockDelay = 700

// <TestRouter> sets pageLoadingDelay={200}. (Default is 1000.)
const screen = render(<TestRouter />)

act(() => navigate('/page-loading-context'))

// 'Page Loading Context Layout' should always be shown
await waitFor(() => screen.getByText('Page Loading Context Layout'))

// 'loading in layout...' should only be shown while the page is loading.
// So in this case, for the first 700ms
await waitFor(() => screen.getByText('loading in layout...'))

// After 700ms 'Page Loading Context Page' should be rendered
await waitFor(() => screen.getByText('Page Loading Context Page'))

// This shouldn't show up, because the page shouldn't render before it's
Expand Down

0 comments on commit c1bd6ff

Please sign in to comment.