wbuchwalter / tslint-loader

tslint loader for webpack
193 stars 65 forks source link

Warning: The 'no-array-mutation' rule requires type information. #107

Open rickyhopkins opened 5 years ago

rickyhopkins commented 5 years ago

I am using some additional plugins for tslint which require type information which is usually provided using the --project 'tsconfig.json' flag. tslint-loader does not seem to be providing this flag.

The docs state that you can provide a tsConfigFile in the options object.

This is my webpack 4 config rule:

{
    test: /\.(ts|tsx)$/,
    enforce: "pre",
    use: [
        {
            loader: "tslint-loader",
            options: {
                tsConfigFile: paths.appTsDevConfig // Absolute path to tsconfig.json
            }
        }
    ]
};

But no matter what I pass through to tslint-loader I still get the same error: Warning: The 'no-array-mutation' rule requires type information.

If I run tslint manually with tslint "src/**.tsx" --project tsconfig.json it works without errors, but if I leave off the project flag it will return the same error that tslint-loader is returning.

frewsxcv commented 5 years ago

my understanding is you'd need to provide the typeCheck: true config option to ts-loader, at the cost of tslint running slower