diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 1b168dd1c239..ea1df83e17d1 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -2,9 +2,11 @@ name: Continuous Integration on: push: - branches: [master] + branches: + - master pull_request: - branches: [master] + branches: + - master schedule: - cron: '0 2 * * 1' # At 02:00 on Monday @@ -39,11 +41,9 @@ jobs: - name: Bootstrap project run: | npm ci --ignore-scripts - npm run postinstall + npx lerna bootstrap - name: Build project - run: | - npm run clean - npm run build + run: npm run build - uses: Yuri6037/Action-FakeTTY@v1.1 - name: Run tests run: faketty npm test --ignore-scripts @@ -94,9 +94,7 @@ jobs: - name: Bootstrap project run: | npm ci --ignore-scripts - npm run postinstall - - name: Build project - run: npm run build + npx lerna bootstrap - name: Verify code linting run: npm run lint - name: Verify package metadata @@ -131,7 +129,7 @@ jobs: - name: Bootstrap project run: | npm ci --ignore-scripts - npm run postinstall + npx lerna bootstrap - name: Build project run: npm run build - name: Verify doc changes diff --git a/extensions/socketio/src/socketio.server.ts b/extensions/socketio/src/socketio.server.ts index 1a5915ed92d2..6f4c668dfb24 100644 --- a/extensions/socketio/src/socketio.server.ts +++ b/extensions/socketio/src/socketio.server.ts @@ -152,9 +152,9 @@ export class SocketIoServer extends Context { this.app.bind(getNamespaceKeyForName(meta.name)).to(nsp); } - nsp.on('connection', socket => - this.createSocketHandler(controllerClass)(socket), - ); + nsp.on('connection', async socket => { + await this.createSocketHandler(controllerClass)(socket); + }); return nsp; } @@ -164,7 +164,7 @@ export class SocketIoServer extends Context { */ private createSocketHandler( controllerClass: Constructor, - ): (socket: Socket) => void { + ): (socket: Socket) => Promise { return async socket => { debug( 'SocketIo connected: id=%s namespace=%s', diff --git a/packages/booter-lb3app/src/__tests__/acceptance/booter-lb3app.acceptance.ts b/packages/booter-lb3app/src/__tests__/acceptance/booter-lb3app.acceptance.ts index 402418af143d..5410e4c96e18 100644 --- a/packages/booter-lb3app/src/__tests__/acceptance/booter-lb3app.acceptance.ts +++ b/packages/booter-lb3app/src/__tests__/acceptance/booter-lb3app.acceptance.ts @@ -52,7 +52,7 @@ describe('booter-lb3app', () => { }, }); - const schemas = (spec.components ?? {}).schemas ?? {}; + const schemas = spec.components?.schemas ?? {}; expect(schemas._new_CoffeeShop) .to.have.property('properties') .eql({ @@ -68,7 +68,7 @@ describe('booter-lb3app', () => { it('includes the target model as a property of the source model in a relation', async () => { const spec = await app.restServer.getApiSpec(); - const schemas = (spec.components ?? {}).schemas ?? {}; + const schemas = spec.components?.schemas ?? {}; expect(schemas.CoffeeShop) .to.have.property('properties') diff --git a/packages/eslint-config/eslintrc.js b/packages/eslint-config/eslintrc.js index 8df08e7a8188..d3768df3e1eb 100644 --- a/packages/eslint-config/eslintrc.js +++ b/packages/eslint-config/eslintrc.js @@ -3,7 +3,7 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT -const fs = require('fs'); +const fs = require('node:fs'); /** * Default ESLint configuration for LoopBack @@ -243,6 +243,12 @@ module.exports = { selector: 'typeLike', format: ['PascalCase'], }, + + { + selector: 'objectLiteralProperty', + format: null, + modifiers: ['requiresQuotes'], + }, ], }, diff --git a/packages/express/src/__tests__/acceptance/test-helpers.ts b/packages/express/src/__tests__/acceptance/test-helpers.ts index 54ba1fea9e60..a24b6b175bc0 100644 --- a/packages/express/src/__tests__/acceptance/test-helpers.ts +++ b/packages/express/src/__tests__/acceptance/test-helpers.ts @@ -62,6 +62,7 @@ export class TestHelper { } } const binding = this.app.controller(MyController); + const handler: ExpressRequestHandler = async (req, res, next) => { try { const controller = await this.app.get(binding.key); diff --git a/packages/monorepo/lib/config-lerna-scopes.js b/packages/monorepo/lib/config-lerna-scopes.js index dfc0ee5d1bd4..ee892fb2422f 100644 --- a/packages/monorepo/lib/config-lerna-scopes.js +++ b/packages/monorepo/lib/config-lerna-scopes.js @@ -14,7 +14,7 @@ const {getPackages, runMain} = require('./script-util'); module.exports = { rules: { - // https://github.com/marionebl/commitlint/blob/master/docs/reference-rules.md + // eslint-disable-next-line @typescript-eslint/naming-convention 'scope-enum': async ctx => [2, 'always', await getPackageNames(ctx)], }, }; diff --git a/packages/openapi-v3/src/__tests__/integration/controller-spec.integration.ts b/packages/openapi-v3/src/__tests__/integration/controller-spec.integration.ts index 6e5d602c9f93..0ccbab1eb664 100644 --- a/packages/openapi-v3/src/__tests__/integration/controller-spec.integration.ts +++ b/packages/openapi-v3/src/__tests__/integration/controller-spec.integration.ts @@ -313,7 +313,7 @@ describe('controller spec', () => { $ref: '#/components/schemas/Todo', }); - const globalSchemas = (spec.components ?? {}).schemas; + const globalSchemas = spec.components?.schemas; expect(globalSchemas).to.deepEqual({ Todo: { title: 'Todo', @@ -362,7 +362,7 @@ describe('controller spec', () => { $ref: '#/definitions/Todo', }); - const globalSchemas = (spec.components ?? {}).schemas; + const globalSchemas = spec.components?.schemas; expect(globalSchemas).to.deepEqual({ Todo: { title: 'Todo', @@ -462,7 +462,7 @@ describe('controller spec', () => { } const spec = getControllerSpec(MyController); - const globalSchemas = (spec.components ?? {}).schemas; + const globalSchemas = spec.components?.schemas; expect(globalSchemas).to.be.undefined(); }); @@ -533,7 +533,7 @@ describe('controller spec', () => { }, }); - const globalSchemas = (spec.components ?? {}).schemas; + const globalSchemas = spec.components?.schemas; expect(globalSchemas).to.deepEqual({ Todo: { title: 'Todo', @@ -593,7 +593,7 @@ describe('controller spec', () => { $ref: '#/components/schemas/Todo', }); - const globalSchemas = (spec.components ?? {}).schemas; + const globalSchemas = spec.components?.schemas; expect(globalSchemas).to.deepEqual({ Todo: { title: 'Todo', @@ -861,7 +861,7 @@ describe('controller spec', () => { $ref: '#/components/schemas/MyModel', }); - const globalSchemas = (spec.components ?? {}).schemas; + const globalSchemas = spec.components?.schemas; expect(globalSchemas).to.deepEqual({ MyModel: { title: 'MyModel', diff --git a/packages/rest-crud/src/crud-rest.controller.ts b/packages/rest-crud/src/crud-rest.controller.ts index d299af479506..5033347bb052 100644 --- a/packages/rest-crud/src/crud-rest.controller.ts +++ b/packages/rest-crud/src/crud-rest.controller.ts @@ -280,7 +280,7 @@ function getIdSchema( const modelSchema = jsonToSchemaObject( getJsonSchema(modelCtor), ) as SchemaObject; - return (modelSchema.properties ?? {})[idProp] as SchemaObject; + return modelSchema.properties?.[idProp] as SchemaObject; } // Temporary implementation of a short-hand version of `@requestBody`