Skip to content

Commit

Permalink
chore: apply linters
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp committed Jul 17, 2023
1 parent 112d425 commit f1156f5
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 79 deletions.
4 changes: 1 addition & 3 deletions apps/web/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
// Workaround for https://github.com/eslint/eslint/issues/3458 (re-export of @rushstack/eslint-patch)
require('@wayofdev/eslint-config-bases/patch/modern-module-resolution')

const {
getDefaultIgnorePatterns,
} = require('@wayofdev/eslint-config-bases/helpers')
const { getDefaultIgnorePatterns } = require('@wayofdev/eslint-config-bases/helpers')

module.exports = {
root: true,
Expand Down
6 changes: 1 addition & 5 deletions apps/web/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ const config = {
// false by default, overrides in cli, ie: yarn test:unit --collect-coverage=true
collectCoverage: false,
coverageDirectory: '<rootDir>/../coverage',
collectCoverageFrom: [
'<rootDir>/**/*.{ts,tsx,js,jsx}',
'!**/*.test.{js,ts}',
'!**/__mock__/*',
],
collectCoverageFrom: ['<rootDir>/**/*.{ts,tsx,js,jsx}', '!**/*.test.{js,ts}', '!**/__mock__/*'],
transformIgnorePatterns: ['/node_modules/(?!@vercel/analytics)/'],
}

Expand Down
File renamed without changes.
35 changes: 8 additions & 27 deletions apps/web/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ import { getValidatedServerEnv } from './src/config/validated-server-env.mjs'
// validate server env
getValidatedServerEnv()

const workspaceRoot = path.resolve(
path.dirname(url.fileURLToPath(import.meta.url)),
'..',
'..'
)
const workspaceRoot = path.resolve(path.dirname(url.fileURLToPath(import.meta.url)), '..', '..')

/**
* Once supported replace by node / eslint / ts and out of experimental, replace by
Expand All @@ -41,18 +37,10 @@ const isProd = process.env.NODE_ENV === 'production'
const isCI = trueEnv.includes(process.env?.CI ?? 'false')
const enableCSP = true

const NEXT_STANDALONE_BUILD = trueEnv.includes(
process.env?.NEXT_STANDALONE_BUILD ?? 'false'
)
const NEXT_IGNORE_TYPE_CHECK = trueEnv.includes(
process.env?.NEXT_IGNORE_TYPE_CHECK ?? 'false'
)
const NEXT_IGNORE_ESLINT = trueEnv.includes(
process.env?.NEXT_IGNORE_ESLINT ?? 'false'
)
const SENTRY_UPLOAD_DRY_RUN = trueEnv.includes(
process.env?.SENTRY_UPLOAD_DRY_RUN ?? 'false'
)
const NEXT_STANDALONE_BUILD = trueEnv.includes(process.env?.NEXT_STANDALONE_BUILD ?? 'false')
const NEXT_IGNORE_TYPE_CHECK = trueEnv.includes(process.env?.NEXT_IGNORE_TYPE_CHECK ?? 'false')
const NEXT_IGNORE_ESLINT = trueEnv.includes(process.env?.NEXT_IGNORE_ESLINT ?? 'false')
const SENTRY_UPLOAD_DRY_RUN = trueEnv.includes(process.env?.SENTRY_UPLOAD_DRY_RUN ?? 'false')
const DISABLE_SENTRY = trueEnv.includes(process.env?.DISABLE_SENTRY ?? 'false')
const SENTRY_DEBUG = trueEnv.includes(process.env?.SENTRY_DEBUG ?? 'false')
const SENTRY_TRACING = trueEnv.includes(process.env?.SENTRY_TRACING ?? 'false')
Expand All @@ -62,9 +50,7 @@ const SENTRY_TRACING = trueEnv.includes(process.env?.SENTRY_TRACING ?? 'false')
* to deliver an image or deploy the files.
* @link https://nextjs.org/docs/advanced-features/source-maps
*/
const disableSourceMaps = trueEnv.includes(
process.env?.NEXT_DISABLE_SOURCEMAPS ?? 'false'
)
const disableSourceMaps = trueEnv.includes(process.env?.NEXT_DISABLE_SOURCEMAPS ?? 'false')

if (disableSourceMaps) {
console.log(
Expand Down Expand Up @@ -116,10 +102,7 @@ const secureHeaders = createSecureHeaders({
},
...(enableCSP && process.env.NODE_ENV === 'production'
? {
forceHTTPSRedirect: [
true,
{ maxAge: 60 * 60 * 24 * 4, includeSubDomains: true },
],
forceHTTPSRedirect: [true, { maxAge: 60 * 60 * 24 * 4, includeSubDomains: true }],
}
: {}),
referrerPolicy: 'same-origin',
Expand Down Expand Up @@ -185,9 +168,7 @@ const nextConfig = {

// Standalone build
// @link https://nextjs.org/docs/advanced-features/output-file-tracing#automatically-copying-traced-files-experimental
...(NEXT_STANDALONE_BUILD
? { output: 'standalone', outputFileTracing: true }
: {}),
...(NEXT_STANDALONE_BUILD ? { output: 'standalone', outputFileTracing: true } : {}),

experimental: {
// @link https://nextjs.org/docs/advanced-features/output-file-tracing#caveats
Expand Down
4 changes: 1 addition & 3 deletions apps/web/sentry.client.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ sentryInit({
// @see https://develop.sentry.dev/sdk/performance/
// To turn it off, remove the line
// @see https://github.com/getsentry/sentry-javascript/discussions/4503#discussioncomment-2143116
tracesSampleRate: ['false', '0'].includes(process.env.SENTRY_TRACING ?? '')
? undefined
: 1,
tracesSampleRate: ['false', '0'].includes(process.env.SENTRY_TRACING ?? '') ? undefined : 1,

// Note: The Replay integration only needs to be added to your sentry.client.config.js file.
// It will not run if it is added into sentry.server.config.js.
Expand Down
6 changes: 1 addition & 5 deletions apps/web/src/config/validated-server-env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ export const getValidatedServerEnv = () => {
process.exit(1)
} else {
throw new Error(
`Invalid server env(s): ${JSON.stringify(
parsedEnv.error.format(),
null,
2
)}}`
`Invalid server env(s): ${JSON.stringify(parsedEnv.error.format(), null, 2)}}`
)
}
}
Expand Down
15 changes: 3 additions & 12 deletions apps/web/src/features/auth/components/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ export const LoginForm: FC<Props> = _props => {
// callbackUrl: '/',
redirect: false,
})
const {
ok = false,
url,
status = 500,
error = 'Server or network Error',
} = result ?? {}
const { ok = false, url, status = 500, error = 'Server or network Error' } = result ?? {}

if (ok) {
console.log('Will redirect to ' + url)
Expand All @@ -67,9 +62,7 @@ export const LoginForm: FC<Props> = _props => {
placeholder="Username or email"
className="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
/>
{errors?.username && (
<p className={'bg-amber-600'}>{errors.username.message}</p>
)}
{errors?.username && <p className={'bg-amber-600'}>{errors.username.message}</p>}
</label>
<label>
Password
Expand All @@ -83,9 +76,7 @@ export const LoginForm: FC<Props> = _props => {
placeholder="Password"
className="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
/>
{errors?.password && (
<p className={'bg-amber-600'}>{errors.password.message}</p>
)}
{errors?.password && <p className={'bg-amber-600'}>{errors.password.message}</p>}
</label>
<button
type="submit"
Expand Down
15 changes: 3 additions & 12 deletions apps/web/src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import Document, { Html, Head, Main, NextScript } from 'next/document'
import { defaultLocale } from '../../next-i18next.config.mjs'

class MyDocument extends Document {
static async getInitialProps(
ctx: DocumentContext
): Promise<DocumentInitialProps> {
static async getInitialProps(ctx: DocumentContext): Promise<DocumentInitialProps> {
return await Document.getInitialProps(ctx)
}

Expand Down Expand Up @@ -38,17 +36,10 @@ class MyDocument extends Document {
href="/images/favicon/favicon-16x16.png"
/>
<link rel="manifest" href="/images/favicon/site.webmanifest" />
<link
rel="mask-icon"
href="/images/favicon/safari-pinned-tab.svg"
color="#5bbad5"
/>
<link rel="mask-icon" href="/images/favicon/safari-pinned-tab.svg" color="#5bbad5" />
<link rel="shortcut icon" href="/images/favicon/favicon.ico" />
<meta name="msapplication-TileColor" content="#ffffff" />
<meta
name="msapplication-config"
content="/images/favicon/browserconfig.xml"
/>
<meta name="msapplication-config" content="/images/favicon/browserconfig.xml" />
<meta name="theme-color" content="#ffffff" />
</Head>
<body>
Expand Down
9 changes: 1 addition & 8 deletions apps/web/src/themes/shared/browser-fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,7 @@ export const browserFonts = {
'Segoe UI Symbol',
'Noto Color Emoji',
],
serif: [
'ui-serif',
'Georgia',
'Cambria',
'Times New Roman',
'Times',
'serif',
],
serif: ['ui-serif', 'Georgia', 'Cambria', 'Times New Roman', 'Times', 'serif'],
mono: [
'ui-monospace',
'SFMono-Regular',
Expand Down
5 changes: 1 addition & 4 deletions apps/web/tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import { tailwindV3Colors } from './src/themes/shared/colors'
import { tailwindTheme } from './src/themes/tailwind/tailwind.theme'

const tailwindConfig: Config = {
content: [
'./src/**/*.(js|jsx|ts|tsx)',
'./node_modules/@wayofdev/ui/src/**/*.(js|jsx|ts|tsx)',
],
content: ['./src/**/*.(js|jsx|ts|tsx)', './node_modules/@wayofdev/ui/src/**/*.(js|jsx|ts|tsx)'],
theme: {
screens: {
...defaultTheme.screens,
Expand Down

0 comments on commit f1156f5

Please sign in to comment.