infctr / eslint-plugin-typescript-sort-keys

A linter plugin to require sorting interface and string enum keys
ISC License
147 stars 28 forks source link

Fix objects must not be overlapped in a report #52

Open zachbryant opened 2 years ago

zachbryant commented 2 years ago

Hi, I'm receiving this error when I uncomment the interface rule in my eslint config.

yarn 1.22.11 eslint 8.17.0 eslint-plugin-typescript-sort-keys 2.1.0

The offending line: 'typescript-sort-keys/interface': 'warn',

A sample of the input file (it's really long, and I also can't share it directly)

declare namespace A {
    interface Ab extends b {
        d: string;
        n: number;
    }
    interface Ac<T> {
        d: any[];
        t: T;
        type: string;
    }
    interface D {
        /* a comment */
    }
}

declare namespace A.G {
    interface P<T> extends PromiseLike<T> {
        then<U>(
            hello?: (_: T) => P<U>,
            world?: (_: any) => P<U>,
            something?: (_: any) => void,
        ): P<U>;
        cancel(): void;
    }
    type H = P<void>;

    namespace Hello {
        interface V<T> extends Array<T> {
            a(
                value: T,
                ...extra: any[]
            ): { _: number; _1: boolean }
        }
        namespace Z {
            /** Specifies the type of activation. */
            enum ZZ {
                a, b, c
            }
            abstract class J {
                hello: string:
            }
        }
    }
}

What I see:

$ eslint . --ext .ts,.tsx,.js,.jsx --fix --ignore-path ../../../.eslintignore

Oops! Something went wrong! :(

ESLint: 8.17.0

AssertionError [ERR_ASSERTION]: Fix objects must not be overlapped in a report.
    at mergeFixes (C:\Users\me\repo\node_modules\eslint\lib\linter\report-translator.js:167:9)
    at normalizeFixes (C:\Users\me\repo\node_modules\eslint\lib\linter\report-translator.js:197:16)
    at C:\Users\me\repo\node_modules\eslint\lib\linter\report-translator.js:364:49
    at Object.report (C:\Users\me\repo\node_modules\eslint\lib\linter\linter.js:1085:41)
    at C:\Users\me\repo\node_modules\eslint-plugin-typescript-sort-keys\lib\index.cjs.js:296:25
    at TSTypeLiteral (C:\Users\me\repo\node_modules\eslint-plugin-typescript-sort-keys\lib\index.cjs.js:395:24)    
    at ruleErrorHandler (C:\Users\me\repo\node_modules\eslint\lib\linter\linter.js:1114:28)
    at C:\Users\me\repo\node_modules\eslint\lib\linter\safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (C:\Users\me\repo\node_modules\eslint\lib\linter\safe-emitter.js:45:38)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.