From 6dcfb376883acaff66411c472fb032ac4127f9b4 Mon Sep 17 00:00:00 2001 From: Anselm Marie Date: Sun, 4 Aug 2024 12:45:30 -0400 Subject: [PATCH] =?UTF-8?q?fixing=20linting=20issues=20=E2=80=A2=20minor?= =?UTF-8?q?=20config=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .husky/pre-commit | 3 + .lintstagedrc.json | 20 + apps/mobile-app/metro.config.js | 2 +- apps/mobile-app/src/app/App.spec.tsx | 1 + apps/mobile-app/src/app/App.tsx | 252 +---- apps/web-app/src/homepage/homepage.spec.tsx | 1 - apps/web-app/src/main.tsx | 5 +- apps/web-design-system/.storybook/main.ts | 3 +- .../web-design-system/src/app/app.stories.tsx | 6 +- apps/web-design-system/src/app/app.tsx | 8 +- .../src/app/nx-welcome.stories.tsx | 24 - apps/web-design-system/src/app/nx-welcome.tsx | 886 ------------------ apps/web-design-system/src/main.tsx | 5 +- package-lock.json | 66 +- package.json | 16 +- 15 files changed, 128 insertions(+), 1170 deletions(-) create mode 100644 .lintstagedrc.json delete mode 100644 apps/web-design-system/src/app/nx-welcome.stories.tsx delete mode 100644 apps/web-design-system/src/app/nx-welcome.tsx diff --git a/.husky/pre-commit b/.husky/pre-commit index f318141..8938368 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + npx lint-staged --concurrent false --relative diff --git a/.lintstagedrc.json b/.lintstagedrc.json new file mode 100644 index 0000000..ccd13cb --- /dev/null +++ b/.lintstagedrc.json @@ -0,0 +1,20 @@ +{ + "./apps/**/*.ts(x)": [ + "prettier --write", + "eslint --fix" + ], + "./libs/**/*.ts(x)": [ + "prettier --write", + "eslint --fix" + ], + "./apps/**/*.html": [ + "eslint --fix", + "prettier --write" + ], + "./libs/**/*.html": [ + "eslint --fix", + "prettier --write" + ], + "./apps/**/*.css": ["prettier --write", "stylelint --write"], + "./libs/**/*.css": ["prettier --write", "stylelint --write"] +} \ No newline at end of file diff --git a/apps/mobile-app/metro.config.js b/apps/mobile-app/metro.config.js index f524143..3601549 100644 --- a/apps/mobile-app/metro.config.js +++ b/apps/mobile-app/metro.config.js @@ -1,5 +1,5 @@ -const { withNxMetro } = require('@nx/expo'); const { getDefaultConfig } = require('@expo/metro-config'); +const { withNxMetro } = require('@nx/expo'); const { mergeConfig } = require('metro-config'); const defaultConfig = getDefaultConfig(__dirname); diff --git a/apps/mobile-app/src/app/App.spec.tsx b/apps/mobile-app/src/app/App.spec.tsx index 485394b..b2cbcf7 100644 --- a/apps/mobile-app/src/app/App.spec.tsx +++ b/apps/mobile-app/src/app/App.spec.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; + import { render } from '@testing-library/react-native'; import App from './App'; diff --git a/apps/mobile-app/src/app/App.tsx b/apps/mobile-app/src/app/App.tsx index 5cea70f..de995df 100644 --- a/apps/mobile-app/src/app/App.tsx +++ b/apps/mobile-app/src/app/App.tsx @@ -1,5 +1,6 @@ /* eslint-disable jsx-a11y/accessible-emoji */ import React, { useRef, useState } from 'react'; + import { SafeAreaView, StyleSheet, @@ -33,11 +34,7 @@ export const App = () => { > Hello there, - + Welcome AppsMobileApp 👋 @@ -58,9 +55,7 @@ export const App = () => { d="M9 12l2 2 4-4M7.835 4.697a3.42 3.42 0 001.946-.806 3.42 3.42 0 014.438 0 3.42 3.42 0 001.946.806 3.42 3.42 0 013.138 3.138 3.42 3.42 0 00.806 1.946 3.42 3.42 0 010 4.438 3.42 3.42 0 00-.806 1.946 3.42 3.42 0 01-3.138 3.138 3.42 3.42 0 00-1.946.806 3.42 3.42 0 01-4.438 0 3.42 3.42 0 00-1.946-.806 3.42 3.42 0 01-3.138-3.138 3.42 3.42 0 00-.806-1.946 3.42 3.42 0 010-4.438 3.42 3.42 0 00.806-1.946 3.42 3.42 0 013.138-3.138z" /> - - You're up and running - + You're up and running { }); }} > - - What's next? - + What's next? - - Learning materials - + Learning materials - Linking.openURL( - 'https://nx.dev/getting-started/intro?utm_source=nx-project' - ) + Linking.openURL('https://nx.dev/getting-started/intro?utm_source=nx-project') } > - + { Documentation - - Everything is in there - + Everything is in there - + { - Linking.openURL('https://nx.dev/blog/?utm_source=nx-project') - } + onPress={() => Linking.openURL('https://nx.dev/blog/?utm_source=nx-project')} > - + { Changelog, features & events - + { Nx Show, talks & tutorials - + { ) } > - + { Create an app, step by step - + { - Linking.openURL( - 'https://nxplaybook.com/?utm_source=nx-project' - ) - } + onPress={() => Linking.openURL('https://nxplaybook.com/?utm_source=nx-project')} > - + { Video courses - - Nx custom courses - + Nx custom courses - + { } > - + - + Install Nx Console for VSCode @@ -326,9 +240,7 @@ export const App = () => { - Linking.openURL( - 'https://plugins.jetbrains.com/plugin/21060-nx-console' - ) + Linking.openURL('https://plugins.jetbrains.com/plugin/21060-nx-console') } > @@ -348,13 +260,7 @@ export const App = () => { - + Install Nx Console for JetBrains @@ -366,9 +272,7 @@ export const App = () => { - Linking.openURL('https://nx.app/?utm_source=nx-project') - } + onPress={() => Linking.openURL('https://nx.app/?utm_source=nx-project')} > @@ -389,13 +293,7 @@ export const App = () => { /> - + Nx Cloud @@ -411,27 +309,17 @@ export const App = () => { - Linking.openURL('https://nx.app/?utm_source=nx-project') - } + onPress={() => Linking.openURL('https://nx.app/?utm_source=nx-project')} > - + Nx is open source - - Love Nx? Give us a star! - + Love Nx? Give us a star! @@ -444,22 +332,12 @@ export const App = () => { }} > - - Next steps - - + Next steps + Here are some things you can do with Nx: - + { # Generate UI lib - + nx g @nx/expo:lib ui # Add a component nx g \ - - @nx/expo:component \ - - - ui/src/lib/button - + @nx/expo:component \ + ui/src/lib/button - + { - + { /> - - View interactive project graph - + View interactive project graph nx graph - + { # See what's affected by changes - + nx affected:graph # run tests for current changes - + nx affected:text # run e2e tests for current - - # changes - - - nx affected:e2e - + # changes + nx affected:e2e diff --git a/apps/web-app/src/homepage/homepage.spec.tsx b/apps/web-app/src/homepage/homepage.spec.tsx index 1272a67..5b48ee9 100644 --- a/apps/web-app/src/homepage/homepage.spec.tsx +++ b/apps/web-app/src/homepage/homepage.spec.tsx @@ -1,5 +1,4 @@ import { render } from '@testing-library/react'; - import { BrowserRouter } from 'react-router-dom'; import App from './homepage'; diff --git a/apps/web-app/src/main.tsx b/apps/web-app/src/main.tsx index 563fabf..5f14cd2 100644 --- a/apps/web-app/src/main.tsx +++ b/apps/web-app/src/main.tsx @@ -1,12 +1,11 @@ import { StrictMode } from 'react'; + import * as ReactDOM from 'react-dom/client'; import { BrowserRouter } from 'react-router-dom'; import App from './app/app'; -const root = ReactDOM.createRoot( - document.getElementById('root') as HTMLElement -); +const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement); root.render( diff --git a/apps/web-design-system/.storybook/main.ts b/apps/web-design-system/.storybook/main.ts index 6c05ca5..c2683a2 100644 --- a/apps/web-design-system/.storybook/main.ts +++ b/apps/web-design-system/.storybook/main.ts @@ -1,6 +1,5 @@ -import type { StorybookConfig } from '@storybook/react-vite'; - import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; +import type { StorybookConfig } from '@storybook/react-vite'; import { mergeConfig } from 'vite'; const config: StorybookConfig = { diff --git a/apps/web-design-system/src/app/app.stories.tsx b/apps/web-design-system/src/app/app.stories.tsx index ad04e3c..695672a 100644 --- a/apps/web-design-system/src/app/app.stories.tsx +++ b/apps/web-design-system/src/app/app.stories.tsx @@ -1,8 +1,8 @@ +import { expect } from '@storybook/jest'; import type { Meta, StoryObj } from '@storybook/react'; -import { App } from './app'; - import { within } from '@storybook/testing-library'; -import { expect } from '@storybook/jest'; + +import { App } from './app'; const meta: Meta = { component: App, diff --git a/apps/web-design-system/src/app/app.tsx b/apps/web-design-system/src/app/app.tsx index 89d6abf..8c3257f 100644 --- a/apps/web-design-system/src/app/app.tsx +++ b/apps/web-design-system/src/app/app.tsx @@ -1,14 +1,8 @@ // eslint-disable-next-line @typescript-eslint/no-unused-vars import styles from './app.module.css'; -import NxWelcome from './nx-welcome'; - export function App() { - return ( -
- -
- ); + return
Hi
; } export default App; diff --git a/apps/web-design-system/src/app/nx-welcome.stories.tsx b/apps/web-design-system/src/app/nx-welcome.stories.tsx deleted file mode 100644 index 19e5229..0000000 --- a/apps/web-design-system/src/app/nx-welcome.stories.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import type { Meta, StoryObj } from '@storybook/react'; -import { NxWelcome } from './nx-welcome'; - -import { within } from '@storybook/testing-library'; -import { expect } from '@storybook/jest'; - -const meta: Meta = { - component: NxWelcome, - title: 'NxWelcome', -}; -export default meta; -type Story = StoryObj; - -export const Primary = { - args: {}, -}; - -export const Heading: Story = { - args: {}, - play: async ({ canvasElement }) => { - const canvas = within(canvasElement); - expect(canvas.getByText(/Welcome to NxWelcome!/gi)).toBeTruthy(); - }, -}; diff --git a/apps/web-design-system/src/app/nx-welcome.tsx b/apps/web-design-system/src/app/nx-welcome.tsx deleted file mode 100644 index cae7663..0000000 --- a/apps/web-design-system/src/app/nx-welcome.tsx +++ /dev/null @@ -1,886 +0,0 @@ -/* - * * * * * * * * * * * * * * * * * * * * * * * * * * * * - This is a starter component and can be deleted. - * * * * * * * * * * * * * * * * * * * * * * * * * * * * - Delete this file and get started with your project! - * * * * * * * * * * * * * * * * * * * * * * * * * * * * - */ -export function NxWelcome({ title }: { title: string }) { - return ( - <> -