wbuchwalter / tslint-loader

tslint loader for webpack
193 stars 65 forks source link

Ignore tslint #83

Open Yuuki77 opened 7 years ago

Yuuki77 commented 7 years ago

i would really appreciate if there is a way to ignore a paticular file or directory from tsLint

jmlopez-rod commented 7 years ago

Just be explicit and write:

/* tslint:disable */

at the start of the files you don't want to lint.

https://palantir.github.io/tslint/usage/rule-flags/

GrafGenerator commented 6 years ago

I faced issue using tslint-loader along with Angular's AOT compilation. TSLint fails to load ngfactory for app, which exist in virtual filesystem of webpack. At the entry point of AOT I need to do smth like this:

import { enableProdMode } from "@angular/core";
import { platformBrowser } from "@angular/platform-browser";

import { AppModuleNgFactory } from "../../aot/src/startup/app.module.ngfactory";

The issue is that I can't prevent loading that in-memory file, neither by using tslint directives nor using exclude in webpack rules options. Anyway it fails with this output:

ERROR in ./aot/src/startup/app.module.ngfactory.ts
Module build failed: Error: ENOENT: no such file or directory, scandir 'C:\test\aot-example\aot\src\startup'
    at Error (native)
    at Object.fs.readdirSync (fs.js:952:18)
    at findFile (C:\test\aot-example\node_modules\tslint\lib\configuration.js:135:25)
    at findup (C:\test\aot-example\node_modules\tslint\lib\configuration.js:118:19)
    at findConfigurationPath (C:\test\aot-example\node_modules\tslint\lib\configuration.js:95:30)
    at Function.findConfiguration (C:\test\aot-example\node_modules\tslint\lib\configuration.js:48:22)
    at parseConfigFile (C:\test\aot-example\node_modules\tslint-loader\index.js:44:24)
    at resolveOptions (C:\test\aot-example\node_modules\tslint-loader\index.js:35:27)
    at Object.module.exports (C:\test\aot-example\node_modules\tslint-loader\index.js:139:17)
 @ ./src/startup/boot.aot.ts 7:29-82
 @ multi (webpack)-dev-server/client?http://127.0.0.1:8001 ./src/startup/boot.aot.ts

Also, it's worth to mention that boot.aot.ts, which contains that import, excluded from ts build process, so if I disable tslint-loader, all working fine.

Can I workaround this issue somehow? Any help is appreciated.

AlbertJohansson commented 6 years ago

I was experiencing the same issue but was able to get around it by excluding .ngfactory.ts files in the webpack module rules like so:

module: {
    rules: [
        {
            test: /\.ts$/,
            enforce: 'pre',
            loader: 'tslint-loader',
            exclude: [
                /\.ngfactory\.ts$/
            ]
        }
    ]
}