Skip to content

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

@gajus

Description

@gajus

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions