SeinopSys/eslint-plugin-import-newlines

Semicolon preference ignored in fix application calulculation

SeinopSys opened this issue · 0 comments

The current logic does not account for potentially forcing semicolons on each line, which means that if e.g. a set of imports on multiple lines was exactly 141 characters long in a single line with a semicolon, then the autofix will erroneously force it onto a single line without accounting for the existing semicolon and omitting it from the replacement.

Example:

import {
    aaaaaaaaaaa,
    aaaaaaaaaaaaaaaaaaa,
    aaaaaaaaaaaaa
} from './aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';

Gets autofixed to

import { aaaaaaaaaaa, aaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaa } from './aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'

Either the fix should be made a suggestion (which is not applied automatically) or an option should be added to specify semicolon requirements