Skip to content

Commit ce55de2

Browse files
tharakawjgaearon
authored andcommitted
Add lint rule to disallow require.ensure and System.import (facebook#1536)
1 parent 5b9284b commit ce55de2

File tree

1 file changed

+9
-0
lines changed
  • packages/eslint-config-react-app

1 file changed

+9
-0
lines changed

packages/eslint-config-react-app/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@ module.exports = {
155155
'unicode-bom': ['warn', 'never'],
156156
'use-isnan': 'warn',
157157
'valid-typeof': 'warn',
158+
'no-restricted-properties': ['error', {
159+
object: 'require',
160+
property: 'ensure',
161+
message: 'Please use import() instead. More info: https://webpack.js.org/guides/code-splitting-import/#dynamic-import'
162+
}, {
163+
object: 'System',
164+
property: 'import',
165+
message: 'Please use import() instead. More info: https://webpack.js.org/guides/code-splitting-import/#dynamic-import'
166+
}],
158167

159168
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/
160169

0 commit comments

Comments
 (0)