-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 multiple new rules for "import" statements #806
Comments
In the whole test suite, there were only two failures:
require('./styles.styl')
import React from 'react'
import {render} from 'react-dom'
import AmpRouter from 'ampersand-router'
import HomePage from './home-page'
import OtherPage from './other-page'
import Collection from '..'
import Index from '../index' Can some folks who use the |
I went ahead and merged all these rules for the standard v10 beta. I'm hoping to get some real-world usage from folks who have super large codebases using all the latest stuff, ES7+, babel, etc. If anything breaks, we can back out these rules in a future v10 beta release. (Keeping this issue open for visibility.) |
Addition sounds good to me. As about 1) - I don't see any sense to use require there. Maybe it is using Webpack v1 which was not working with import/export syntax, so this exact As about 2) make absolutely sense to error in that case. And preventing that is the right move. |
ACK |
ACK |
In order to fix #599, we will depend on
eslint-plugin-import
in standard v10. This opens the possibility of enabling additional rules related toimport
andrequire()
.The full list of rules is here: https://github.com/benmosher/eslint-plugin-import#rules
Many rules depend on how the files are loaded in the particular project, and I think we ought to avoid those rules since that will lead to some folks with complicated webpack loader rules unable to use
standard
without us exposing configuration options. And we don't want to go there.So, of all the rules in there, these ones looked good to me:
import/no-duplicates
- better version of coreno-duplicates
rule which works with flow-typeimport/export
- Reports funny business with exports, like repeated exports of names or defaultsimport/first
- This rule reports any imports that come after non-import statementsimport/no-absolute-path
- Forbid absolute imports likerequire('/home/xyz/file.js')
import/no-webpack-loader-syntax
- Forbid Webpack loader syntax in importsThoughts welcome.
The text was updated successfully, but these errors were encountered: