[llvm-bugs] [Bug 39872] New: JavaScript imports not grouped unless out of order

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Dec 3 10:54:32 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=39872

            Bug ID: 39872
           Summary: JavaScript imports not grouped unless out of order
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nathanlehrer at google.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

When JS imports are out of order and have no grouping, they are put in the
correct order and empty lines are added in between external, different folder,
and same folder groups. However, when they are in the right order but have no
empty lines for grouping, no empty lines are added.

For example:

import {c} from './c';
import {a} from 'a';
import {b} from '../b';

becomes

import {a} from 'a';

import {b} from '../b';

import {c} from './c';

but

import {a} from 'a';
import {b} from '../b';
import {c} from './c';

doesn't change.

It seems like clang-format should format imports the same way regardless of how
the programmer decided to do it. This also is causing problems for certain
people using clang-format in combination with TypeScript's Organize Imports.

I wonder if this line
(https://github.com/llvm-mirror/clang/blob/f3b7928366f63b51ffc97e74f8afcff497c57e8d/lib/Format/SortJavaScriptImports.cpp#L169)
could just be removed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181203/4877ed1a/attachment.html>


More information about the llvm-bugs mailing list