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

Require types to be declared at the top of the file (after import) #168

Closed
gajus opened this issue Dec 5, 2016 · 2 comments
Closed

Require types to be declared at the top of the file (after import) #168

gajus opened this issue Dec 5, 2016 · 2 comments

Comments

@gajus
Copy link
Owner

gajus commented Dec 5, 2016

Please describe what the rule should do:

Require that all type declarations appear at the top of the file, first thing after any import declarations.

What category of rule is this? (place an "X" next to just one item)

[x] Enforces code style
[ ] Warns about a potential error
[ ] Suggests an alternate way of doing something
[ ] Other (please specify:)

Provide 2-3 code examples that this rule will warn about:

Good:

import createAsyncTracker from '../createAsyncTracker';
import type {
  AdType
} from '../types';

type Unit = {|
  prefix: string,
  ignoreSuffix?: Array<string>,
  size: string,
  id: string,
  max?: number
|};

Bad:

import createAsyncTracker from '../createAsyncTracker';
import type {
  AdType
} from '../types';

const foo = 'bar';

type Unit = {|
  prefix: string,
  ignoreSuffix?: Array<string>,
  size: string,
  id: string,
  max?: number
|};
@gajus
Copy link
Owner Author

gajus commented Dec 5, 2016

@danharper Might be a good idea to create an issue template, like ESLint does:

Do you want me to create one?

Is the above information sufficient? (This issue)

@danharper
Copy link
Collaborator

👍 on an issue template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants