Skip to content

Commit

Permalink
style: format code with Prettier
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in d7f450a according to the output
from Prettier.

Details: None
  • Loading branch information
deepsource-autofix[bot] authored Apr 3, 2024
1 parent d7f450a commit 7407728
Show file tree
Hide file tree
Showing 71 changed files with 3,311 additions and 2,674 deletions.
4 changes: 2 additions & 2 deletions .lib/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable import/no-unused-modules */
// @ts-ignore
const isCi = process.env.CI !== undefined
const isCi = process.env.CI !== undefined;
if (!isCi) {
require('husky').install()
require("husky").install();
}
23 changes: 13 additions & 10 deletions .lib/runInstall.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
/* eslint-disable import/no-unused-modules */
import boxen from 'boxen'
import boxen from "boxen";

const message = boxen(`There have been changes to package dependencies!\n\nRun 'pnpm install' to update.`, {
title: 'New/Updated Packages',
borderStyle: 'double',
borderColor: 'redBright',
titleAlignment: 'center',
width: 60,
padding: 1,
})
const message = boxen(
`There have been changes to package dependencies!\n\nRun 'pnpm install' to update.`,
{
title: "New/Updated Packages",
borderStyle: "double",
borderColor: "redBright",
titleAlignment: "center",
width: 60,
padding: 1,
},
);

console.log(message)
console.log(message);
34 changes: 17 additions & 17 deletions .storybook/i18next.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
/* eslint-disable @typescript-eslint/no-floating-promises */
import i18n from 'i18next'
import LanguageDetector from 'i18next-browser-languagedetector'
import HttpApi from 'i18next-http-backend'
import { initReactI18next } from 'react-i18next'
import i18n from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import HttpApi from "i18next-http-backend";
import { initReactI18next } from "react-i18next";

import type { HttpBackendOptions } from 'i18next-http-backend'
import type { HttpBackendOptions } from "i18next-http-backend";

const ns = ['common', 'story']
const ns = ["common", "story"];
export const i18nLocales = {
en: 'English',
es: 'Spanish',
}
en: "English",
es: "Spanish",
};

const supportedLngs = Object.keys(i18nLocales)
const supportedLngs = Object.keys(i18nLocales);

i18n
.use(LanguageDetector)
.use(HttpApi)
.use(initReactI18next)
.init<HttpBackendOptions>({
debug: true,
lng: 'en',
lng: "en",
backend: {
loadPath: '/public/locales/{{lng}}/{{ns}}.json',
loadPath: "/public/locales/{{lng}}/{{ns}}.json",
},
fallbackLng: {
'en-US': ['en'],
'es-US': ['es'],
"en-US": ["en"],
"es-US": ["es"],
},
defaultNS: 'common',
defaultNS: "common",
interpolation: { escapeValue: false },
react: { useSuspense: false },
cleanCode: true,
supportedLngs,
ns,
// resources,
})
});

export { i18n }
export { i18n };
36 changes: 18 additions & 18 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { type StorybookConfig } from '@storybook/nextjs'
import { merge } from 'merge-anything'
import { type StorybookConfig } from "@storybook/nextjs";
import { merge } from "merge-anything";

import { dirname, join } from 'path'
import { dirname, join } from "path";

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
staticDirs: [
{
from: '../public',
to: '/',
from: "../public",
to: "/",
},
],
addons: [
getAbsolutePath('@storybook/addon-a11y'),
getAbsolutePath('@storybook/addon-links'),
getAbsolutePath('@storybook/addon-essentials'),
getAbsolutePath('@storybook/addon-interactions'),
getAbsolutePath("@storybook/addon-a11y"),
getAbsolutePath("@storybook/addon-links"),
getAbsolutePath("@storybook/addon-essentials"),
getAbsolutePath("@storybook/addon-interactions"),
],
framework: {
name: '@storybook/nextjs',
name: "@storybook/nextjs",
options: {},
},
docs: {
autodocs: 'tag',
autodocs: "tag",
},
typescript: {
check: true,
Expand All @@ -42,14 +42,14 @@ const config: StorybookConfig = {
// 'next-i18next': 'react-i18next',
},
},
}
const mergedConfig = merge(config, configAdditions)
return mergedConfig
};
const mergedConfig = merge(config, configAdditions);
return mergedConfig;
},
}
};

export default config
export default config;

function getAbsolutePath(value: string): string {
return dirname(require.resolve(join(value, 'package.json')))
return dirname(require.resolve(join(value, "package.json")));
}
44 changes: 24 additions & 20 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
import { Global, MantineProvider, TypographyStylesProvider } from '@mantine/core'
import { type MantineProviderProps } from '@mantine/core'
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport'
import { type StoryFn } from '@storybook/react'
import { type ReactNode } from 'react'
import { I18nextProvider } from 'react-i18next'
import {
Global,
MantineProvider,
TypographyStylesProvider,
} from "@mantine/core";
import { type MantineProviderProps } from "@mantine/core";
import { INITIAL_VIEWPORTS } from "@storybook/addon-viewport";
import { type StoryFn } from "@storybook/react";
import { type ReactNode } from "react";
import { I18nextProvider } from "react-i18next";

import { i18n, i18nLocales } from './i18next'
import { storybookFont } from '../src/styles'
import { theme } from '../src/styles/theme'
import { i18n, i18nLocales } from "./i18next";
import { storybookFont } from "../src/styles";
import { theme } from "../src/styles/theme";

export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
layout: 'centered',
actions: { argTypesRegex: "^on[A-Z].*" },
layout: "centered",
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
i18n,
locale: 'en',
locale: "en",
locales: i18nLocales,
viewport: {
viewports: INITIAL_VIEWPORTS,
},
}
const mantineProviderProps: Omit<MantineProviderProps, 'children'> = {
};
const mantineProviderProps: Omit<MantineProviderProps, "children"> = {
withCSSVariables: false,
withGlobalStyles: true,
withNormalizeCSS: false,
}
};

const ThemeWrapper = ({ children }: DecoratorProps) => {
return (
Expand All @@ -39,17 +43,17 @@ const ThemeWrapper = ({ children }: DecoratorProps) => {
<I18nextProvider i18n={i18n}>{children}</I18nextProvider>
{/* </TypographyStylesProvider> */}
</MantineProvider>
)
}
);
};

export const decorators = [
(Story: StoryFn) => (
<ThemeWrapper>
<Story />
</ThemeWrapper>
),
]
];

type DecoratorProps = {
children: ReactNode
}
children: ReactNode;
};
14 changes: 7 additions & 7 deletions lint-staged.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import path from 'path'
import path from "path";

const buildEslintCommand = (filenames) =>
`next lint --fix --file ${filenames.map((f) => path.relative(process.cwd(), f)).join(' --file ')}`
`next lint --fix --file ${filenames.map((f) => path.relative(process.cwd(), f)).join(" --file ")}`;

const config = {
'*.{cjs,mjs,js,jsx,ts,tsx}': [buildEslintCommand, 'prettier --write'],
'schema.prisma': ['prisma format'],
'*.json': ['prettier --write'],
}
"*.{cjs,mjs,js,jsx,ts,tsx}": [buildEslintCommand, "prettier --write"],
"schema.prisma": ["prisma format"],
"*.json": ["prettier --write"],
};

export default config
export default config;
32 changes: 16 additions & 16 deletions next-i18next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-var-requires */
// @ts-check
/* eslint-disable import/no-unused-modules */
const path = require('path')
const path = require("path");
/**
* @template {import('next-i18next').UserConfig} T
* @type {import('next-i18next').UserConfig}
Expand All @@ -11,34 +11,34 @@ const path = require('path')
*/
const config = {
i18n: {
defaultLocale: 'en',
locales: ['en', 'es'],
defaultLocale: "en",
locales: ["en", "es"],
},
defaultNS: 'common',
localePath: path.resolve('./public/locales'),
reloadOnPrerender: process.env.NODE_ENV !== 'production',
defaultNS: "common",
localePath: path.resolve("./public/locales"),
reloadOnPrerender: process.env.NODE_ENV !== "production",
debug: false, //process.env.NODE_ENV !== 'production',
nonExplicitSupportedLngs: true,
cleanCode: true,
react: { useSuspense: false },
joinArrays: '',
joinArrays: "",
serializeConfig: false,
interpolation: {
skipOnVariables: false,
alwaysFormat: true,
format: (value, format, lng, edit) => {
switch (format) {
case 'lowercase': {
if (typeof value === 'string') return value.toLocaleLowerCase()
break
case "lowercase": {
if (typeof value === "string") return value.toLocaleLowerCase();
break;
}
case 'uppercase': {
if (typeof value === 'string') return value.toLocaleUpperCase()
break
case "uppercase": {
if (typeof value === "string") return value.toLocaleUpperCase();
break;
}
}
return value
return value;
},
},
}
module.exports = config
};
module.exports = config;
4 changes: 2 additions & 2 deletions next-sitemap.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: 'https://transmascfutures.inreach.org',
siteUrl: "https://transmascfutures.inreach.org",
generateRobotsTxt: true,
generateIndexSitemap: false,
}
};
34 changes: 20 additions & 14 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,48 +1,54 @@
/* eslint-disable turbo/no-undeclared-env-vars */
// @ts-check
import bundleAnalyze from '@next/bundle-analyzer'
import nextRoutes from 'nextjs-routes/config'
import bundleAnalyze from "@next/bundle-analyzer";
import nextRoutes from "nextjs-routes/config";

import i18nConfig from './next-i18next.config.js'
import i18nConfig from "./next-i18next.config.js";
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful for
* Docker builds.
*/

!process.env.SKIP_ENV_VALIDATION && (await import('./src/env/server.mjs'))
!process.env.SKIP_ENV_VALIDATION && (await import("./src/env/server.mjs"));

const withRoutes = nextRoutes({ outDir: 'src/types' })
const withBundleAnalyzer = bundleAnalyze({ enabled: process.env.ANALYZE === 'true' })
const withRoutes = nextRoutes({ outDir: "src/types" });
const withBundleAnalyzer = bundleAnalyze({
enabled: process.env.ANALYZE === "true",
});

/** @type {import('next').NextConfig} */
const config = {
i18n: i18nConfig.i18n,
reactStrictMode: true,
swcMinify: true,
compiler: {
...(process.env.VERCEL_ENV === 'production' ? { removeConsole: { exclude: ['error'] } } : {}),
...(process.env.VERCEL_ENV === "production"
? { removeConsole: { exclude: ["error"] } }
: {}),
},
images: {
remotePatterns: [{ protocol: 'https', hostname: 'placehold.co', pathname: '/**' }],
remotePatterns: [
{ protocol: "https", hostname: "placehold.co", pathname: "/**" },
],
// domains: ['placehold.co'],
},
experimental: {
outputFileTracingExcludes: {
'*': ['**swc+core**', '**esbuild**'],
"*": ["**swc+core**", "**esbuild**"],
},
webpackBuildWorker: true,
},
eslint: { ignoreDuringBuilds: process.env.VERCEL_ENV !== 'production' },
typescript: { ignoreBuildErrors: process.env.VERCEL_ENV !== 'production' },
}
eslint: { ignoreDuringBuilds: process.env.VERCEL_ENV !== "production" },
typescript: { ignoreBuildErrors: process.env.VERCEL_ENV !== "production" },
};
/**
* Wraps NextJS config with the Bundle Analyzer config.
*
* @param {typeof config} config
* @returns {typeof config}
*/
function defineNextConfig(config) {
return withBundleAnalyzer(withRoutes(config))
return withBundleAnalyzer(withRoutes(config));
}

export default defineNextConfig(config)
export default defineNextConfig(config);
Loading

0 comments on commit 7407728

Please sign in to comment.