Skip to content

Organize imports in files nicely #148

Open
@Martinsos

Description

@Martinsos

Start with external imports at top, then more and more internal ones. Put newlines between the groups.

Example:

import { foo } from 'some-npm-package';
import axios from 'axios';

import { bar } from 'wasp';
import { something } from 'wasp/auth';

import { coolStuff } from '../../utils';
import { someOtherStuff } from '../../utils/specific';

import { bla } from './neighbouring-module';
import { blabla } from './stuff';

// And now here starts the code

We could even force this with linter (linters have support for this stuff!) but that would be quite prescriptive so we don't have to do it (although they can remove it if they don't like it hm! Maybe we can do it). But even if we don't make linter do this, we can just make sure it is at least nice at the start and they can then to what they want.

But actually enabling this in linter also now sounds quite attractive to me, why not?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions