Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Alias component and hook paths

dominik-zeglenf75fbcf3136a
diff --git a/package-lock.json b/package-lock.json
index d294e70d2a..3e02e9fe81 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6855,6 +6855,12 @@
"integrity": "sha512-/UMY+2GkOZ27Vrc51pqC5J8SPd39FKt7kkoGAtWJ8s4msj0b15KehDWIiJpWY3/7tLxBQLLzJhIBhnEsXdzpgw==",
"dev": true
},
+ "@types/json5": {
+ "version": "0.0.29",
+ "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
+ "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=",
+ "dev": true
+ },
"@types/jss": {
"version": "9.5.8",
"resolved": "https://registry.npmjs.org/@types/jss/-/jss-9.5.8.tgz",
@@ -31758,6 +31764,59 @@
}
}
},
+ "tsconfig-paths": {
+ "version": "3.8.0",
+ "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.8.0.tgz",
+ "integrity": "sha512-zZEYFo4sjORK8W58ENkRn9s+HmQFkkwydDG7My5s/fnfr2YYCaiyXe/HBUcIgU8epEKOXwiahOO+KZYjiXlWyQ==",
+ "dev": true,
+ "requires": {
+ "@types/json5": "^0.0.29",
+ "deepmerge": "^2.0.1",
+ "json5": "^1.0.1",
+ "minimist": "^1.2.0",
+ "strip-bom": "^3.0.0"
+ },
+ "dependencies": {
+ "deepmerge": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-2.2.1.tgz",
+ "integrity": "sha512-R9hc1Xa/NOBi9WRVUWg19rl1UB7Tt4kuPd+thNJgFZoxXsTz7ncaPaeIm+40oSGuP33DfMb4sZt1QIGiJzC4EA==",
+ "dev": true
+ },
+ "json5": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
+ "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.0"
+ }
+ },
+ "minimist": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
+ "dev": true
+ },
+ "strip-bom": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
+ "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
+ "dev": true
+ }
+ }
+ },
+ "tsconfig-paths-webpack-plugin": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/tsconfig-paths-webpack-plugin/-/tsconfig-paths-webpack-plugin-3.2.0.tgz",
+ "integrity": "sha512-S/gOOPOkV8rIL4LurZ1vUdYCVgo15iX9ZMJ6wx6w2OgcpT/G4wMyHB6WM+xheSqGMrWKuxFul+aXpCju3wmj/g==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.3.0",
+ "enhanced-resolve": "^4.0.0",
+ "tsconfig-paths": "^3.4.0"
+ }
+ },
"tslib": {
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.2.tgz",
diff --git a/package.json b/package.json
index d2c005e1ed..86c2ce5cf4 100644
--- a/package.json
+++ b/package.json
@@ -150,6 +150,7 @@
"sass-loader": "^7.1.0",
"ts-jest": "^23.10.5",
"ts-loader": "^5.3.2",
+ "tsconfig-paths-webpack-plugin": "^3.2.0",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0",
"webpack": "^4.27.0",
diff --git a/tsconfig.json b/tsconfig.json
index 5f0dfdb3c4..b101fd8c1b 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,10 +1,16 @@
{
"compilerOptions": {
+ "baseUrl": ".",
"jsx": "react",
"lib": ["es2017", "dom", "esnext"],
"sourceMap": true,
"target": "es5",
"noUnusedLocals": true,
- "noUnusedParameters": true
- }
+ "noUnusedParameters": true,
+ "paths": {
+ "@components/*": ["./saleor/static/dashboard-next/components/*"],
+ "@hooks/*": ["./saleor/static/dashboard-next/hooks/*"]
+ }
+ },
+ "exclude": ["node_modules"]
}
diff --git a/tslint.json b/tslint.json
index 5937341663..75592ca712 100644
--- a/tslint.json
+++ b/tslint.json
@@ -1,14 +1,11 @@
{
- "extends": [
- "tslint:latest",
- "tslint-config-prettier"
- ],
+ "extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"interface-name": false,
"max-classes-per-file": false,
"member-access": [true, "no-public"],
"no-console": [true, "log"],
- "no-implicit-dependencies": [true, "dev"],
+ "no-implicit-dependencies": false,
"no-shadowed-variable": false,
"no-submodule-imports": [true, "@material-ui"]
}
diff --git a/webpack.config.js b/webpack.config.js
index 272618c998..73b8fbe8e7 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -5,6 +5,7 @@ const path = require('path');
const url = require('url');
const webpack = require('webpack');
const BundleTracker = require('webpack-bundle-tracker');
+const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const resolve = path.resolve.bind(path, __dirname);
@@ -20,6 +21,10 @@ const providePlugin = new webpack.ProvidePlugin({
'query-string': 'query-string'
});
+const pathsPlugin = new TsconfigPathsPlugin({
+ configFile: './tsconfig.json'
+});
+
const checkerPlugin = new CheckerPlugin({
reportFiles: ['saleor/**/*.{ts,tsx}'],
tslint: true
@@ -138,7 +143,10 @@ module.exports = (env, argv) => {
alias: {
jquery: resolve('node_modules/jquery/dist/jquery.js')
},
- extensions: ['.ts', '.tsx', '.js', '.jsx']
+ extensions: ['.ts', '.tsx', '.js', '.jsx'],
+ plugins: [
+ pathsPlugin
+ ]
},
devtool: 'sourceMap'
};