codemod-imports-sort icon indicating copy to clipboard operation
codemod-imports-sort copied to clipboard

Moves comment line

Open winkler1 opened this issue 3 years ago • 0 comments

Nice tool! One issue: I use flow, so there's a /* @flow */ comment in the 1st line of source files.

Before:

/* @flow */
import calcDropTargetClass from "../common/calcDropTargetClass";
import classNames from "classnames";
import dropSourceInTarget from "../StandardShow/dropSourceInTarget";
import { DropTarget } from "react-dnd";
import React from "react";
import SearchTypes from "../../constants/SearchTypes";

After:

import classNames from "classnames";
import React from "react";
import { DropTarget } from "react-dnd";
import SearchTypes from "../../constants/SearchTypes";
/* @flow */
import calcDropTargetClass from "../common/calcDropTargetClass";
import dropSourceInTarget from "../StandardShow/dropSourceInTarget";

Looks like it's keeping comments above their following import, but moving the comment messes things up. Maybe special-case and keep /* flow */ at top?

winkler1 avatar Dec 09 '20 10:12 winkler1