diff --git a/.eslintignore b/.eslintignore
index a1a4e24d2..a1d83eecf 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -4,5 +4,3 @@ dist
docs
node_modules
src/analytics/segment.js
-src/react/PluggableComponent
-src/react/utils/contextFactory
diff --git a/.eslintrc.js b/.eslintrc.js
index 237b4781c..1895af582 100755
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,8 +1,22 @@
+const path = require('path');
// eslint-disable-next-line import/no-extraneous-dependencies
const { getBaseConfig } = require('@openedx/frontend-build');
const config = getBaseConfig('eslint');
+config.settings = {
+ 'import/resolver': {
+ webpack: {
+ config: path.resolve(__dirname, 'webpack.dev.config.js'),
+ },
+ alias: {
+ map: [
+ ['@communications-app', '.'],
+ ],
+ extensions: ['.ts', '.js', '.jsx', '.json'],
+ },
+ },
+};
config.rules = {
'import/no-extraneous-dependencies': ['error', {
devDependencies: [
@@ -12,11 +26,12 @@ config.rules = {
'example/*',
],
}],
+ 'import/prefer-default-export': 'off',
'import/extensions': ['error', {
- ignore: ['@edx/frontend-platform*'],
+ ignore: ['@edx/frontend-platform*', '@openedx/frontend-build*'],
}],
'import/no-unresolved': ['error', {
- ignore: ['@edx/frontend-platform*'],
+ ignore: ['@edx/frontend-platform*', '@openedx/frontend-build*'],
}],
'jsx-a11y/anchor-is-valid': ['error', {
components: ['Link'],
@@ -25,4 +40,13 @@ config.rules = {
}],
};
+config.overrides = [
+ {
+ files: ['plugins/**/*.jsx'],
+ rules: {
+ 'import/no-extraneous-dependencies': 'off',
+ },
+ },
+];
+
module.exports = config;
diff --git a/example/ExamplePage.jsx b/example/ExamplePage.jsx
index e9f0debde..d588a1852 100644
--- a/example/ExamplePage.jsx
+++ b/example/ExamplePage.jsx
@@ -8,7 +8,6 @@ import { ensureConfig, mergeConfig, getConfig } from '@edx/frontend-platform';
import PluggableComponent from '@root_path/src/react/PluggableComponent';
import messages from './messages';
-
mergeConfig({
EXAMPLE_VAR: process.env.EXAMPLE_VAR,
});
@@ -51,11 +50,11 @@ class ExamplePage extends Component {
JS_FILE_VAR var came through: {getConfig().JS_FILE_VAR}
Visit authenticated page.
Visit error page.
-
+ />
);
}
diff --git a/package-lock.json b/package-lock.json
index 2832bec59..439c85b2e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -46,6 +46,9 @@
"@testing-library/react-hooks": "^8.0.1",
"axios-mock-adapter": "^1.21.3",
"core-js": "3.36.0",
+ "eslint-import-resolver-alias": "^1.1.2",
+ "eslint-import-resolver-webpack": "^0.13.8",
+ "eslint-plugin-import": "^2.29.1",
"husky": "8.0.3",
"jsdoc": "^4.0.0",
"nodemon": "3.1.0",
@@ -5920,8 +5923,7 @@
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
- "dev": true,
- "peer": true
+ "dev": true
},
"node_modules/@types/linkify-it": {
"version": "3.0.4",
@@ -6714,7 +6716,6 @@
"resolved": "https://registry.npmjs.org/array.prototype.filter/-/array.prototype.filter-1.0.3.tgz",
"integrity": "sha512-VizNcj/RGJiUyQBgzwxzE5oHdeuXY5hSbbmKMlphj1cy1Vl7Pn2asCGbSrru6hSQjmCzqTBPVWAF/whmEOVHbw==",
"dev": true,
- "peer": true,
"dependencies": {
"call-bind": "^1.0.2",
"define-properties": "^1.2.0",
@@ -6729,12 +6730,26 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/array.prototype.find": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/array.prototype.find/-/array.prototype.find-2.2.2.tgz",
+ "integrity": "sha512-DRumkfW97iZGOfn+lIXbkVrXL04sfYKX+EfOodo8XboR5sxPDVvOjZTF/rysusa9lmhmSOeD6Vp6RKQP+eP4Tg==",
+ "dev": true,
+ "dependencies": {
+ "call-bind": "^1.0.2",
+ "define-properties": "^1.2.0",
+ "es-abstract": "^1.22.1",
+ "es-shim-unscopables": "^1.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/array.prototype.findlastindex": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.4.tgz",
"integrity": "sha512-hzvSHUshSpCflDR1QMUBLHGHP1VIEBegT4pix9H/Z92Xw3ySoy6c2qh7lJWTJnRJ8JCZ9bJNCgTyYaJGcJu6xQ==",
"dev": true,
- "peer": true,
"dependencies": {
"call-bind": "^1.0.5",
"define-properties": "^1.2.1",
@@ -9401,6 +9416,20 @@
"once": "^1.4.0"
}
},
+ "node_modules/enhanced-resolve": {
+ "version": "0.9.1",
+ "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-0.9.1.tgz",
+ "integrity": "sha512-kxpoMgrdtkXZ5h0SeraBS1iRntpTpQ3R8ussdb38+UAFnMGX5DDyJXePm+OCHOcoXvHDw7mc2erbJBpDnl7TPw==",
+ "dev": true,
+ "dependencies": {
+ "graceful-fs": "^4.1.2",
+ "memory-fs": "^0.2.0",
+ "tapable": "^0.1.8"
+ },
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
"node_modules/entities": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
@@ -9502,8 +9531,7 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz",
"integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==",
- "dev": true,
- "peer": true
+ "dev": true
},
"node_modules/es-define-property": {
"version": "1.0.0",
@@ -9742,12 +9770,23 @@
"eslint-plugin-import": "^2.25.2"
}
},
+ "node_modules/eslint-import-resolver-alias": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/eslint-import-resolver-alias/-/eslint-import-resolver-alias-1.1.2.tgz",
+ "integrity": "sha512-WdviM1Eu834zsfjHtcGHtGfcu+F30Od3V7I9Fi57uhBEwPkjDcii7/yW8jAT+gOhn4P/vOxxNAXbFAKsrrc15w==",
+ "dev": true,
+ "engines": {
+ "node": ">= 4"
+ },
+ "peerDependencies": {
+ "eslint-plugin-import": ">=1.4.0"
+ }
+ },
"node_modules/eslint-import-resolver-node": {
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz",
"integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==",
"dev": true,
- "peer": true,
"dependencies": {
"debug": "^3.2.7",
"is-core-module": "^2.13.0",
@@ -9759,17 +9798,76 @@
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
- "peer": true,
"dependencies": {
"ms": "^2.1.1"
}
},
+ "node_modules/eslint-import-resolver-webpack": {
+ "version": "0.13.8",
+ "resolved": "https://registry.npmjs.org/eslint-import-resolver-webpack/-/eslint-import-resolver-webpack-0.13.8.tgz",
+ "integrity": "sha512-Y7WIaXWV+Q21Rz/PJgUxiW/FTBOWmU8NTLdz+nz9mMoiz5vAev/fOaQxwD7qRzTfE3HSm1qsxZ5uRd7eX+VEtA==",
+ "dev": true,
+ "dependencies": {
+ "array.prototype.find": "^2.2.2",
+ "debug": "^3.2.7",
+ "enhanced-resolve": "^0.9.1",
+ "find-root": "^1.1.0",
+ "hasown": "^2.0.0",
+ "interpret": "^1.4.0",
+ "is-core-module": "^2.13.1",
+ "is-regex": "^1.1.4",
+ "lodash": "^4.17.21",
+ "resolve": "^2.0.0-next.5",
+ "semver": "^5.7.2"
+ },
+ "engines": {
+ "node": ">= 6"
+ },
+ "peerDependencies": {
+ "eslint-plugin-import": ">=1.4.0",
+ "webpack": ">=1.11.0"
+ }
+ },
+ "node_modules/eslint-import-resolver-webpack/node_modules/debug": {
+ "version": "3.2.7",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
+ "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
+ "dev": true,
+ "dependencies": {
+ "ms": "^2.1.1"
+ }
+ },
+ "node_modules/eslint-import-resolver-webpack/node_modules/resolve": {
+ "version": "2.0.0-next.5",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz",
+ "integrity": "sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==",
+ "dev": true,
+ "dependencies": {
+ "is-core-module": "^2.13.0",
+ "path-parse": "^1.0.7",
+ "supports-preserve-symlinks-flag": "^1.0.0"
+ },
+ "bin": {
+ "resolve": "bin/resolve"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/eslint-import-resolver-webpack/node_modules/semver": {
+ "version": "5.7.2",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz",
+ "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==",
+ "dev": true,
+ "bin": {
+ "semver": "bin/semver"
+ }
+ },
"node_modules/eslint-module-utils": {
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.1.tgz",
"integrity": "sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==",
"dev": true,
- "peer": true,
"dependencies": {
"debug": "^3.2.7"
},
@@ -9787,7 +9885,6 @@
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
- "peer": true,
"dependencies": {
"ms": "^2.1.1"
}
@@ -9797,7 +9894,6 @@
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz",
"integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==",
"dev": true,
- "peer": true,
"dependencies": {
"array-includes": "^3.1.7",
"array.prototype.findlastindex": "^1.2.3",
@@ -9829,7 +9925,6 @@
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"dev": true,
- "peer": true,
"dependencies": {
"ms": "^2.1.1"
}
@@ -9839,7 +9934,6 @@
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
"integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
"dev": true,
- "peer": true,
"dependencies": {
"esutils": "^2.0.2"
},
@@ -10754,6 +10848,12 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/find-root": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz",
+ "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==",
+ "dev": true
+ },
"node_modules/find-up": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
@@ -12304,6 +12404,15 @@
"node": ">= 0.4"
}
},
+ "node_modules/interpret": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz",
+ "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
"node_modules/intl-messageformat": {
"version": "10.5.8",
"resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-10.5.8.tgz",
@@ -16685,6 +16794,12 @@
"node": ">= 4.0.0"
}
},
+ "node_modules/memory-fs": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.2.0.tgz",
+ "integrity": "sha512-+y4mDxU4rvXXu5UDSGCGNiesFmwCHuefGMoPCO1WYucNYj7DsLqrFaa2fXVI0H+NNiPTwwzKwspn9yTZqUGqng==",
+ "dev": true
+ },
"node_modules/merge-descriptors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
@@ -17459,7 +17574,6 @@
"resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.2.tgz",
"integrity": "sha512-bzBq58S+x+uo0VjurFT0UktpKHOZmv4/xePiOA1nbB9pMqpGK7rUPNgf+1YC+7mE+0HzhTMqNUuCqvKhj6FnBw==",
"dev": true,
- "peer": true,
"dependencies": {
"array.prototype.filter": "^1.0.3",
"call-bind": "^1.0.5",
@@ -22207,6 +22321,15 @@
"integrity": "sha512-QD9qKY3StfbZqWOPLp0++pOrAVb/HbUi5xCc8cUo4XjP19808oaMiDzn0leBY5mCespIBM0CIZePzZjgzR83kA==",
"dev": true
},
+ "node_modules/tapable": {
+ "version": "0.1.10",
+ "resolved": "https://registry.npmjs.org/tapable/-/tapable-0.1.10.tgz",
+ "integrity": "sha512-jX8Et4hHg57mug1/079yitEKWGB3LCwoxByLsNim89LABq8NqgiX+6iYVOsq0vX8uJHkU+DZ5fnq95f800bEsQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
"node_modules/tar-fs": {
"version": "3.0.5",
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.5.tgz",
@@ -22538,7 +22661,6 @@
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz",
"integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==",
"dev": true,
- "peer": true,
"dependencies": {
"@types/json5": "^0.0.29",
"json5": "^1.0.2",
@@ -22551,7 +22673,6 @@
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
"integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
"dev": true,
- "peer": true,
"dependencies": {
"minimist": "^1.2.0"
},
@@ -22564,7 +22685,6 @@
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
"integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==",
"dev": true,
- "peer": true,
"engines": {
"node": ">=4"
}
diff --git a/package.json b/package.json
index b644fb272..1c1554cdc 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,7 @@
"docs": "jsdoc -c jsdoc.json",
"docs-watch": "nodemon -w src -w docs/template -w README.md -e js,jsx --exec npm run docs",
"lint": "fedx-scripts eslint --ext .js --ext .jsx .",
- "lint:fix": "fedx-scripts eslint --fix --ext .js --ext .jsx ./src/react/PluggableComponent",
+ "lint:fix": "fedx-scripts eslint --fix --ext .js --ext .jsx .",
"i18n_extract": "fedx-scripts formatjs extract",
"snapshot": "fedx-scripts jest --updateSnapshot",
"start": "fedx-scripts webpack-dev-server --progress",
@@ -43,6 +43,9 @@
"@testing-library/react-hooks": "^8.0.1",
"axios-mock-adapter": "^1.21.3",
"core-js": "3.36.0",
+ "eslint-import-resolver-alias": "^1.1.2",
+ "eslint-import-resolver-webpack": "^0.13.8",
+ "eslint-plugin-import": "^2.29.1",
"husky": "8.0.3",
"jsdoc": "^4.0.0",
"nodemon": "3.1.0",
diff --git a/plugins/any-mfe-plugins/TestComponent/index.jsx b/plugins/any-mfe-plugins/TestComponent/index.jsx
index 8c5d67e9f..e6dbbcbaf 100644
--- a/plugins/any-mfe-plugins/TestComponent/index.jsx
+++ b/plugins/any-mfe-plugins/TestComponent/index.jsx
@@ -1,11 +1,13 @@
import React from 'react';
import PropTypes from 'prop-types';
-const TestComponent = ({ handleClick, title }) => (
-
-);
+function TestComponent({ handleClick, title }) {
+ return (
+
+ );
+}
TestComponent.defaultProps = {
handleClick: () => {},