Skip to content

Commit

Permalink
feat: initial config for UI slot
Browse files Browse the repository at this point in the history
  • Loading branch information
johnvente committed Mar 13, 2024
1 parent 35415fe commit bb6138c
Show file tree
Hide file tree
Showing 8 changed files with 530 additions and 195 deletions.
27 changes: 27 additions & 0 deletions config/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
const fs = require('fs');
const path = require('path');
const { babel } = require('../lib/presets');

const defaultWebpackConfigPath = path.resolve(process.cwd(), './webpack.dev.config.js');
const webpackConfigPath = fs.existsSync(defaultWebpackConfigPath) ? defaultWebpackConfigPath : path.resolve(__dirname, './webpack.dev.config.js');

module.exports = {
extends: '@edx/eslint-config',
parser: '@babel/eslint-parser',
Expand All @@ -9,6 +14,19 @@ module.exports = {
configFile: babel.resolvedFilepath || babel.defaultFilepath,
},
},
settings: {
'import/resolver': {
webpack: {
config: webpackConfigPath,
},
alias: {
map: [
['@root_path', path.resolve(process.cwd(), '.')],
],
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
},
},
},
rules: {
'import/no-extraneous-dependencies': [
'error',
Expand All @@ -35,7 +53,16 @@ module.exports = {
}],
'import/no-import-module-export': 'off',
'react/function-component-definition': [2, { namedComponents: 'arrow-function' }],
'import/prefer-default-export': 'off',
},
overrides: [
{
files: ['**/plugins/**/*.jsx'],
rules: {
'import/no-extraneous-dependencies': 'off',
},
},
],
globals: {
newrelic: false,
},
Expand Down
2 changes: 2 additions & 0 deletions config/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ module.exports = {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': path.resolve(__dirname, 'jest/fileMock.js'),
'\\.(css|scss)$': 'identity-obj-proxy',
'env.config': envConfigPath,
'@node_modules/(.*)': '<rootDir>/node_modules/$1',
'@root_path/(.*)': '<rootDir>/$1',
},
collectCoverageFrom: [
'src/**/*.{js,jsx}',
Expand Down
4 changes: 3 additions & 1 deletion config/webpack.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ module.exports = {
resolve: {
alias: {
'env.config': path.resolve(process.cwd(), './env.config'),
'@node_modules': path.join(process.cwd(), 'node_modules'),
'@root_path': path.join(process.cwd(), '.'),
},
fallback: {
// This causes the system to return an empty object if it can't find an env.config.js file in
// the application being built.
'env.config': false,
},
extensions: ['.js', '.jsx'],
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
ignoreWarnings: [
// Ignore warnings raised by source-map-loader.
Expand Down
7 changes: 6 additions & 1 deletion config/webpack.dev-stage.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ module.exports = merge(commonConfig, {
publicPath: PUBLIC_PATH,
},
resolve: {
alias: aliases,
alias: {
...aliases,
'@node_modules': path.join(process.cwd(), 'node_modules'),
'@root_path': path.join(process.cwd(), '.'),
},
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
module: {
// Specify file-by-file rules to Webpack. Some file-types need a particular kind of loader.
Expand Down
6 changes: 5 additions & 1 deletion config/webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ module.exports = merge(commonConfig, {
publicPath: PUBLIC_PATH,
},
resolve: {
alias: aliases,
alias: {
...aliases,
'@node_modules': path.join(process.cwd(), 'node_modules'),
'@root_path': path.join(process.cwd(), '.'),
},
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
module: {
Expand Down
7 changes: 7 additions & 0 deletions config/webpack.prod.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ module.exports = merge(commonConfig, {
path: path.resolve(process.cwd(), 'dist'),
publicPath: process.env.PUBLIC_PATH || '/',
},
resolve: {
alias: {
'@node_modules': path.join(process.cwd(), 'node_modules'),
'@root_path': path.join(process.cwd(), '.'),
},
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
module: {
// Specify file-by-file rules to Webpack. Some file-types need a particular kind of loader.
rules: [
Expand Down
Loading

0 comments on commit bb6138c

Please sign in to comment.