Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add import order sorting via prettier #1392

Merged
merged 26 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cli format
  • Loading branch information
FinnDore committed Apr 29, 2023
commit d8169926eb5e78720cfdb2e250fb4c2da5e75bd4
19 changes: 9 additions & 10 deletions cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
#!/usr/bin/env node

import { type PackageJson } from "type-fest";
import path from "path";
import { installDependencies } from "./helpers/installDependencies.js";
import { getVersion } from "./utils/getT3Version.js";
import {
getNpmVersion,
renderVersionWarning,
} from "./utils/renderVersionWarning.js";
import fs from "fs-extra";
import path from "path";
import { type PackageJson } from "type-fest";
import { runCli } from "~/cli/index.js";
import { createProject } from "~/helpers/createProject.js";
import { initializeGit } from "~/helpers/git.js";
import { setImportAlias } from "~/helpers/setImportAlias.js";
import { logNextSteps } from "~/helpers/logNextSteps.js";
import { setImportAlias } from "~/helpers/setImportAlias.js";
import { buildPkgInstallerMap } from "~/installers/index.js";
import { logger } from "~/utils/logger.js";
import { parseNameAndPath } from "~/utils/parseNameAndPath.js";
import { renderTitle } from "~/utils/renderTitle.js";
import {
getNpmVersion,
renderVersionWarning,
} from "./utils/renderVersionWarning.js";
import { installDependencies } from "./helpers/installDependencies.js";
import { getVersion } from "./utils/getT3Version.js";

type CT3APackageJSON = PackageJson & {
ct3aMetadata?: {
Expand Down
1 change: 0 additions & 1 deletion cli/template/base/src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { type AppType } from "next/dist/shared/lib/utils";

import "~/styles/globals.css";

const MyApp: AppType = ({ Component, pageProps }) => {
Expand Down
5 changes: 4 additions & 1 deletion cli/template/extras/config/prettier.config.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/** @type {import("prettier").Config} */
const config = {
plugins: [require.resolve("prettier-plugin-tailwindcss")],
plugins: [
require.resolve("prettier-plugin-tailwindcss"),
require.resolve("@ianvs/prettier-plugin-sort-imports"),
],
};

module.exports = config;
4 changes: 1 addition & 3 deletions cli/template/extras/src/pages/_app/with-auth-trpc.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { type AppType } from "next/app";
import { type Session } from "next-auth";
import { SessionProvider } from "next-auth/react";

import { type AppType } from "next/app";
import { api } from "~/utils/api";

import "~/styles/globals.css";

const MyApp: AppType<{ session: Session | null }> = ({
Expand Down
3 changes: 1 addition & 2 deletions cli/template/extras/src/pages/_app/with-auth.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { type AppType } from "next/app";
import { type Session } from "next-auth";
import { SessionProvider } from "next-auth/react";

import { type AppType } from "next/app";
import "~/styles/globals.css";

const MyApp: AppType<{ session: Session | null }> = ({
Expand Down
2 changes: 0 additions & 2 deletions cli/template/extras/src/pages/_app/with-trpc.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { type AppType } from "next/app";

import { api } from "~/utils/api";

import "~/styles/globals.css";

const MyApp: AppType = ({ Component, pageProps }) => {
Expand Down
3 changes: 1 addition & 2 deletions cli/template/extras/src/pages/index/with-auth-trpc-tw.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { type NextPage } from "next";
import { signIn, signOut, useSession } from "next-auth/react";
import Head from "next/head";
import Link from "next/link";
import { signIn, signOut, useSession } from "next-auth/react";

import { api } from "~/utils/api";

const Home: NextPage = () => {
Expand Down
3 changes: 1 addition & 2 deletions cli/template/extras/src/pages/index/with-auth-trpc.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import styles from "./index.module.css";
import { type NextPage } from "next";
import { signIn, signOut, useSession } from "next-auth/react";
import Head from "next/head";
import Link from "next/link";
import { signIn, signOut, useSession } from "next-auth/react";

import { api } from "~/utils/api";

const Home: NextPage = () => {
Expand Down
1 change: 0 additions & 1 deletion cli/template/extras/src/pages/index/with-trpc-tw.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { type NextPage } from "next";
import Head from "next/head";
import Link from "next/link";

import { api } from "~/utils/api";

const Home: NextPage = () => {
Expand Down
1 change: 0 additions & 1 deletion cli/template/extras/src/pages/index/with-trpc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import styles from "./index.module.css";
import { type NextPage } from "next";
import Head from "next/head";
import Link from "next/link";

import { api } from "~/utils/api";

const Home: NextPage = () => {
Expand Down