From 09cfcde0183d4c900490913da1f2c7c1ad473c0d Mon Sep 17 00:00:00 2001 From: Tharaka Wijebandara Date: Fri, 24 Feb 2017 22:59:45 +0530 Subject: [PATCH] Add lint rule to disallow require.ensure and System.import (#1536) --- packages/eslint-config-react-app/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/eslint-config-react-app/index.js b/packages/eslint-config-react-app/index.js index d93478bc8c9..e5d9ef894b0 100644 --- a/packages/eslint-config-react-app/index.js +++ b/packages/eslint-config-react-app/index.js @@ -155,6 +155,15 @@ module.exports = { 'unicode-bom': ['warn', 'never'], 'use-isnan': 'warn', 'valid-typeof': 'warn', + 'no-restricted-properties': ['error', { + object: 'require', + property: 'ensure', + message: 'Please use import() instead. More info: https://webpack.js.org/guides/code-splitting-import/#dynamic-import' + }, { + object: 'System', + property: 'import', + message: 'Please use import() instead. More info: https://webpack.js.org/guides/code-splitting-import/#dynamic-import' + }], // /~https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/