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

Organize imports #2125

Merged
merged 8 commits into from
Mar 2, 2017
Merged

Organize imports #2125

merged 8 commits into from
Mar 2, 2017

Conversation

mauriciovieira
Copy link
Contributor

  1. remove unused imports
  2. organize imports (sort and unify comments)
  3. remove unused eslint-disable

closes #2107

@mauriciovieira
Copy link
Contributor Author

@apinf/developers please review

@mauriciovieira
Copy link
Contributor Author

mauriciovieira commented Feb 15, 2017

Notice I standardized the first comments with:

// Meteor packages imports

// Npm packages imports

// Collection imports

// APINF imports

The imports follow this order unless they break eslint

@brylie
Copy link
Contributor

brylie commented Feb 15, 2017

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.

@brylie brylie self-assigned this Feb 15, 2017
@brylie
Copy link
Contributor

brylie commented Feb 15, 2017

The Meteor Guide also recommends using explicit imports for Meteor libraries:

it is recommended best practice that you first load all the Meteor “pseudo-globals” using the import { Name } from 'meteor/package' syntax before using them.

Meteor Guide: Application Structure - Importing Meteor “pseudo-globals”

@mauriciovieira
Copy link
Contributor Author

What I mind mostly is the consistency. Before we started to run eslint (a month ago) we had meteor imports only in some files.

@brylie
Copy link
Contributor

brylie commented Feb 15, 2017

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.

@mauriciovieira
Copy link
Contributor Author

No problem, I'll write some script to put them back (removing using sed was easy).
I spent a few hours yesterday sorting and commenting all files and won't like to waste this work.

@brylie
Copy link
Contributor

brylie commented Feb 15, 2017

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).

@mauriciovieira
Copy link
Contributor Author

@brylie
Copy link
Contributor

brylie commented Feb 20, 2017

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.

@brylie brylie modified the milestone: Sprint 37 Feb 27, 2017
@mauriciovieira
Copy link
Contributor Author

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
- Identify which packages are missing
- Make eslint to ignore scripts/ directory
@mauriciovieira
Copy link
Contributor Author

@brylie I rebased the commits.

I standardized the first comments with:

// Meteor packages imports

// Meteor contributed packages imports

// Npm packages imports

// Collection imports

// APINF imports

Also, I noticed some broken references in the develop branch and fixed them.

Please review.

@mauriciovieira
Copy link
Contributor Author

'Add meteor env to eslintrc' is not a suitable description for this work. It's better to call it 'Organize imports'. I renamed it

@mauriciovieira mauriciovieira changed the title Add meteor env to eslintrc Organize imports Mar 2, 2017
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';
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

import { SimpleSchema } from 'meteor/aldeed:simple-schema';

// Npm packages imports
import ApiKeys from './';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collection imports here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

// 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';
Copy link
Contributor

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

Copy link
Contributor Author

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';
import { check } from 'meteor/check';


import Apis from '/apis/collection';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collection imports here

Copy link
Contributor Author

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';


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excessive new line

Copy link
Contributor Author

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';


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excessive new line

Copy link
Contributor Author

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';


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excessive new line

Copy link
Contributor Author

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';

import { Modal } from 'meteor/peppelg:bootstrap-3-modal';

import Feedback from '../../collection';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collection imports here

Copy link
Contributor Author

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';

import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import Feedback from './';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collection imports here

Copy link
Contributor Author

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';


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excessive new line

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💥

Copy link
Contributor Author

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';
Copy link
Contributor

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

Copy link
Contributor Author

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 :-)

import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excessive new line

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔨

Copy link
Contributor Author

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';


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excessive new line

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌜

Copy link
Contributor Author

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';
import { Template } from 'meteor/templating';


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excessive new line

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📟

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

@brylie brylie assigned marla-singer and unassigned brylie Mar 2, 2017
@mauriciovieira
Copy link
Contributor Author

@marla-singer Thank you so much for catching these errors.
Please review again.

@marla-singer marla-singer merged commit 0e3430b into develop Mar 2, 2017
@marla-singer marla-singer deleted the feature/eslint-meteor-env branch March 2, 2017 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Organize imports after linting the code.
3 participants