From b39bae931163b61042a45b3ef2fa93e6a12c301b Mon Sep 17 00:00:00 2001 From: souvik Date: Mon, 23 Sep 2024 13:48:53 +0530 Subject: [PATCH] chore: lint fix --- src/commands/generate/fromTemplate.ts | 24 ++++++------- src/core/global.d.ts | 2 +- .../newtemplate/__transpiled/index.js | 12 +++---- .../newtemplate/hooks/generateAsyncapiFile.js | 34 +++++++++---------- .../integration/generate/fromTemplate.test.ts | 10 +++--- 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/commands/generate/fromTemplate.ts b/src/commands/generate/fromTemplate.ts index cc9fe2b79b7..90d0b731216 100644 --- a/src/commands/generate/fromTemplate.ts +++ b/src/commands/generate/fromTemplate.ts @@ -114,7 +114,7 @@ export default class Template extends Command { } } if (flags['use-new-generator']) { - await this.generateUsingNewGenerator(asyncapi, template, output, options, genOption, interactive) + await this.generateUsingNewGenerator(asyncapi, template, output, options, genOption, interactive); } else { await this.generate(asyncapi, template, output, options, genOption, interactive); } @@ -350,17 +350,17 @@ export default class Template extends Command { for (const [, value] of Object.entries(changedFiles)) { let eventText; switch (value.eventType) { - case 'changed': - eventText = green(value.eventType); - break; - case 'removed': - eventText = red(value.eventType); - break; - case 'renamed': - eventText = yellow(value.eventType); - break; - default: - eventText = yellow(value.eventType); + case 'changed': + eventText = green(value.eventType); + break; + case 'removed': + eventText = red(value.eventType); + break; + case 'renamed': + eventText = yellow(value.eventType); + break; + default: + eventText = yellow(value.eventType); } this.log(`\t${magenta(value.path)} was ${eventText}`); } diff --git a/src/core/global.d.ts b/src/core/global.d.ts index 2ba88dceae1..4ff078e0c17 100644 --- a/src/core/global.d.ts +++ b/src/core/global.d.ts @@ -4,4 +4,4 @@ declare module '@asyncapi/openapi-schema-parser'; declare module '@asyncapi/avro-schema-parser'; declare module '@asyncapi/raml-dt-schema-parser'; declare module '@asyncapi/protobuf-schema-parser'; -declare module 'generator-v2'; \ No newline at end of file +declare module 'generator-v2'; diff --git a/test/fixtures/newtemplate/__transpiled/index.js b/test/fixtures/newtemplate/__transpiled/index.js index 6c7c55973ae..10b64bf23fd 100644 --- a/test/fixtures/newtemplate/__transpiled/index.js +++ b/test/fixtures/newtemplate/__transpiled/index.js @@ -1,21 +1,21 @@ 'use strict'; require('source-map-support/register'); -var generatorReactSdk = require('@asyncapi/generator-react-sdk'); -var jsxRuntime = require('/mnt/c/Users/Souvik/Documents/Programs/asyncapi/forks/cli/node_modules/@asyncapi/generator-react-sdk/node_modules/react/cjs/react-jsx-runtime.production.min.js'); +const generatorReactSdk = require('@asyncapi/generator-react-sdk'); +const jsxRuntime = require('/mnt/c/Users/Souvik/Documents/Programs/asyncapi/forks/cli/node_modules/@asyncapi/generator-react-sdk/node_modules/react/cjs/react-jsx-runtime.production.min.js'); function index ({ asyncapi, params }) { return /*#__PURE__*/jsxRuntime.jsxs(generatorReactSdk.File, { - name: "asyncapi.md", + name: 'asyncapi.md', children: [/*#__PURE__*/jsxRuntime.jsx(generatorReactSdk.Text, { - children: "This is a markdown file for my application." + children: 'This is a markdown file for my application.' }), /*#__PURE__*/jsxRuntime.jsxs(generatorReactSdk.Text, { - children: ["App name is: **", asyncapi.info().title(), "**"] + children: ['App name is: **', asyncapi.info().title(), '**'] }), /*#__PURE__*/jsxRuntime.jsxs(generatorReactSdk.Text, { - children: ["Version ", params.version, " running on ", params.mode, " mode "] + children: ['Version ', params.version, ' running on ', params.mode, ' mode '] })] }); } diff --git a/test/fixtures/newtemplate/hooks/generateAsyncapiFile.js b/test/fixtures/newtemplate/hooks/generateAsyncapiFile.js index 49c777c92d5..e544a798c58 100644 --- a/test/fixtures/newtemplate/hooks/generateAsyncapiFile.js +++ b/test/fixtures/newtemplate/hooks/generateAsyncapiFile.js @@ -2,21 +2,21 @@ const fs = require('fs'); const path = require('path'); module.exports = { - 'generate:before': generator => { - const asyncapi = generator.originalAsyncAPI; - let extension; - try { - JSON.parse(asyncapi); - extension = 'json' - } catch (error) { - extension = 'yaml' - } - - fs.writeFileSync( - path.resolve( - generator.targetDir, `asyncapi.${extension}` - ) - , asyncapi, { encoding: 'utf-8' } - ); + 'generate:before': generator => { + const asyncapi = generator.originalAsyncAPI; + let extension; + try { + JSON.parse(asyncapi); + extension = 'json'; + } catch (error) { + extension = 'yaml'; } -} \ No newline at end of file + + fs.writeFileSync( + path.resolve( + generator.targetDir, `asyncapi.${extension}` + ) + , asyncapi, { encoding: 'utf-8' } + ); + } +}; diff --git a/test/integration/generate/fromTemplate.test.ts b/test/integration/generate/fromTemplate.test.ts index 1cf87af971a..dd3535d1696 100644 --- a/test/integration/generate/fromTemplate.test.ts +++ b/test/integration/generate/fromTemplate.test.ts @@ -63,11 +63,11 @@ describe('template', () => { '--use-new-generator', ]) .it('should be able to generate using newer version of generator', (ctx, done) => { - expect(ctx.stdout).to.contain('Check out your shiny new generated files at ./test/docs/2.\n\n') - cleanup('./test/docs/2') - done() - }) - }) + expect(ctx.stdout).to.contain('Check out your shiny new generated files at ./test/docs/2.\n\n'); + cleanup('./test/docs/2'); + done(); + }); + }); describe('git clash', () => { const pathToOutput = './test/docs/2';