-
Notifications
You must be signed in to change notification settings - Fork 35
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
Organize imports #2125
Organize imports #2125
Conversation
1eac760
to
9d8ba9e
Compare
@apinf/developers please review |
Notice I standardized the first comments with:
The imports follow this order unless they break eslint |
I am wondering whether removing all of these explicit imports is the 'right thing to do'. In other words, it may be useful, and at some point necessary, to explicitly import Meteor components. Consistency with imports also helps our developers to better understand how things are connected, and is a common practice with other frameworks that don't have such a 'magical' environment as Meteor. |
The Meteor Guide also recommends using explicit imports for Meteor libraries:
|
What I mind mostly is the consistency. Before we started to run eslint (a month ago) we had meteor imports only in some files. |
Yes, for the same reason we had lint in most files. In effect, the strict import has not been a problem for the duration of our development, and has only recently been caught by the linter. Hence, the work in progress towards consistent use of explicit imports -- while this PR effectively reverses our work in progress. |
No problem, I'll write some script to put them back (removing using sed was easy). |
Cool. I am not trying to give you grief. I'm just clarifying a direction we are heading, based on the recommendation of the Meteor Guide (as well as the eslint-airbnb style from which we inherit most of our lint rules). |
Use node to reinsert the import statements http://nicolashery.com/parse-data-files-using-nodejs-streams/ (https://github.com/nicolashery/example-stream-parser/blob/master/lib/parser.js) |
Is this ready for review? It might be easier to just create a new branch, since most of the changes were unnecessary. Also, I am not sure we should add 'meteor' to the eslint environment, since it might discourage developers from being explicit about Meteor imports. |
92426f8
to
2a46bc1
Compare
I prefer not undoing the manual work I've done to comment and sort all imports. I wanted to work on a script to automatically fix the meteor no-undef. This script might be useful. I am still working on that. |
1. remove unused imports 2. organize imports (sort and unify comments) 3. remove unused eslint-disable closes #2107
3763173
to
7852a7c
Compare
- Identify which packages are missing - Make eslint to ignore scripts/ directory
7852a7c
to
2ea9ce6
Compare
@brylie I rebased the commits. I standardized the first comments with:
Also, I noticed some broken references in the develop branch and fixed them. Please review. |
'Add meteor env to eslintrc' is not a suitable description for this work. It's better to call it 'Organize imports'. I renamed it |
import { Meteor } from 'meteor/meteor'; | ||
import { Template } from 'meteor/templating'; | ||
|
||
import Apis from '/apis/collection'; | ||
// Meteor contributed packages imports | ||
import ApiKeys from '/api_keys/collection'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. Looks like it's Collection imports
not Meteor contributed packages imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
api_keys/collection/schema.js
Outdated
import { SimpleSchema } from 'meteor/aldeed:simple-schema'; | ||
|
||
// Npm packages imports | ||
import ApiKeys from './'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collection imports
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
apis/client/profile/intro/intro.js
Outdated
// Allow use of 'document' as global object | ||
/* global document */ | ||
// Meteor packages imports | ||
import { Template } from 'meteor/templating'; | ||
|
||
// Meteor imports | ||
import { TAPi18n } from 'meteor/tap:i18n'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meteor contributed packages imports
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
apis/server/methods/status.js
Outdated
import { Meteor } from 'meteor/meteor'; | ||
import { check } from 'meteor/check'; | ||
|
||
|
||
import Apis from '/apis/collection'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collection imports
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
import { Meteor } from 'meteor/meteor'; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excessive new line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
import { Template } from 'meteor/templating'; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excessive new line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
import { ReactiveVar } from 'meteor/reactive-var'; | ||
import { Template } from 'meteor/templating'; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excessive new line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
feedback/client/list/list.js
Outdated
import { Template } from 'meteor/templating'; | ||
|
||
import { Modal } from 'meteor/peppelg:bootstrap-3-modal'; | ||
|
||
import Feedback from '../../collection'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collection imports
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
feedback/collection/schema.js
Outdated
import { Meteor } from 'meteor/meteor'; | ||
|
||
import { SimpleSchema } from 'meteor/aldeed:simple-schema'; | ||
import Feedback from './'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collection imports
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
home/client/footer/homeFooter.js
Outdated
import { Template } from 'meteor/templating'; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excessive new line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💥
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
@@ -0,0 +1,28 @@ | |||
// Meteor packages imports | |||
import { Template } from 'meteor/templating'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mauriciovieira removed_selected_proxy
folder was deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, thanks for catching this :-)
status/client/status.js
Outdated
import { Meteor } from 'meteor/meteor'; | ||
import { Template } from 'meteor/templating'; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excessive new line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
status/server/status.js
Outdated
import { Meteor } from 'meteor/meteor'; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excessive new line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🌜
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
users/client/profile/profile.js
Outdated
import { Meteor } from 'meteor/meteor'; | ||
import { Template } from 'meteor/templating'; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excessive new line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📟
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
@marla-singer Thank you so much for catching these errors. |
closes #2107