create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

Add lint rule to disallow `require.ensure`

Open Timer opened this issue 9 years ago • 3 comments

We need a lint rule that will error when require.ensure is used. Users should use import() instead.

Timer avatar Feb 11 '17 07:02 Timer

I would like to work on this.

Apparently, there is no such a rule comes with eslint-plugin-import. So I'll send a PR to eslint-plugin-import repo first and update eslint-config-react-app accordingly. Is that the correct path to take on this issue? (I'm asking this because I'm new to open source and this project)

tharakawj avatar Feb 12 '17 04:02 tharakawj

Per https://github.com/benmosher/eslint-plugin-import/issues/743#issuecomment-279203692, eslint core already supports no-restricted-properties which can easily block both require.ensure and System.import.

ljharb avatar Feb 12 '17 08:02 ljharb

@ljharb Thanks for pointing it out. I'll use no-restricted-properties rule and send a PR.

tharakawj avatar Feb 12 '17 08:02 tharakawj