Skip to content

Commit b09c6fc

Browse files
committed
chore: Start migrating toward next js files
1 parent 57d9776 commit b09c6fc

File tree

100 files changed

+4255
-5096
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+4255
-5096
lines changed

.eslintrc.js

+66-45
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,72 @@
1-
/* eslint-disable @typescript-eslint/no-var-requires */
2-
const config = require('@inpyjamas/scripts/dist/config/eslint/typescript');
3-
const { merge } = require('@inpyjamas/scripts/dist/utlities/merge');
4-
5-
module.exports = merge(config, {
1+
module.exports = {
2+
root: true,
63
env: {
7-
'jest/globals': true,
84
node: true,
9-
browser: true,
10-
},
11-
settings: {
12-
react: {
13-
version: 'detect',
14-
},
5+
es6: true,
6+
jest: true,
157
},
16-
// parser: 'babel-eslint',
17-
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
188
parserOptions: {
19-
ecmaVersion: 2020,
20-
sourceType: 'module',
21-
ecmaFeatures: {
22-
modules: true,
23-
jsx: true,
9+
ecmaVersion: 8,
10+
project: "./tsconfig.json",
11+
tsconfigRootDir: "./",
12+
}, // to enable features such as async/await
13+
ignorePatterns: ["node_modules/*", ".next/*", ".out/*", "!.prettierrc.js"], // We don't want to lint generated files nor node_modules, but we want to lint .prettierrc.js (ignored by default by eslint)
14+
extends: ["eslint:recommended"],
15+
overrides: [
16+
// This configuration will apply only to TypeScript files
17+
{
18+
plugins: ["@typescript-eslint", "import"],
19+
files: ["**/*.ts", "**/*.tsx", "**/*.mdx"],
20+
parser: "@typescript-eslint/parser",
21+
settings: {
22+
react: { version: "detect" },
23+
"import/parsers": {
24+
"@typescript-eslint/parser": [".ts", ".tsx"],
25+
},
26+
"import/resolver": {
27+
typescript: {
28+
alwaysTryTypes: true,
29+
},
30+
},
31+
},
32+
env: {
33+
browser: true,
34+
node: true,
35+
es6: true,
36+
},
37+
extends: [
38+
"eslint:recommended",
39+
"plugin:@typescript-eslint/recommended", // TypeScript rules
40+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
41+
"plugin:react/recommended", // React rules
42+
"plugin:react-hooks/recommended", // React hooks rules
43+
"plugin:jsx-a11y/recommended", // Accessibility rules
44+
"plugin:prettier/recommended", // Prettier recommended rules
45+
],
46+
rules: {
47+
// We will use TypeScript's types for component props instead
48+
"react/prop-types": "off",
49+
50+
// No need to import React when using Next.js
51+
"react/react-in-jsx-scope": "off",
52+
53+
// This rule is not compatible with Next.js's <Link /> components
54+
"jsx-a11y/anchor-is-valid": "off",
55+
56+
// Why would you want unused vars?
57+
"@typescript-eslint/no-unused-vars": ["error"],
58+
59+
// I suggest this setting for requiring return types on functions only where useful
60+
"@typescript-eslint/explicit-function-return-type": [
61+
"warn",
62+
{
63+
allowExpressions: true,
64+
allowConciseArrowFunctionExpressionsStartingWithVoid: true,
65+
},
66+
],
67+
"prettier/prettier": ["error", {}, { usePrettierrc: true }], // Includes .prettierrc.js rules
68+
"import/no-unresolved": "error",
69+
},
2470
},
25-
allowImportExportEverywhere: true,
26-
},
27-
extends: [
28-
'eslint:recommended',
29-
'plugin:react/recommended',
30-
'plugin:@typescript-eslint/recommended',
31-
'plugin:promise/recommended',
32-
'plugin:jest/recommended',
33-
'prettier',
3471
],
35-
rules: {
36-
'require-top-level-describe': 'off',
37-
'jest/no-hooks': 'error',
38-
'no-unused-vars': 'off',
39-
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
40-
'react/prop-types': 'off',
41-
'no-var': 'error',
42-
'prettier/prettier': 'error',
43-
'jest/consistent-test-it': [
44-
'error',
45-
{ fn: 'test', withinDescribe: 'test' },
46-
],
47-
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
48-
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
49-
},
50-
plugins: ['promise', 'react', 'jest', 'prettier', 'react-hooks'],
51-
});
72+
};

.importjs.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
moduleNameFormatter({ pathToImportedModule }) {
3+
return pathToImportedModule
4+
.replace('./src/components/', '@components/')
5+
.replace('./src/common/', '@common/')
6+
.replace('./src/utils/', '@utils/')
7+
.replace('./src/state/', '@state/')
8+
.replace('./src/assets/', '@assets/')
9+
.replace(/\.ts$/gs, '');
10+
},
11+
};

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14.19.1
1+
18.12.0

.storybook/preview.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ const withStoreProvider = (Story, context) => {
3030
const withAuth0Provider = (Story, context) => {
3131
return (
3232
<Auth0Provider
33-
domain={process.env.AUTH0_DOMAIN}
34-
clientId={process.env.AUTH0_CLIENT_ID}
35-
audience={process.env.AUTH0_AUDIENCE}
36-
redirectUri={window.location.origin}
33+
domain={process.env.NEXT_PUBLIC_AUTH0_DOMAIN}
34+
clientId={process.env.NEXT_PUBLIC_AUTH0_CLIENT_ID}
35+
audience={process.env.NEXT_PUBLIC_AUTH0_AUDIENCE}
36+
redirectUri={process.env.NEXT_PUBLIC_BASE_URL}
3737
>
3838
<Story {...context} />
3939
</Auth0Provider>

babel.config.js

-13
This file was deleted.

create-env.js

-15
This file was deleted.

netlify.toml

-32
This file was deleted.

next-env.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/image-types/global" />
3+
4+
// NOTE: This file should not be edited
5+
// see https://nextjs.org/docs/basic-features/typescript for more information.

next.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
reactStrictMode: false,
4+
compiler: {
5+
styledComponents: true,
6+
},
7+
// swcMinify: false,
8+
};
9+
10+
module.exports = nextConfig;

0 commit comments

Comments
 (0)