Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd multiple new rules for "import" statements #806
Comments
feross
added
the
enhancement
label
Mar 2, 2017
feross
added this to the
standard v10 milestone
Mar 2, 2017
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
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.) |
feross
added
the
need more info
label
Mar 2, 2017
This comment has been minimized.
This comment has been minimized.
tunnckoCore
commented
Mar 2, 2017
•
|
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. |
This comment has been minimized.
This comment has been minimized.
|
ACK |
feross
added a commit
to standard/eslint-config-standard
that referenced
this issue
Mar 2, 2017
feross
added a commit
to standard/eslint-config-standard
that referenced
this issue
Mar 2, 2017
feross
added a commit
to standard/eslint-config-standard
that referenced
this issue
Mar 2, 2017
feross
added a commit
to standard/eslint-config-standard
that referenced
this issue
Mar 2, 2017
This comment has been minimized.
This comment has been minimized.
|
ACK |
feross commentedMar 2, 2017
•
edited
In order to fix #599, we will depend on
eslint-plugin-importin standard v10. This opens the possibility of enabling additional rules related toimportandrequire().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
standardwithout 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-duplicatesrule 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.