Skip to content

Commit

Permalink
add alias
Browse files Browse the repository at this point in the history
  • Loading branch information
thedaviddias committed Jul 26, 2022
1 parent d6f6bd1 commit a3b7dab
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 18 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ module.exports = {
version: 'detect',
},
'import/resolver': {
alias: {
extensions: ['.ts', '.tsx'],
map: [['@', './src']],
},
typescript: {
project: './tsconfig.json',
},
Expand Down
13 changes: 13 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
/** @type {import('next').NextConfig} */
const nextTranslate = require('next-translate')
const path = require('path')

module.exports = nextTranslate({
reactStrictMode: true,
eslint: {
dirs: ['src'],
},
webpack: (config) => {
config.plugins = config.plugins || []

config.optimization.providedExports = true

config.resolve.alias = {
...config.resolve.alias,
'@': path.resolve(__dirname, './src'),
}

return config
},
images: {
domains: ['img.youtube.com', 'media.giphy.com'],
},
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"eslint": "8.19.0",
"eslint-config-next": "12.2.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-import-resolver-typescript": "^3.2.0",
"eslint-module-utils": "^2.7.3",
"eslint-plugin-import": "^2.26.0",
Expand Down
11 changes: 11 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 13 additions & 18 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,55 +18,50 @@
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": ".",
"baseUrl": "./src",
"paths": {
"@/components/*": [
"src/components/*"
"components/*"
],
"@/constants": [
"src/constants"
"constants"
],
"@/contexts/*": [
"src/contexts/*"
"contexts/*"
],
"@/config/*": [
"src/config/*"
"config/*"
],
"@/graphql/*": [
"src/graphql/*"
"graphql/*"
],
"@/generated": [
"src/generated/graphql-types"
"generated/graphql-types"
],
"@/hooks": [
"src/hooks"
"hooks"
],
"@/lib/*": [
"src/lib/*"
"lib/*"
],
"@/pages/*": [
"src/pages/*"
"pages/*"
],
"@/utils/*": [
"src/utils/*"
"utils/*"
],
"@/test-utils": [
"src/tests/test-utils"
"tests/test-utils"
]
}
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"config/next/rewrites.js"
],
"exclude": [
"node_modules",
"cypress",
"config",
"docs",
".storybook",
"src/tests/__mocks__"
"config"
]
}

0 comments on commit a3b7dab

Please sign in to comment.