From 3d28201986165c5262f0ae57119db34bd19037fb Mon Sep 17 00:00:00 2001 From: Nicholas Cunningham Date: Fri, 25 Oct 2024 13:40:59 -0600 Subject: [PATCH] feat(vue): Update generators to format without prettier feat(node): Update generators to format without prettier --- .../component/files/__fileName__.__style__ | 6 +- .../__snapshots__/library.spec.ts.snap | 4 ++ .../ngrx-feature-store.spec.ts.snap | 2 + .../files/app/app.controller.spec.ts__tmpl__ | 1 - .../files/app/app.controller.ts__tmpl__ | 1 - .../files/app/app.module.ts__tmpl__ | 1 - .../files/app/app.service.spec.ts__tmpl__ | 1 - .../application/files/main.ts__tmpl__ | 1 - .../application/application.spec.ts | 4 +- .../application/lib/add-linting.spec.ts | 6 +- .../files/common/webpack.config.js__tmpl__ | 6 +- .../common/src/support/test-setup.ts__tmpl__ | 1 - .../__snapshots__/application.spec.ts.snap | 32 ++++------ .../files/base/nuxt.config.ts__tmpl__ | 4 +- .../__snapshots__/application.spec.ts.snap | 61 ++++++------------- .../src/app/__fileName__.tsx__tmpl__ | 1 + .../component-story.spec.ts.snap | 30 --------- .../files/__fileName__.cy__ext__ | 10 +-- .../__snapshots__/host.webpack.spec.ts.snap | 31 +++++----- .../__snapshots__/remote.rspack.spec.ts.snap | 29 ++++----- .../__snapshots__/remote.webpack.spec.ts.snap | 29 ++++----- .../__snapshots__/stories.app.spec.ts.snap | 2 - .../__snapshots__/stories.lib.spec.ts.snap | 2 - .../__snapshots__/configuration.spec.ts.snap | 2 - .../__snapshots__/application.spec.ts.snap | 4 -- .../files/common/src/app/App.spec.ts.template | 10 +-- .../files/common/src/app/App.vue.template | 30 ++++----- .../files/common/src/main.ts.template | 13 ++-- .../__snapshots__/library.spec.ts.snap | 8 ++- 29 files changed, 131 insertions(+), 201 deletions(-) diff --git a/packages/angular/src/generators/component/files/__fileName__.__style__ b/packages/angular/src/generators/component/files/__fileName__.__style__ index 183b2f33b6948..5acacb500a84a 100644 --- a/packages/angular/src/generators/component/files/__fileName__.__style__ +++ b/packages/angular/src/generators/component/files/__fileName__.__style__ @@ -1,6 +1,6 @@ -<%_ if(displayBlock){ if(style != 'sass') { _%>:host { +<% if(displayBlock){ if(style != 'sass') { %>:host { display: block; } -<%_ } else { _%>\:host +<% } else { %>\:host display: block -<%_ }} _%> +<% }} %> diff --git a/packages/angular/src/generators/library/__snapshots__/library.spec.ts.snap b/packages/angular/src/generators/library/__snapshots__/library.spec.ts.snap index be687ddcaddc3..01c4bab972e04 100644 --- a/packages/angular/src/generators/library/__snapshots__/library.spec.ts.snap +++ b/packages/angular/src/generators/library/__snapshots__/library.spec.ts.snap @@ -44,6 +44,7 @@ describe('MyLibComponent', () => { exports[`lib --standalone should generate a library with a standalone component and have it flat with routing setup 1`] = ` "export * from './lib/lib.routes'; + export * from './lib/my-lib.component';" `; @@ -219,6 +220,7 @@ describe('MyLibComponent', () => { exports[`lib --standalone should generate a library with a standalone component as entry point with routing setup 1`] = ` "export * from './lib/lib.routes'; + export * from './lib/my-lib/my-lib.component';" `; @@ -274,6 +276,7 @@ describe('MyLibComponent', () => { exports[`lib --standalone should generate a library with a standalone component as entry point with routing setup and attach it to parent module as a lazy child 1`] = ` "export * from './lib/lib.routes'; + export * from './lib/my-lib/my-lib.component';" `; @@ -297,6 +300,7 @@ export const appRoutes: Route[] = [ exports[`lib --standalone should generate a library with a standalone component as entry point with routing setup and attach it to parent module as direct child 1`] = ` "export * from './lib/lib.routes'; + export * from './lib/my-lib/my-lib.component';" `; diff --git a/packages/angular/src/generators/ngrx-feature-store/__snapshots__/ngrx-feature-store.spec.ts.snap b/packages/angular/src/generators/ngrx-feature-store/__snapshots__/ngrx-feature-store.spec.ts.snap index 34f54cb59b45d..29a35dc18c26f 100644 --- a/packages/angular/src/generators/ngrx-feature-store/__snapshots__/ngrx-feature-store.spec.ts.snap +++ b/packages/angular/src/generators/ngrx-feature-store/__snapshots__/ngrx-feature-store.spec.ts.snap @@ -1108,6 +1108,7 @@ export * from './lib/+state/users.selectors'; export * from './lib/+state/users.reducer'; export * from './lib/+state/users.actions'; export * from './lib/lib.routes'; + export * from './lib/feature/feature.component';" `; @@ -1124,5 +1125,6 @@ export * from './lib/+state/users.models'; export { UsersActions, UsersFeature, UsersSelectors }; export * from './lib/lib.routes'; + export * from './lib/feature/feature.component';" `; diff --git a/packages/nest/src/generators/application/files/app/app.controller.spec.ts__tmpl__ b/packages/nest/src/generators/application/files/app/app.controller.spec.ts__tmpl__ index 47879864a9773..dfd987f75efdf 100644 --- a/packages/nest/src/generators/application/files/app/app.controller.spec.ts__tmpl__ +++ b/packages/nest/src/generators/application/files/app/app.controller.spec.ts__tmpl__ @@ -1,5 +1,4 @@ import { Test, TestingModule } from '@nestjs/testing'; - import { AppController } from './app.controller'; import { AppService } from './app.service'; diff --git a/packages/nest/src/generators/application/files/app/app.controller.ts__tmpl__ b/packages/nest/src/generators/application/files/app/app.controller.ts__tmpl__ index dff210a841eb3..aa4a3dd680324 100644 --- a/packages/nest/src/generators/application/files/app/app.controller.ts__tmpl__ +++ b/packages/nest/src/generators/application/files/app/app.controller.ts__tmpl__ @@ -1,5 +1,4 @@ import { Controller, Get } from '@nestjs/common'; - import { AppService } from './app.service'; @Controller() diff --git a/packages/nest/src/generators/application/files/app/app.module.ts__tmpl__ b/packages/nest/src/generators/application/files/app/app.module.ts__tmpl__ index 6a9bc166d3509..86628031ca2a1 100644 --- a/packages/nest/src/generators/application/files/app/app.module.ts__tmpl__ +++ b/packages/nest/src/generators/application/files/app/app.module.ts__tmpl__ @@ -1,5 +1,4 @@ import { Module } from '@nestjs/common'; - import { AppController } from './app.controller'; import { AppService } from './app.service'; diff --git a/packages/nest/src/generators/application/files/app/app.service.spec.ts__tmpl__ b/packages/nest/src/generators/application/files/app/app.service.spec.ts__tmpl__ index 986bbb40c61a5..709b42135c709 100644 --- a/packages/nest/src/generators/application/files/app/app.service.spec.ts__tmpl__ +++ b/packages/nest/src/generators/application/files/app/app.service.spec.ts__tmpl__ @@ -1,5 +1,4 @@ import { Test } from '@nestjs/testing'; - import { AppService } from './app.service'; describe('AppService', () => { diff --git a/packages/nest/src/generators/application/files/main.ts__tmpl__ b/packages/nest/src/generators/application/files/main.ts__tmpl__ index 3f86b8fa31530..bf88f16703882 100644 --- a/packages/nest/src/generators/application/files/main.ts__tmpl__ +++ b/packages/nest/src/generators/application/files/main.ts__tmpl__ @@ -5,7 +5,6 @@ import { Logger } from '@nestjs/common'; import { NestFactory } from '@nestjs/core'; - import { AppModule } from './app/app.module'; async function bootstrap() { diff --git a/packages/next/src/generators/application/application.spec.ts b/packages/next/src/generators/application/application.spec.ts index efd890f613c52..7299fa3ae4312 100644 --- a/packages/next/src/generators/application/application.spec.ts +++ b/packages/next/src/generators/application/application.spec.ts @@ -604,7 +604,9 @@ describe('app', () => { ...baseConfig, ...nx.configs['flat/react-typescript'], - { ignores: ['.next/**/*'] }, + { + ignores: ['.next/**/*'], + }, ]; " `); diff --git a/packages/next/src/generators/application/lib/add-linting.spec.ts b/packages/next/src/generators/application/lib/add-linting.spec.ts index cba4e0f3d2099..37782d4096eaa 100644 --- a/packages/next/src/generators/application/lib/add-linting.spec.ts +++ b/packages/next/src/generators/application/lib/add-linting.spec.ts @@ -117,7 +117,11 @@ describe('updateEslint', () => { ...baseConfig, ...nx.configs["flat/react-typescript"], - { ignores: [".next/**/*"] } + { + ignores: [ + ".next/**/*" + ] + } ]; " `); diff --git a/packages/node/src/generators/application/files/common/webpack.config.js__tmpl__ b/packages/node/src/generators/application/files/common/webpack.config.js__tmpl__ index 052c7a86d19ee..77ab0d9c0528e 100644 --- a/packages/node/src/generators/application/files/common/webpack.config.js__tmpl__ +++ b/packages/node/src/generators/application/files/common/webpack.config.js__tmpl__ @@ -1,4 +1,4 @@ -<% if (webpackPluginOptions) { %> +<%_ if (webpackPluginOptions) { _%> const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin'); const { join } = require('path'); @@ -19,7 +19,7 @@ module.exports = { }) ], }; -<% } else { %> +<%_ } else { _%> const { composePlugins, withNx} = require('@nx/webpack'); // Nx plugins for webpack. @@ -33,4 +33,4 @@ module.exports = composePlugins( return config; } ); -<% } %> +<%_ } _%> diff --git a/packages/node/src/generators/e2e-project/files/server/common/src/support/test-setup.ts__tmpl__ b/packages/node/src/generators/e2e-project/files/server/common/src/support/test-setup.ts__tmpl__ index 79ff96994111f..7336dc61f291b 100644 --- a/packages/node/src/generators/e2e-project/files/server/common/src/support/test-setup.ts__tmpl__ +++ b/packages/node/src/generators/e2e-project/files/server/common/src/support/test-setup.ts__tmpl__ @@ -1,5 +1,4 @@ /* eslint-disable */ - import axios from 'axios'; module.exports = async function() { diff --git a/packages/nuxt/src/generators/application/__snapshots__/application.spec.ts.snap b/packages/nuxt/src/generators/application/__snapshots__/application.spec.ts.snap index 7b5070c264ac4..37adbf4cdd6a1 100644 --- a/packages/nuxt/src/generators/application/__snapshots__/application.spec.ts.snap +++ b/packages/nuxt/src/generators/application/__snapshots__/application.spec.ts.snap @@ -53,10 +53,14 @@ module.exports = [ { files: ['**/*.vue'], languageOptions: { - parserOptions: { parser: require('@typescript-eslint/parser') }, + parserOptions: { + parser: require('@typescript-eslint/parser'), + }, }, }, - { ignores: ['.nuxt/**', '.output/**', 'node_modules'] }, + { + ignores: ['.nuxt/**', '.output/**', 'node_modules'], + }, ]; " `; @@ -83,7 +87,6 @@ export default defineNuxtConfig({ imports: { autoImport: true, }, - vite: { plugins: [nxViteTsPaths()], }, @@ -259,9 +262,7 @@ export default defineNuxtConfig({ imports: { autoImport: true, }, - css: ['~/assets/css/styles.css'], - vite: { plugins: [nxViteTsPaths()], }, @@ -291,9 +292,7 @@ export default defineNuxtConfig({ imports: { autoImport: true, }, - css: ['~/assets/css/styles.less'], - vite: { plugins: [nxViteTsPaths()], }, @@ -323,9 +322,7 @@ export default defineNuxtConfig({ imports: { autoImport: true, }, - css: ['~/assets/css/styles.scss'], - vite: { plugins: [nxViteTsPaths()], }, @@ -355,7 +352,6 @@ export default defineNuxtConfig({ imports: { autoImport: true, }, - vite: { plugins: [nxViteTsPaths()], }, @@ -416,10 +412,14 @@ module.exports = [ { files: ['**/*.vue'], languageOptions: { - parserOptions: { parser: require('@typescript-eslint/parser') }, + parserOptions: { + parser: require('@typescript-eslint/parser'), + }, }, }, - { ignores: ['.nuxt/**', '.output/**', 'node_modules'] }, + { + ignores: ['.nuxt/**', '.output/**', 'node_modules'], + }, ]; " `; @@ -446,7 +446,6 @@ export default defineNuxtConfig({ imports: { autoImport: true, }, - vite: { plugins: [nxViteTsPaths()], }, @@ -622,9 +621,7 @@ export default defineNuxtConfig({ imports: { autoImport: true, }, - css: ['~/assets/css/styles.css'], - vite: { plugins: [nxViteTsPaths()], }, @@ -654,9 +651,7 @@ export default defineNuxtConfig({ imports: { autoImport: true, }, - css: ['~/assets/css/styles.less'], - vite: { plugins: [nxViteTsPaths()], }, @@ -686,9 +681,7 @@ export default defineNuxtConfig({ imports: { autoImport: true, }, - css: ['~/assets/css/styles.scss'], - vite: { plugins: [nxViteTsPaths()], }, @@ -718,7 +711,6 @@ export default defineNuxtConfig({ imports: { autoImport: true, }, - vite: { plugins: [nxViteTsPaths()], }, diff --git a/packages/nuxt/src/generators/application/files/base/nuxt.config.ts__tmpl__ b/packages/nuxt/src/generators/application/files/base/nuxt.config.ts__tmpl__ index eddfddcde0ee4..9e692b83a7100 100644 --- a/packages/nuxt/src/generators/application/files/base/nuxt.config.ts__tmpl__ +++ b/packages/nuxt/src/generators/application/files/base/nuxt.config.ts__tmpl__ @@ -19,9 +19,9 @@ export default defineNuxtConfig({ imports: { autoImport: true, }, - <% if (style !== 'none') { %> + <%_ if (style !== 'none') { _%> css: ['~/assets/css/styles.<%= style %>'], - <% } %> + <%_ } _%> vite: { plugins: [ nxViteTsPaths() diff --git a/packages/react/src/generators/application/__snapshots__/application.spec.ts.snap b/packages/react/src/generators/application/__snapshots__/application.spec.ts.snap index 2c1e65d18cc1b..5db5b21c60fbf 100644 --- a/packages/react/src/generators/application/__snapshots__/application.spec.ts.snap +++ b/packages/react/src/generators/application/__snapshots__/application.spec.ts.snap @@ -1,27 +1,20 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`app --minimal should create default application without Nx welcome component 1`] = ` -" -// eslint-disable-next-line @typescript-eslint/no-unused-vars +"// eslint-disable-next-line @typescript-eslint/no-unused-vars import styles from './app.module.css'; - - export function App() { - return (
-

Hello there, Welcome plain 👋

- -
); - + + ); } - export default App; @@ -36,16 +29,15 @@ if (import.meta.vitest) { render = (await import('@testing-library/react')).render; }); - -it('should render successfully', () => { - const { baseElement } = render(); - expect(baseElement).toBeTruthy(); -}); + it('should render successfully', () => { + const { baseElement } = render(); + expect(baseElement).toBeTruthy(); + }); -it('should have a greeting as the title', () => { - const { getByText } = render(); - expect(getByText(/Welcome plain/gi)).toBeTruthy(); -}); + it('should have a greeting as the title', () => { + const { getByText } = render(); + expect(getByText(/Welcome plain/gi)).toBeTruthy(); + }); } @@ -53,8 +45,7 @@ it('should have a greeting as the title', () => { `; exports[`app --style @emotion/styled should exclude styles 1`] = ` -" -const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin'); +"const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin'); const { NxReactWebpackPlugin } = require('@nx/react/webpack-plugin'); const { join } = require('path'); @@ -89,7 +80,6 @@ module.exports = { }), ], }; - " `; @@ -129,8 +119,7 @@ export default defineConfig({ `; exports[`app --style none should exclude styles 1`] = ` -" -const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin'); +"const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin'); const { NxReactWebpackPlugin } = require('@nx/react/webpack-plugin'); const { join } = require('path'); @@ -165,7 +154,6 @@ module.exports = { }), ], }; - " `; @@ -253,7 +241,6 @@ export default defineConfig({ exports[`app not nested should generate files 1`] = ` "// eslint-disable-next-line @typescript-eslint/no-unused-vars import styles from './app.module.css'; - import NxWelcome from './nx-welcome'; export function App() { @@ -317,8 +304,7 @@ export default defineConfig({ exports[`app setup React app with --bundler=vite should setup targets with vite configuration 1`] = `null`; exports[`app should add custom webpack config 1`] = ` -" -const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin'); +"const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin'); const { NxReactWebpackPlugin } = require('@nx/react/webpack-plugin'); const { join } = require('path'); @@ -353,31 +339,22 @@ module.exports = { }), ], }; - " `; exports[`app should create Nx specific template 1`] = ` -" -// eslint-disable-next-line @typescript-eslint/no-unused-vars +"// eslint-disable-next-line @typescript-eslint/no-unused-vars import styles from './app.module.css'; - import NxWelcome from "./nx-welcome"; - - export function App() { - return (
- - -
); - + + ); } - export default App; @@ -420,8 +397,7 @@ export default defineConfig({ `; exports[`app should setup webpack 1`] = ` -" -const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin'); +"const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin'); const { NxReactWebpackPlugin } = require('@nx/react/webpack-plugin'); const { join } = require('path'); @@ -456,6 +432,5 @@ module.exports = { }), ], }; - " `; diff --git a/packages/react/src/generators/application/files/style-styled-jsx/src/app/__fileName__.tsx__tmpl__ b/packages/react/src/generators/application/files/style-styled-jsx/src/app/__fileName__.tsx__tmpl__ index 716b07ef7de8a..856df8f5badf0 100644 --- a/packages/react/src/generators/application/files/style-styled-jsx/src/app/__fileName__.tsx__tmpl__ +++ b/packages/react/src/generators/application/files/style-styled-jsx/src/app/__fileName__.tsx__tmpl__ @@ -27,6 +27,7 @@ export class App extends Component { export function App() { return (
+ <%_ if (!minimal) { _%> <%_ } else { _%> diff --git a/packages/react/src/generators/component-story/__snapshots__/component-story.spec.ts.snap b/packages/react/src/generators/component-story/__snapshots__/component-story.spec.ts.snap index 55b29dd23cf7e..aa03506592e3c 100644 --- a/packages/react/src/generators/component-story/__snapshots__/component-story.spec.ts.snap +++ b/packages/react/src/generators/component-story/__snapshots__/component-story.spec.ts.snap @@ -3,7 +3,6 @@ exports[`react:component-story default setup Other types of component definitions Component files with DEFAULT export React component defined as: PureComponent class & then default export new JSX transform should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -37,7 +36,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with DEFAULT export React component defined as: PureComponent class & then default export should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -71,7 +69,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with DEFAULT export React component defined as: arrow function should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -105,7 +102,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with DEFAULT export React component defined as: arrow function without {..} should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -139,7 +135,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with DEFAULT export React component defined as: component class & then default export new JSX transform should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -173,7 +168,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with DEFAULT export React component defined as: component class & then default export should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -207,7 +201,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with DEFAULT export React component defined as: default export function should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -241,7 +234,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with DEFAULT export React component defined as: direct export of component class new JSX transform should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -275,7 +267,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with DEFAULT export React component defined as: direct export of component class should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -309,7 +300,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with DEFAULT export React component defined as: function and then export should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -343,7 +333,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with NO DEFAULT export React component defined as: no default PureComponent class & then default export new JSX transform should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -377,7 +366,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with NO DEFAULT export React component defined as: no default PureComponent class & then default export should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -411,7 +399,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with NO DEFAULT export React component defined as: no default arrow function should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -445,7 +432,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with NO DEFAULT export React component defined as: no default arrow function without {..} should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -479,7 +465,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with NO DEFAULT export React component defined as: no default component class should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -513,7 +498,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with NO DEFAULT export React component defined as: no default direct export of component class new JSX transform should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -547,7 +531,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with NO DEFAULT export React component defined as: no default direct export of component class should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -581,7 +564,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with NO DEFAULT export React component defined as: no default simple export function should properly setup the controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -615,7 +597,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with NO DEFAULT export should create stories for all components in a file with no default export 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { One } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -643,7 +624,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with NO DEFAULT export should create stories for all components in a file with no default export 2`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Two } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -671,7 +651,6 @@ export const Heading: Story = { exports[`react:component-story default setup Other types of component definitions Component files with NO DEFAULT export should create stories for all components in a file with no default export 3`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Three } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -703,7 +682,6 @@ export const Heading: Story = { exports[`react:component-story default setup component with props and actions should setup controls based on the component props 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -742,7 +720,6 @@ export const Heading: Story = { exports[`react:component-story default setup component with props should setup controls based on the component destructured props defined in an inline literal type 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -776,7 +753,6 @@ export const Heading: Story = { exports[`react:component-story default setup component with props should setup controls based on the component destructured props without type 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -810,7 +786,6 @@ export const Heading: Story = { exports[`react:component-story default setup component with props should setup controls based on the component props defined in a literal type 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -844,7 +819,6 @@ export const Heading: Story = { exports[`react:component-story default setup component with props should setup controls based on the component props defined in an inline literal type 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -878,7 +852,6 @@ export const Heading: Story = { exports[`react:component-story default setup component with props should setup controls based on the component props defined in an interface 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -912,7 +885,6 @@ export const Heading: Story = { exports[`react:component-story default setup component without any props defined should create a story without controls 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -940,7 +912,6 @@ export const Heading: Story = { exports[`react:component-story default setup default component setup should properly set up the story 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { TestUiLib } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -967,7 +938,6 @@ export const Heading: Story = { exports[`react:component-story default setup when using plain JS components should properly set up the story 1`] = ` "import componentName from './test-ui-libplain'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; diff --git a/packages/react/src/generators/component-test/files/__fileName__.cy__ext__ b/packages/react/src/generators/component-test/files/__fileName__.cy__ext__ index 5a1456d865891..0a4a9b820e86a 100644 --- a/packages/react/src/generators/component-test/files/__fileName__.cy__ext__ +++ b/packages/react/src/generators/component-test/files/__fileName__.cy__ext__ @@ -1,8 +1,8 @@ import * as React from 'react' <%- importStatement %> -<%_ for (let cmp of components) { _%> -describe(<%= cmp.name %>.name, () => {<%_ if (cmp.props.length > 0) { _%> +<% for (let cmp of components) { %> +describe(<%= cmp.name %>.name, () => {<% if (cmp.props.length > 0) { %> let props: <% if (cmp.typeName) { %><%= cmp.typeName %><% } else if (cmp.inlineTypeString) { %><%- cmp.inlineTypeString %><% } else { %>unknown<% } %>; beforeEach(() => { @@ -13,9 +13,9 @@ describe(<%= cmp.name %>.name, () => {<%_ if (cmp.props.length > 0) { _%> it('renders', () => { cy.mount(<<%= cmp.name %> {...props}/>) - })<%_ } else { _%> + })<% } else { %> it('renders', () => { cy.mount(<<%= cmp.name %> />) - })<%_ } _%> + })<% } %> }) -<%_ } _%> +<% } %> diff --git a/packages/react/src/generators/host/__snapshots__/host.webpack.spec.ts.snap b/packages/react/src/generators/host/__snapshots__/host.webpack.spec.ts.snap index e2c2ed26f8de3..fd1ec7d006fb7 100644 --- a/packages/react/src/generators/host/__snapshots__/host.webpack.spec.ts.snap +++ b/packages/react/src/generators/host/__snapshots__/host.webpack.spec.ts.snap @@ -139,7 +139,7 @@ import {withModuleFederation} from '@nx/react/module-federation'; import baseConfig from './module-federation.config'; const config: ModuleFederationConfig = { - ...baseConfig, + ...baseConfig, }; // Nx plugins for webpack to build config object from Nx options and context. @@ -156,21 +156,20 @@ exports[`hostGenerator bundler=webpack should generate host files and configs wh "import { ModuleFederationConfig } from '@nx/webpack'; const config: ModuleFederationConfig = { - name: 'test', - /** - * To use a remote that does not exist in your current Nx Workspace - * You can use the tuple-syntax to define your remote - * - * remotes: [['my-external-remote', 'https://nx-angular-remote.netlify.app']] - * - * You _may_ need to add a \`remotes.d.ts\` file to your \`src/\` folder declaring the external remote for tsc, with the - * following content: - * - * declare module 'my-external-remote'; - * - */ - remotes: [ - + name: 'test', + /** + * To use a remote that does not exist in your current Nx Workspace + * You can use the tuple-syntax to define your remote + * + * remotes: [['my-external-remote', 'https://nx-angular-remote.netlify.app']] + * + * You _may_ need to add a \`remotes.d.ts\` file to your \`src/\` folder declaring the external remote for tsc, with the + * following content: + * + * declare module 'my-external-remote'; + * + */ + remotes: [ ], }; diff --git a/packages/react/src/generators/remote/__snapshots__/remote.rspack.spec.ts.snap b/packages/react/src/generators/remote/__snapshots__/remote.rspack.spec.ts.snap index 8982659954a23..cb83553beb289 100644 --- a/packages/react/src/generators/remote/__snapshots__/remote.rspack.spec.ts.snap +++ b/packages/react/src/generators/remote/__snapshots__/remote.rspack.spec.ts.snap @@ -27,11 +27,10 @@ exports[`remote generator bundler=rspack should create the remote with the corre * Nx requires a default export of the config to allow correct resolution of the module federation graph. **/ module.exports = { - name: 'test', - - exposes: { - './Module': './src/remote-entry.ts', - }, + name: 'test', + exposes: { + './Module': './src/remote-entry.ts', + }, }; " `; @@ -63,11 +62,10 @@ exports[`remote generator bundler=rspack should create the remote with the corre * Nx requires a default export of the config to allow correct resolution of the module federation graph. **/ module.exports = { - name: 'test', - - exposes: { - './Module': './src/remote-entry.js', - }, + name: 'test', + exposes: { + './Module': './src/remote-entry.js', + }, }; " `; @@ -106,7 +104,6 @@ exports[`remote generator bundler=rspack should create the remote with the corre const config: ModuleFederationConfig = { name: 'test', - exposes: { './Module': './src/remote-entry.ts', }, @@ -126,7 +123,7 @@ const {withModuleFederationForSSR} = require('@nx/rspack/module-federation'); const baseConfig = require("./module-federation.server.config"); const defaultConfig = { - ...baseConfig, + ...baseConfig, }; // Nx plugins for rspack to build config object from Nx options and context. @@ -144,10 +141,10 @@ exports[`remote generator bundler=rspack should generate correct remote with con * Nx requires a default export of the config to allow correct resolution of the module federation graph. **/ module.exports = { - name: 'test', - exposes: { - './Module': './src/remote-entry.ts', - }, + name: 'test', + exposes: { + './Module': './src/remote-entry.ts', + }, }; " `; diff --git a/packages/react/src/generators/remote/__snapshots__/remote.webpack.spec.ts.snap b/packages/react/src/generators/remote/__snapshots__/remote.webpack.spec.ts.snap index 1f59c12295219..3f8c0446282d5 100644 --- a/packages/react/src/generators/remote/__snapshots__/remote.webpack.spec.ts.snap +++ b/packages/react/src/generators/remote/__snapshots__/remote.webpack.spec.ts.snap @@ -28,11 +28,10 @@ exports[`remote generator bundler=webpack should create the remote with the corr * Nx requires a default export of the config to allow correct resolution of the module federation graph. **/ module.exports = { - name: 'test', - - exposes: { - './Module': './src/remote-entry.ts', - }, + name: 'test', + exposes: { + './Module': './src/remote-entry.ts', + }, }; " `; @@ -65,11 +64,10 @@ exports[`remote generator bundler=webpack should create the remote with the corr * Nx requires a default export of the config to allow correct resolution of the module federation graph. **/ module.exports = { - name: 'test', - - exposes: { - './Module': './src/remote-entry.js', - }, + name: 'test', + exposes: { + './Module': './src/remote-entry.js', + }, }; " `; @@ -109,7 +107,6 @@ exports[`remote generator bundler=webpack should create the remote with the corr const config: ModuleFederationConfig = { name: 'test', - exposes: { './Module': './src/remote-entry.ts', }, @@ -130,7 +127,7 @@ const {withModuleFederationForSSR} = require('@nx/react/module-federation'); const baseConfig = require("./module-federation.server.config"); const defaultConfig = { - ...baseConfig, + ...baseConfig, }; // Nx plugins for webpack to build config object from Nx options and context. @@ -148,10 +145,10 @@ exports[`remote generator bundler=webpack should generate correct remote with co * Nx requires a default export of the config to allow correct resolution of the module federation graph. **/ module.exports = { - name: 'test', - exposes: { - './Module': 'test/src/remote-entry.ts', - }, + name: 'test', + exposes: { + './Module': 'test/src/remote-entry.ts', + }, }; " `; diff --git a/packages/react/src/generators/stories/__snapshots__/stories.app.spec.ts.snap b/packages/react/src/generators/stories/__snapshots__/stories.app.spec.ts.snap index 61f2da04d5eff..06ba42f218602 100644 --- a/packages/react/src/generators/stories/__snapshots__/stories.app.spec.ts.snap +++ b/packages/react/src/generators/stories/__snapshots__/stories.app.spec.ts.snap @@ -3,7 +3,6 @@ exports[`react:stories for applications should create the stories with interaction tests 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { NxWelcome } from './nx-welcome'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -35,7 +34,6 @@ export const Heading: Story = { exports[`react:stories for applications should create the stories with interaction tests 2`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './another-cmp'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; diff --git a/packages/react/src/generators/stories/__snapshots__/stories.lib.spec.ts.snap b/packages/react/src/generators/stories/__snapshots__/stories.lib.spec.ts.snap index 4606673a016f0..dac210a67a66f 100644 --- a/packages/react/src/generators/stories/__snapshots__/stories.lib.spec.ts.snap +++ b/packages/react/src/generators/stories/__snapshots__/stories.lib.spec.ts.snap @@ -3,7 +3,6 @@ exports[`react:stories for libraries should create the stories with interaction tests 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { TestUiLib } from './test-ui-lib'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -31,7 +30,6 @@ export const Heading: Story = { exports[`react:stories for libraries should create the stories with interaction tests 2`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { Test } from './another-cmp'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; diff --git a/packages/react/src/generators/storybook-configuration/__snapshots__/configuration.spec.ts.snap b/packages/react/src/generators/storybook-configuration/__snapshots__/configuration.spec.ts.snap index 8ad33db95233c..baa4f5a82200d 100644 --- a/packages/react/src/generators/storybook-configuration/__snapshots__/configuration.spec.ts.snap +++ b/packages/react/src/generators/storybook-configuration/__snapshots__/configuration.spec.ts.snap @@ -32,7 +32,6 @@ export default config; exports[`react:storybook-configuration should generate stories for components 1`] = ` "import type { Meta, StoryObj } from '@storybook/react'; import { MyComponent } from './my-component'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; @@ -59,7 +58,6 @@ export const Heading: Story = { exports[`react:storybook-configuration should generate stories for components written in plain JS 1`] = ` "import componentName from './test-ui-libplain'; - import { within } from '@storybook/testing-library'; import { expect } from '@storybook/jest'; diff --git a/packages/vue/src/generators/application/__snapshots__/application.spec.ts.snap b/packages/vue/src/generators/application/__snapshots__/application.spec.ts.snap index 65a1586fb0cc2..84f0aba45dcf7 100644 --- a/packages/vue/src/generators/application/__snapshots__/application.spec.ts.snap +++ b/packages/vue/src/generators/application/__snapshots__/application.spec.ts.snap @@ -109,14 +109,12 @@ exports[`application generator should set up project correctly for cypress 3`] = exports[`application generator should set up project correctly for cypress 4`] = ` "import { describe, it, expect } from 'vitest'; - import { mount } from '@vue/test-utils'; import App from './App.vue'; describe('App', () => { it('renders properly', async () => { const wrapper = mount(App, {}); - expect(wrapper.text()).toContain('Welcome test 👋'); }); }); @@ -255,14 +253,12 @@ exports[`application generator should set up project correctly with given option exports[`application generator should set up project correctly with given options 4`] = ` "import { describe, it, expect } from 'vitest'; - import { mount } from '@vue/test-utils'; import App from './App.vue'; describe('App', () => { it('renders properly', async () => { const wrapper = mount(App, {}); - expect(wrapper.text()).toContain('Welcome test 👋'); }); }); diff --git a/packages/vue/src/generators/application/files/common/src/app/App.spec.ts.template b/packages/vue/src/generators/application/files/common/src/app/App.spec.ts.template index e8b016b534175..7003bb5f8b920 100644 --- a/packages/vue/src/generators/application/files/common/src/app/App.spec.ts.template +++ b/packages/vue/src/generators/application/files/common/src/app/App.spec.ts.template @@ -1,17 +1,17 @@ -<% if ( unitTestRunner === 'vitest' ) { %> +<%_ if ( unitTestRunner === 'vitest' ) { _%> import { describe, it, expect } from 'vitest' -<% } %><% if( routing ) { %> +<%_ } _%><%_ if( routing ) { _%> import router from '../router'; -<% } %> +<%_ } _%> import { mount } from '@vue/test-utils' import App from './App.vue'; describe('App', () => { it('renders properly', async () => { const wrapper = mount(App, <% if( routing ) { %>{ global: { plugins: [router] }}<% } else { %>{}<% } %>) - <% if( routing ) { %> + <%_ if( routing ) { _%> await router.isReady(); - <% } %> + <%_ } _%> expect(wrapper.text()).toContain('Welcome <%= title %> 👋') }) }); diff --git a/packages/vue/src/generators/application/files/common/src/app/App.vue.template b/packages/vue/src/generators/application/files/common/src/app/App.vue.template index 17555be9b4fe5..4d153bcacd5cd 100644 --- a/packages/vue/src/generators/application/files/common/src/app/App.vue.template +++ b/packages/vue/src/generators/application/files/common/src/app/App.vue.template @@ -1,26 +1,26 @@ -<% if (routing && style !== 'none') { %> +<%_ if (routing && style !== 'none') { _%> -<% } %> +<%_ } _%> diff --git a/packages/vue/src/generators/application/files/common/src/main.ts.template b/packages/vue/src/generators/application/files/common/src/main.ts.template index fcb106d776dab..9792fee522063 100644 --- a/packages/vue/src/generators/application/files/common/src/main.ts.template +++ b/packages/vue/src/generators/application/files/common/src/main.ts.template @@ -1,15 +1,14 @@ -<% if (style !== 'none') { %> +<%_ if (style !== 'none') { _%> import './styles.<%= style %>'; -<% } %> -<% if (routing) { %> +<%_ } +if (routing) { _%> import router from './router'; -<% } %> - +<%_ } _%> import { createApp } from 'vue'; import App from './app/App.vue'; const app = createApp(App); -<% if (routing) { %> +<%_ if (routing) { _%> app.use(router); -<% } %> +<%_ } _%> app.mount('#root'); diff --git a/packages/vue/src/generators/library/__snapshots__/library.spec.ts.snap b/packages/vue/src/generators/library/__snapshots__/library.spec.ts.snap index 3f3e8176a12b5..26dcf279d616f 100644 --- a/packages/vue/src/generators/library/__snapshots__/library.spec.ts.snap +++ b/packages/vue/src/generators/library/__snapshots__/library.spec.ts.snap @@ -283,12 +283,16 @@ module.exports = [ { files: ['**/*.vue'], languageOptions: { - parserOptions: { parser: require('@typescript-eslint/parser') }, + parserOptions: { + parser: require('@typescript-eslint/parser'), + }, }, }, { files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx', '**/*.vue'], - rules: { 'vue/multi-word-component-names': 'off' }, + rules: { + 'vue/multi-word-component-names': 'off', + }, }, ]; "