wbuchwalter / tslint-loader

tslint loader for webpack
193 stars 65 forks source link

Support query strings for loader options #89

Closed Parasrah closed 6 years ago

Parasrah commented 6 years ago

I am trying to integrate tslint into a Vue project, and am having difficulties getting type checks to work properly 😞

The vue-loader API only supports using a string to specify the loader, as in the following:

{
  test: /\.vue$/,
  loader: 'vue-loader',
  options: {
    loaders: {
      ...utils.cssLoaders({
        sourceMap: isProduction
          ? config.build.productionSourceMap
          : config.dev.cssSourceMap,
        extract: isProduction,
      }),
      ts: 'ts-loader'
    },
    preLoaders: {
      ts: 'tslint-loader?{"options":{"configFile":"tslint.json","tsConfigFile":"tsconfig.json","typeCheck":true}}'
    },
    .
    .
    .
  }
},

As you can see I've tried using query params to solve this problem, but the loader is still complaining that: X rule requires type information

Sorry if this is just a rookie question, I couldn't find documentation for this. Thanks in advance for any assistance!

Parasrah commented 6 years ago

After looking into the source code a little closer it's apparent that you do support query params for the options, and I was merely structuring it incorrectly. For those interested it should have been merely {"configFile":"tslint.json","tsConfigFile":"tsconfig.json","typeCheck":true}.

For those that undoubtedly find this thread with the same intent I had, some bad news. When typeCheck is turned on for vue files the compiler throws a bunch of errors :(