diff --git a/apps/nextjs-app/.eslintrc.cjs b/apps/nextjs-app/.eslintrc.cjs
index 9fb987d28d5..7a6a3540c83 100644
--- a/apps/nextjs-app/.eslintrc.cjs
+++ b/apps/nextjs-app/.eslintrc.cjs
@@ -20,6 +20,7 @@ module.exports = {
ignorePatterns: [...getDefaultIgnorePatterns(), '.next', '.out'],
extends: [
'@your-org/eslint-config-bases/typescript',
+ '@your-org/eslint-config-bases/import-x',
// '@your-org/eslint-config-bases/sonar',
'@your-org/eslint-config-bases/regexp',
'@your-org/eslint-config-bases/jest',
diff --git a/apps/nextjs-app/config/tests/test-utils.tsx b/apps/nextjs-app/config/tests/test-utils.tsx
index 9b1e4afb7e2..767b71f4620 100644
--- a/apps/nextjs-app/config/tests/test-utils.tsx
+++ b/apps/nextjs-app/config/tests/test-utils.tsx
@@ -23,8 +23,10 @@ const customRender = (ui: ReactElement, options?: any) =>
});
// re-export everything
+// eslint-disable-next-line import-x/export
export * from '@testing-library/react';
export { default as userEvent } from '@testing-library/user-event';
// override render method
+// eslint-disable-next-line import-x/export
export { customRender as render };
diff --git a/apps/nextjs-app/next-i18next.config.mjs b/apps/nextjs-app/next-i18next.config.mjs
index 9fb5010fe9e..7440e5c24c9 100644
--- a/apps/nextjs-app/next-i18next.config.mjs
+++ b/apps/nextjs-app/next-i18next.config.mjs
@@ -1,5 +1,3 @@
-import path from 'node:path';
-
const debugI18n = ['true', 1].includes(
process?.env?.NEXTJS_DEBUG_I18N ?? 'false'
);
@@ -8,6 +6,17 @@ const localePublicFolder = undefined;
export const defaultLocale = 'en';
+const getLocalesPath = async () => {
+ if ('window' in globalThis) {
+ return localePublicFolder;
+ }
+ // eslint-disable-next-line unicorn/prefer-node-protocol,unicorn/import-style
+ const path = await import('path').then((mod) => mod.default);
+ return path.resolve('../../packages/common-i18n/src/locales');
+};
+
+const localePath = await getLocalesPath();
+
/**
* @type {import('next-i18next').UserConfig}
*/
@@ -29,8 +38,5 @@ export default {
escapeValue: false,
},
*/
- localePath:
- 'window' in globalThis
- ? localePublicFolder
- : path.resolve('../../packages/common-i18n/src/locales'),
+ localePath,
};
diff --git a/apps/nextjs-app/src/components/banner/__tests__/Banner.test.tsx b/apps/nextjs-app/src/components/banner/__tests__/Banner.test.tsx
deleted file mode 100644
index fab8f6bf032..00000000000
--- a/apps/nextjs-app/src/components/banner/__tests__/Banner.test.tsx
+++ /dev/null
@@ -1,7 +0,0 @@
-import renderer from 'react-test-renderer';
-import { Banner } from '../Banner';
-
-it('should match snapshot', () => {
- const tree = renderer.create().toJSON();
- expect(tree).toMatchSnapshot();
-});
diff --git a/apps/nextjs-app/src/components/banner/__tests__/__snapshots__/Banner.test.tsx.snap b/apps/nextjs-app/src/components/banner/__tests__/__snapshots__/Banner.test.tsx.snap
deleted file mode 100644
index c40b51f6f21..00000000000
--- a/apps/nextjs-app/src/components/banner/__tests__/__snapshots__/Banner.test.tsx.snap
+++ /dev/null
@@ -1,84 +0,0 @@
-// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
-
-exports[`should match snapshot 1`] = `
-
-
-
-
-
-
-
-
-
- We announced a new product!
-
-
- Big news! We're excited to announce a brand new product.
-
-
-
-
-
-
-
-
-
-
-`;
diff --git a/packages/common-i18n/.eslintrc.cjs b/packages/common-i18n/.eslintrc.cjs
index 02453027b4d..c0c113c1528 100644
--- a/packages/common-i18n/.eslintrc.cjs
+++ b/packages/common-i18n/.eslintrc.cjs
@@ -17,6 +17,7 @@ module.exports = {
ignorePatterns: [...getDefaultIgnorePatterns()],
extends: [
'@your-org/eslint-config-bases/typescript',
+ '@your-org/eslint-config-bases/import-x',
// Apply prettier and disable incompatible rules
'@your-org/eslint-config-bases/prettier-plugin',
],
diff --git a/packages/core-lib/.eslintrc.cjs b/packages/core-lib/.eslintrc.cjs
index 08622bc8e81..04ab26ab943 100644
--- a/packages/core-lib/.eslintrc.cjs
+++ b/packages/core-lib/.eslintrc.cjs
@@ -20,6 +20,7 @@ module.exports = {
ignorePatterns: [...getDefaultIgnorePatterns()],
extends: [
'@your-org/eslint-config-bases/typescript',
+ '@your-org/eslint-config-bases/import-x',
'@your-org/eslint-config-bases/sonar',
'@your-org/eslint-config-bases/regexp',
'@your-org/eslint-config-bases/jest',
diff --git a/packages/core-lib/config/test/setupVitest.ts b/packages/core-lib/config/test/setupVitest.ts
index af9529469a3..a13254f44ba 100644
--- a/packages/core-lib/config/test/setupVitest.ts
+++ b/packages/core-lib/config/test/setupVitest.ts
@@ -5,4 +5,4 @@ const jestCompatOverride = {
spyOn: vi.spyOn,
};
-(global as unknown as Record<'jest', unknown>).jest = jestCompatOverride;
+(globalThis as unknown as Record<'jest', unknown>).jest = jestCompatOverride;
diff --git a/packages/core-lib/config/test/test-utils.ts b/packages/core-lib/config/test/test-utils.ts
index 1d3ade07a9b..e3097236959 100644
--- a/packages/core-lib/config/test/test-utils.ts
+++ b/packages/core-lib/config/test/test-utils.ts
@@ -1,4 +1,3 @@
-/* eslint-disable import/export */
import { cleanup, render } from '@testing-library/react';
import type React from 'react';
@@ -20,7 +19,9 @@ const customRender = (ui: React.ReactElement, options = {}) =>
...options,
});
+// eslint-disable-next-line import-x/export
export * from '@testing-library/react';
export { default as userEvent } from '@testing-library/user-event';
// override render export
+// eslint-disable-next-line import-x/export
export { customRender as render };
diff --git a/packages/core-lib/src/hooks/__tests__/use-promise.test.tsx b/packages/core-lib/src/hooks/__tests__/use-promise.test.tsx
index 8aa1f2344eb..77f9cfdf9f2 100644
--- a/packages/core-lib/src/hooks/__tests__/use-promise.test.tsx
+++ b/packages/core-lib/src/hooks/__tests__/use-promise.test.tsx
@@ -12,7 +12,7 @@ describe('usePromise', () => {
const callback = vi.fn();
const promiseFn = async (deps: Deps) => {
callback(deps);
- return Promise.resolve(expected);
+ return expected;
};
const { result, rerender } = renderHook(() =>
@@ -21,7 +21,7 @@ describe('usePromise', () => {
// initial data
const initialValue = result.current;
expect(result.current.data).toBeNull();
- expect(result.current.isLoading).toStrictEqual(true);
+ expect(result.current.isLoading).toBe(true);
expect(result.current.error).toBeNull();
// resolved data
@@ -32,13 +32,13 @@ describe('usePromise', () => {
expect(callback).toHaveBeenCalledTimes(1);
expect(result.current.data).toStrictEqual(expected);
- expect(result.current.isLoading).toStrictEqual(false);
+ expect(result.current.isLoading).toBe(false);
expect(result.current.error).toBeNull();
rerender();
expect(callback).toHaveBeenCalledTimes(1);
expect(result.current.data).toStrictEqual(expected);
- expect(result.current.isLoading).toStrictEqual(false);
+ expect(result.current.isLoading).toBe(false);
expect(result.current.error).toBeNull();
});
@@ -55,7 +55,7 @@ describe('usePromise', () => {
// initial data
const initialValue = result.current;
expect(result.current.data).toBeNull();
- expect(result.current.isLoading).toStrictEqual(true);
+ expect(result.current.isLoading).toBe(true);
expect(result.current.error).toBeNull();
// resolved data
@@ -65,22 +65,22 @@ describe('usePromise', () => {
expect(callback).toHaveBeenCalledTimes(1);
expect(result.current.error).toBeInstanceOf(Error);
- expect(result.current.isLoading).toStrictEqual(false);
- expect(result.current.error?.message).toStrictEqual('cool');
+ expect(result.current.isLoading).toBe(false);
+ expect(result.current.error?.message).toBe('cool');
});
it('should call the promise when forceReload is called', async () => {
const callback = vi.fn();
const promiseFn = async () => {
callback();
- return Promise.resolve(0);
+ return 0;
};
const { result } = renderHook(() => usePromise(promiseFn, {}));
// initial data
const initialValue = result.current;
expect(result.current.data).toBeNull();
- expect(result.current.isLoading).toStrictEqual(true);
+ expect(result.current.isLoading).toBe(true);
expect(result.current.error).toBeNull();
// resolved data
diff --git a/packages/core-lib/tsup.config.ts b/packages/core-lib/tsup.config.ts
index 3d3214e881f..3234445396b 100644
--- a/packages/core-lib/tsup.config.ts
+++ b/packages/core-lib/tsup.config.ts
@@ -9,7 +9,7 @@ export default defineConfig((options) => ({
format: ['esm'],
platform: 'browser',
target: ['es2020', 'chrome80', 'edge18', 'firefox70', 'node18'],
- tsconfig: new URL('./tsconfig.build.json', import.meta.url).pathname,
+ tsconfig: new URL('tsconfig.build.json', import.meta.url).pathname,
sourcemap: !options.watch,
minify: !options.watch,
}));
diff --git a/packages/db-main-prisma/.eslintrc.cjs b/packages/db-main-prisma/.eslintrc.cjs
index f898250ff75..e01b37d44cc 100644
--- a/packages/db-main-prisma/.eslintrc.cjs
+++ b/packages/db-main-prisma/.eslintrc.cjs
@@ -20,6 +20,7 @@ module.exports = {
ignorePatterns: [...getDefaultIgnorePatterns(), 'src/generated'],
extends: [
'@your-org/eslint-config-bases/typescript',
+ '@your-org/eslint-config-bases/import-x',
'@your-org/eslint-config-bases/sonar',
'@your-org/eslint-config-bases/regexp',
// Apply prettier and disable incompatible rules
diff --git a/packages/db-main-prisma/e2e/e2e-dsn-services.util.ts b/packages/db-main-prisma/e2e/e2e-dsn-services.util.ts
index af5baedd0f8..1eecafcdc32 100644
--- a/packages/db-main-prisma/e2e/e2e-dsn-services.util.ts
+++ b/packages/db-main-prisma/e2e/e2e-dsn-services.util.ts
@@ -26,7 +26,7 @@ export const getAndCheckDatabaseDsn = async (): Promise => {
const { dsn, port, host } = getValidatedDsn();
const reachable = await isPortReachable(port as unknown as number, {
host: host,
- timeout: 5_000,
+ timeout: 5000,
});
if (!reachable) {
diff --git a/packages/db-main-prisma/prisma/seed.ts b/packages/db-main-prisma/prisma/seed.ts
index 086cc42438c..5aa8690ec6f 100644
--- a/packages/db-main-prisma/prisma/seed.ts
+++ b/packages/db-main-prisma/prisma/seed.ts
@@ -15,11 +15,12 @@ async function main() {
console.log(`Seeding finished.`);
}
-main()
- .catch((e) => {
- console.error(e);
- process.exit(1);
- })
- .finally(async () => {
- await prisma.$disconnect();
- });
+try {
+ await main();
+} catch (e) {
+ console.error(e);
+ // eslint-disable-next-line unicorn/no-process-exit
+ process.exit(1);
+} finally {
+ await prisma.$disconnect();
+}
diff --git a/packages/db-main-prisma/src/seeds/PoemSeeds.ts b/packages/db-main-prisma/src/seeds/PoemSeeds.ts
index 85c2d21a577..d7863e6ff32 100644
--- a/packages/db-main-prisma/src/seeds/PoemSeeds.ts
+++ b/packages/db-main-prisma/src/seeds/PoemSeeds.ts
@@ -266,7 +266,7 @@ const poems: Prisma.PoemCreateInput[] = [
].map((poem) => {
const sanitizedContent = poem.content
// @link http://www.unicode.org/reports/tr18/#RL1.6
- .split(/(\r\n|[\n\v\f\r\x85\u2028\u2029])/)
+ .split(/(\r\n|[\n\v\f\r\u0085\u2028\u2029])/)
.map((line) => line.trim())
.filter((line) => line.length > 0)
.join('\n')
@@ -303,7 +303,7 @@ const poemData = poems.map((p) => {
export class PoemSeeds extends AbstractSeed {
execute = async (): Promise => {
- for await (const p of poemData) {
+ for (const p of poemData) {
const { keywords, ...poemWithoutKeywords } = p;
const poem = await this.prisma.poem.upsert({
where: {
diff --git a/packages/db-main-prisma/tsconfig.json b/packages/db-main-prisma/tsconfig.json
index 26cf569219a..2f5232b476a 100644
--- a/packages/db-main-prisma/tsconfig.json
+++ b/packages/db-main-prisma/tsconfig.json
@@ -3,9 +3,9 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "./src",
- "target": "ESNext",
+ "target": "esnext",
"lib": ["esnext"],
- "module": "ES2020",
+ "module": "esnext",
"noEmit": false,
"incremental": true,
"paths": {},
diff --git a/packages/db-main-prisma/tsup.config.ts b/packages/db-main-prisma/tsup.config.ts
index cea457d105f..ce05c9f5294 100644
--- a/packages/db-main-prisma/tsup.config.ts
+++ b/packages/db-main-prisma/tsup.config.ts
@@ -9,7 +9,7 @@ export default defineConfig((options) => {
format: ['esm'],
platform: 'node',
target: ['node18'],
- tsconfig: new URL('./tsconfig.build.json', import.meta.url).pathname,
+ tsconfig: new URL('tsconfig.build.json', import.meta.url).pathname,
sourcemap: !options.watch,
// Do not minify node only packages to let patching possible by the consumer (ie: patch-package)
minify: false,
diff --git a/packages/eslint-config-bases/src/bases/sonar.js b/packages/eslint-config-bases/src/bases/sonar.js
index f8171ff6ef1..29065263f94 100644
--- a/packages/eslint-config-bases/src/bases/sonar.js
+++ b/packages/eslint-config-bases/src/bases/sonar.js
@@ -38,7 +38,7 @@ module.exports = {
'warn',
{
// For NextJs styled-jsx
- ignore: ['jsx'],
+ ignore: ['jsx', 'css'],
},
],
},
diff --git a/packages/ts-utils/.eslintrc.cjs b/packages/ts-utils/.eslintrc.cjs
index 42c572fa2ef..dffdc31566a 100644
--- a/packages/ts-utils/.eslintrc.cjs
+++ b/packages/ts-utils/.eslintrc.cjs
@@ -17,6 +17,7 @@ module.exports = {
ignorePatterns: [...getDefaultIgnorePatterns()],
extends: [
'@your-org/eslint-config-bases/typescript',
+ '@your-org/eslint-config-bases/import-x',
'@your-org/eslint-config-bases/sonar',
'@your-org/eslint-config-bases/regexp',
'@your-org/eslint-config-bases/jest',
diff --git a/packages/ts-utils/src/convert/__tests__/string-convert.test.ts b/packages/ts-utils/src/convert/__tests__/string-convert.test.ts
index 280aad8adbf..90e8f0f9447 100644
--- a/packages/ts-utils/src/convert/__tests__/string-convert.test.ts
+++ b/packages/ts-utils/src/convert/__tests__/string-convert.test.ts
@@ -1,4 +1,4 @@
-import { stringToFloat, stringToSafeInteger } from '../';
+import { stringToFloat, stringToSafeInteger } from '..';
describe('StringConvert tests', () => {
describe('stringtoSafeInteger', () => {
diff --git a/packages/ts-utils/src/typeguards/__tests__/typeguards.test.ts b/packages/ts-utils/src/typeguards/__tests__/typeguards.test.ts
index e58891246d5..f9000c36e36 100644
--- a/packages/ts-utils/src/typeguards/__tests__/typeguards.test.ts
+++ b/packages/ts-utils/src/typeguards/__tests__/typeguards.test.ts
@@ -6,7 +6,7 @@ import {
isParsableSafeInteger,
isPlainObject,
isPresent,
-} from '../';
+} from '..';
describe('Typeguards tests', () => {
describe('isNonEmptyString', () => {
diff --git a/packages/ui-lib/.eslintrc.cjs b/packages/ui-lib/.eslintrc.cjs
index ece0c350829..81dda6b9afa 100644
--- a/packages/ui-lib/.eslintrc.cjs
+++ b/packages/ui-lib/.eslintrc.cjs
@@ -20,6 +20,7 @@ module.exports = {
ignorePatterns: [...getDefaultIgnorePatterns(), '/storybook-static'],
extends: [
'@your-org/eslint-config-bases/typescript',
+ '@your-org/eslint-config-bases/import-x',
'@your-org/eslint-config-bases/regexp',
'@your-org/eslint-config-bases/sonar',
'@your-org/eslint-config-bases/jest',
diff --git a/packages/ui-lib/config/test/setupVitest.ts b/packages/ui-lib/config/test/setupVitest.ts
index af9529469a3..a13254f44ba 100644
--- a/packages/ui-lib/config/test/setupVitest.ts
+++ b/packages/ui-lib/config/test/setupVitest.ts
@@ -5,4 +5,4 @@ const jestCompatOverride = {
spyOn: vi.spyOn,
};
-(global as unknown as Record<'jest', unknown>).jest = jestCompatOverride;
+(globalThis as unknown as Record<'jest', unknown>).jest = jestCompatOverride;
diff --git a/packages/ui-lib/config/test/test-utils.ts b/packages/ui-lib/config/test/test-utils.ts
index 1d3ade07a9b..e3097236959 100644
--- a/packages/ui-lib/config/test/test-utils.ts
+++ b/packages/ui-lib/config/test/test-utils.ts
@@ -1,4 +1,3 @@
-/* eslint-disable import/export */
import { cleanup, render } from '@testing-library/react';
import type React from 'react';
@@ -20,7 +19,9 @@ const customRender = (ui: React.ReactElement, options = {}) =>
...options,
});
+// eslint-disable-next-line import-x/export
export * from '@testing-library/react';
export { default as userEvent } from '@testing-library/user-event';
// override render export
+// eslint-disable-next-line import-x/export
export { customRender as render };
diff --git a/packages/ui-lib/src/async-message.tsx b/packages/ui-lib/src/async-message.tsx
index 2da6a62f642..46bdc1fbd18 100644
--- a/packages/ui-lib/src/async-message.tsx
+++ b/packages/ui-lib/src/async-message.tsx
@@ -7,20 +7,20 @@ type Props = {
export const AsyncMessage: FC = (props) => {
const [msg, setMsg] = useState(null);
- const [isLoading, setLoading] = useState(true);
+ const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState(null);
useEffect(() => {
- setLoading(true);
+ setIsLoading(true);
fetch(props.apiUrl)
.then((res) => res.text())
.then((data) => {
setMsg(data);
- setLoading(false);
+ setIsLoading(false);
})
.catch((err: unknown) => {
setError(err instanceof Error ? err.message : 'Unknown error');
- setLoading(false);
+ setIsLoading(false);
});
}, [props.apiUrl]);
diff --git a/packages/ui-lib/src/base/card/BasicCard.tsx b/packages/ui-lib/src/base/card/BasicCard.tsx
index 5b3642d3110..56bc9bafca6 100644
--- a/packages/ui-lib/src/base/card/BasicCard.tsx
+++ b/packages/ui-lib/src/base/card/BasicCard.tsx
@@ -14,9 +14,9 @@ export const BasicCard: FC = (props) => {
const imgSrc = isNonEmptyString(image) ? image : undefined;
return (
- {imgSrc !== undefined ? (
+ {imgSrc === undefined ? null : (
- ) : null}
+ )}
{title}
diff --git a/packages/ui-lib/src/ux/text/GradientText.tsx b/packages/ui-lib/src/ux/text/GradientText.tsx
index 9f7660d2443..49f7a1092f1 100644
--- a/packages/ui-lib/src/ux/text/GradientText.tsx
+++ b/packages/ui-lib/src/ux/text/GradientText.tsx
@@ -76,7 +76,8 @@ export const GradientText = styled.span`
transition-duration: 1s;
}
}
- ${(props) => {
+
+ ${(props) => /* eslint-disable-line sonarjs/function-return-type */ {
const { css } = props;
return css;
}};
diff --git a/packages/ui-lib/src/ux/text/TypedText.tsx b/packages/ui-lib/src/ux/text/TypedText.tsx
index eec761f78a8..6f38d4fc2fc 100644
--- a/packages/ui-lib/src/ux/text/TypedText.tsx
+++ b/packages/ui-lib/src/ux/text/TypedText.tsx
@@ -24,13 +24,13 @@ export const TypedText: FC = (props) => {
const interval = useRef();
useEffect(() => {
- interval.current = window.setInterval(() => {
+ interval.current = globalThis.window.setInterval(() => {
// console.log('running interval');
setCurrIdx((currIdx) => {
if (currIdx > text.length) {
if (interval.current) {
setText(text === 'Typescript' ? children : 'Typescript');
- window.clearInterval(interval.current);
+ globalThis.window.clearInterval(interval.current);
interval.current = null;
}
return 0;
@@ -41,7 +41,7 @@ export const TypedText: FC = (props) => {
return () => {
if (interval.current) {
setCurrIdx(0);
- window.clearInterval(interval.current);
+ globalThis.window.clearInterval(interval.current);
interval.current = null;
}
};
diff --git a/packages/ui-lib/tailwind.config.js b/packages/ui-lib/tailwind.config.js
index 6970f6b6c94..9ad0d88e962 100644
--- a/packages/ui-lib/tailwind.config.js
+++ b/packages/ui-lib/tailwind.config.js
@@ -15,6 +15,7 @@ const tailwindV3Colors = Object.entries(
Object.prototype.hasOwnProperty.call(desc, 'value') &&
typeof desc.value !== 'function'
)
+ // eslint-disable-next-line unicorn/no-array-reduce
.reduce((acc, [key]) => {
if (
!['coolGray', 'lightBlue', 'warmGray', 'trueGray', 'blueGray'].includes(
diff --git a/packages/ui-lib/tsup.config.ts b/packages/ui-lib/tsup.config.ts
index 6c6eb4b984b..19f2074f291 100644
--- a/packages/ui-lib/tsup.config.ts
+++ b/packages/ui-lib/tsup.config.ts
@@ -9,7 +9,7 @@ export default defineConfig((options) => ({
format: ['esm'],
platform: 'browser',
target: ['es2020', 'chrome70', 'edge18', 'firefox70', 'node18'],
- tsconfig: new URL('./tsconfig.build.json', import.meta.url).pathname,
+ tsconfig: new URL('tsconfig.build.json', import.meta.url).pathname,
sourcemap: !options.watch,
minify: !options.watch,
}));