What's the best way to get rid of no-inner-declaratioins eslint error?

Viewed 241

I'm working on a typescript codebase that uses modules in this way.

export module Foo {

    const foos = []

    export function getFoos() {
        return getLastFoo();
    }

    function getLastFoo() {
        return foos[-1]
    }
}

Screenshot of error:

enter image description here

I'm trying to get rid of the no-inner-declarations eslint error. One way I thought of was replacing the modules with classes.

export class Foo {

    static foos = []

    static getFoos() {
        return this.getLastFoo();
    }

    private static getLastFoo() {
        return this.foos[-1]
    }
}

Is there a way to resolve this eslint error without having to change the modules to classes?

0 Answers
Related