Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .eslintrc.diff.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const path = require('path');

// Additional eslint rules specific to the Authoring MFE, which only run on modified files.

module.exports = {
rules: {
'no-restricted-imports': ['error', {
patterns: [
{
// Ban injectIntl() HOC
group: ['@edx/frontend-platform/i18n'],
importNames: ['injectIntl'],
message: "Use 'useIntl' hook instead of injectIntl.",
},
{
// Ban connect()/mapStateToProps/mapDispatchToProps HOC pattern
group: ['react-redux'],
importNames: ['connect'],
message: "Use 'useDispatch' and 'useSelector' hooks instead of 'connect'.",
},
// In the near future we will require 'propTypes' to be removed from all modified code too:
// {
// group: ['prop-types'],
// message: 'Use TypeScript types instead of propTypes.',
// },
],
}],
// Ban 'defaultProps' from any modified code.
'react/require-default-props': ['error', { functions: 'defaultArguments' }],
},
settings: {
// Import URLs should be resolved using aliases
'import/resolver': {
webpack: {
config: path.resolve(__dirname, 'webpack.dev.config.js'),
},
},
},
};
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ validate:
make validate-no-uncommitted-package-lock-changes
npm run i18n_extract
npm run lint -- --max-warnings 0
npm run lint:diff
npm run types
npm run test:ci
npm run build
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"stylelint": "stylelint \"plugins/**/*.scss\" \"src/**/*.scss\" \"scss/**/*.scss\" --config .stylelintrc.json",
"lint": "npm run stylelint && fedx-scripts eslint --ext .js --ext .jsx --ext .ts --ext .tsx .",
"lint:fix": "npm run stylelint -- --fix && fedx-scripts eslint --fix --ext .js --ext .jsx --ext .ts --ext .tsx .",
"lint:diff": "git diff --name-only master | grep -E '^src/.*(\\.jsx?$|\\.tsx?)$' | xargs fedx-scripts eslint --config .eslintrc.diff.js",
"start": "fedx-scripts webpack-dev-server --progress",
"start:with-theme": "paragon install-theme && npm start && npm install",
"dev": "PUBLIC_PATH=/authoring/ MFE_CONFIG_API_URL='http://localhost:8000/api/mfe_config/v1' fedx-scripts webpack-dev-server --progress --host apps.local.openedx.io",
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"include": [
"*.js",
".eslintrc.js",
".eslintrc.diff.js",
"src/**/*",
"plugins/**/*"
],
Expand Down