Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add no-commonjs-exports-with-import rule #902

Closed

Commits on Jul 25, 2017

  1. Add no-commonjs-exports-with-import rule

    We want to start using Webpack to resolve imports instead of Babel. One
    key difference is that Webpack will break the bundle if you use `import`
    in the same file that `module.exports` is used, but it will appear to
    build pretty alright. When this happens, webpack outputs a warning like:
    
    ```
    WARNING in ./foo.js
    4:12-13 "export 'default' (imported as 'bar') was not found in './bar'
    ```
    
    And when the JS is run in the browser, an error like the following is
    logged:
    
    ```
    Uncaught TypeError: Cannot assign to read only property 'exports' of
    object '#<Object>'
    ```
    
    To make this safer to turn on, I am adding this
    no-commonjs-exports-with-import rule which reports when it encounters an
    `import` in the same file as a CommonJS `module.exports` or `exports.*`.
    lencioni committed Jul 25, 2017
    Configuration menu
    Copy the full SHA
    d064150 View commit details
    Browse the repository at this point in the history