Git Product home page Git Product logo

tslint-loader's Introduction

tslint-loader

Build Status Dependency Status devDependency Status peerDependency Status

Tslint loader for Webpack.

⚠️ TSLint will be deprecated some time in 2019. See this issue for more details: Roadmap: TSLint → ESLint.
As such, users are also encouraged to migrate from tslint-loader to eslint-webpack-plugin

Installation

npm install tslint tslint-loader --save-dev

The package depends on Tslint 4.0+, no longer works with 3.* versions.

Usage

Apply the tslint loader as preLoader in your webpack configuration.

Webpack 4

module.exports = {
    module: {
        rules: [
            {
                test: /\.ts$/,
                enforce: 'pre',
                use: [
                    {
                        loader: 'tslint-loader',
                        options: { /* Loader options go here */ }
                    }
                ]
            }
        ]
    }
}

Webpack 3

module.exports = {
    module: {
        loaders: [
            {
                test: /\.ts$/,
                enforce: 'pre',
                loader: 'tslint-loader',
                options: { /* Loader options go here */ }
            }
        ]
    }
}

Webpack 2

module.exports = {
    module: {
        rules: [
            {
                test: /\.ts$/,
                enforce: 'pre',
                loader: 'tslint-loader',
                options: { /* Loader options go here */ }
            }
        ]
    }
}

Webpack 1

module.exports = {
    module: {
        preLoaders: [
            {
                test: /\.ts$/,
                loader: 'tslint-loader'
            }
        ]
    },

    tslint: { /* Loader options go here */ }
}

Loader options

{
    configuration: {
        rules: {
            quotemark: [true, 'double']
        }
    },
    
    // can specify a custom config file relative to current directory or with absolute path
    // 'tslint-custom.json'
    configFile: false,
    
    // tslint errors are displayed by default as warnings
    // set emitErrors to true to display them as errors
    emitErrors: false,
    
    // tslint does not interrupt the compilation by default
    // if you want any file with tslint errors to fail
    // set failOnHint to true
    failOnHint: true,
    
    // enables type checked rules like 'for-in-array'
    // uses tsconfig.json from current working directory
    typeCheck: false,
    
    // automatically fix linting errors
    fix: false,
    
    // can specify a custom tsconfig file relative to current directory or with absolute path
    // to be used with type checked rules
    tsConfigFile: 'tsconfig.json',
    
    // name of your formatter (optional)
    formatter: 'yourformatter',
    
    // path to directory containing formatter (optional)
    formattersDirectory: 'node_modules/tslint-loader/formatters/',
    
    // These options are useful if you want to save output to files
    // for your continuous integration server
    fileOutput: {
        // The directory where each file's report is saved
        dir: './foo/',
    
        // The extension to use for each report's filename. Defaults to 'txt'
        ext: 'xml',
    
        // If true, all files are removed from the report directory at the beginning of run
        clean: true,
    
        // A string to include at the top of every report file.
        // Useful for some report formats.
        header: '<?xml version="1.0" encoding="utf-8"?>\n<checkstyle version="5.7">',
    
        // A string to include at the bottom of every report file.
        // Useful for some report formats.
        footer: '</checkstyle>'
    }
}

License

MIT

tslint-loader's People

Contributors

bhovhannes avatar claudiordgz avatar cryptiklemur avatar dpopescu avatar jhuntoo avatar jkillian avatar joshuacc avatar jskrzypek avatar juanpicado avatar kukkimonsuta avatar mohamedmansour avatar niksudan avatar pepaar avatar s4kr4 avatar sonicoder86 avatar sshev avatar timse avatar use-strict avatar vishnuvardhan-s avatar wbuchwalter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tslint-loader's Issues

Error after update

I was using the version 1.0.2 and after updating for 2.1.3 start having this error on gulp serve

stream.js:94
throw er; // Unhandled stream error in pipe.
^
Error: Cannot find module 'tslint'

I've tried installing tslint which I didn't need before and got this error
stream.js:94
throw er; // Unhandled stream error in pipe.
^
Error: ./src/app/app.ts
Module build failed: Error: Could not find the following rules specified in the configuration:
no-trailing-comma
at Object.loadRules (/Users/danielmariz/www/distrix-admin/node_modules/tslint/lib/ruleLoader.js:29:15)
at Linter.lint (/Users/danielmariz/www/distrix-admin/node_modules/tslint/lib/tslint.js:24:44)
at Object.lint (/Users/danielmariz/www/distrix-admin/node_modules/tslint-loader/index.js:63:23)
at Object.module.exports (/Users/danielmariz/www/distrix-admin/node_modules/tslint-loader/index.js:151:8)

back to old version everything is fine.

Add support for enabling type-checked rules.

TSLint recently gained some new rules that require type-checking to be enabled. This requires that the compiled program be passed in to the linter like so.

I'm sorry, I don't know enough (anything) about the internals of webpack or tslint so I am unable to submit a PR. Maybe this commit from gulp-tslint will contain useful information?

Add caching abilities.

It would be good, If this loader cache to filesystem linting results and reuse them between build. Same thing implemented in babel-loader.

Use tslint.json file for configuration?

Is there a way I have can my tslint configuration in a seperate file so other tools may use it as well? Most tooling expects the file to be named tslint.json. I tried

	tslint: {
		failOnHint: true,
	   	require('./tslint.json')
	},

But when I run webpack, I get an 'unexpected string' error at the require line.

Tslint should be of version 4+

I tried to update tslint to version 5.0.0, but I got an error on build

ERROR in ./src/polyfills.browser.ts
Module build failed: Error: Tslint should be of version 4+
at Object.module.exports (\node_modules\tslint-loader\index.js:121:11)
@ multi (webpack)-dev-server/client?./src/polyfills.browser.ts

version of tslint-loader: 3.4.3

[UNMAINTAINED] Looking for contributors

Hi,

I would like to know whether you have a plan to continue maintaining this package sometime later or maybe could transfer the ownership to someone who is more motivated to merge pull requests (two are currently waiting for approval), fix bugs like #34 and implement new features.

Currently tslint-loader is widely used (more than 200 thousands downloads on npm and dependents like Angular CLI) and it will not a good idea to abandon it's development

Only output warnings for changed files

Is there any way to make sure that we only output warnings for changed files during an incremental build? I'm trying to introduce linting to an existing codebase and would like engineers to only worry about the parts they're changing.

tslint-loader doesn't handle rulesDirectory field of tslint.json correctly

If a user specifies a path(s) to custom rule directories in their tslint.json file, tslint-loader does not correctly pass this to TSLint.

The issue is that the options object that gets passes in the line var linter = new Linter(this.resourcePath, input, options); is structured incorrectly.

Right now it's structured as this:

{
  configuration: {
    rulesDirectory: ...
  },
  ...
}

when the actual correct structure is like this:

{
  configuration: {
    rulesDirectory: ...  // it's okay if this isn't here
  },
  rulesDirectory: ...
}

At first this may seem like a bug on the end of TSLint - why doesn't TSLint correctly handle the first case? The issue is a little subtle - paths specified in a tslint.json file are relative to the location of the tslint.json. So TSLint has no way to resolve those paths when provided via the JS API. When TSLint loads a tslint.json file on its own, it can resolve the paths because it knows the location of the tslint.json file.

To fix this, you can use the getRulesDirectories(paths, basePath) function provided by TSLint to resolve paths from a tslint.json file and then provide the paths at the top-level of the options object

DeprecationWarning: loaderUtils.parseQuery()

I get this warning when running a build using v3.4.2:

DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.

See: webpack/loader-utils#56

Comments in tslint.json

Comments in tslint.json no longer work as of version 2.1.5.

Module build failed: SyntaxError: Unexpected token /
    at Object.parse (native)
    at loadConfigurationFromPath (node_modules\tslint\lib\configuration.js:81:21)
    at Object.findConfiguration (node_modules\tslint\lib\configuration.js:39:12)
    at Object.loadRelativeConfig (node_modules\tslint-loader\index.js:22:34)
    at Object.module.exports (node_modules\tslint-loader\index.js:102:35)
 @ multi app

It worked fine in version 2.1.4.

Update documentation for Webpack 2

Webpack 2 is released and it has a lot of changes in configuration which are not reflected in README. Currently it is unclear without searching through migration guides what to do with "tslint" property in webpack.config file

exclude node_modules

Hi there,

Is there a way to exclude the node_modules directory. I cannot fix all the tslint issues I load with npm install ....

Thanks,
Martin

Generate single JSON out file

Is it possible to generate a single outfile as JSON? Similar to the command:

tslint --force --format json --config tslint.json --out ./dist/tslintResults.json Test.ts Test2.ts

Source map merging problem

Hello,

I'm trying to build a upgrade basic angular workflow based on gulp to webpack, and I'm having sourcemap issues: I end up having the base *.ts sources referenced 2 times and it seems to be due to the tslint-loader preloader (I have no issues when I remove it).

I tried many config changes, but so far no luck.

Any ideas?

Here is my config:

'use strict';

var path = require('path');
var gulp = require('gulp');
var conf = require('../gulpfile.config');
var webpack = require('webpack-stream');
var browserSync = require('browser-sync');

var $ = require('gulp-load-plugins')();

function buildScripts(watch, test, done) {
  var options = {
    resolve: {
      root: conf.src,
      modulesDirectories: [
        '.',
        'main',
        'modules',
        'libraries'
      ],
      extensions: ['', '.ts']
    },
    watch: watch,
    devtool: watch || test ? 'inline-source-map' : undefined,
    module: {
      preLoaders: [{
        test: /\.ts$/,
        exclude: /node_modules/,
        loader: 'tslint-loader'
      }],
      loaders: [
        {
          test: /\.ts$/,
          exclude: /node_modules/,
          loaders: ['ng-annotate', 'awesome-typescript-loader']
        },
        {
          test: /\.html$/,
          loader: 'raw!html-minify'
        },
        {
          test: /\.po$/,
          loader: 'angular-gettext?module=translations'
        }
      ]
    },
    output: {
      filename: 'app.ts.js',
      devtoolModuleFilenameTemplate: '[resource-path]',
      devtoolFallbackModuleFilenameTemplate: '[resource-path]?[hash]'
    },
    'html-minify-loader': {
      empty: true,
      cdata: true,
      comments: true,
      conditionals: true,
      quotes: true,
      dom: {
        lowerCaseAttributeNames: false,
        lowerCaseTags: false
      }
    },
    tslint: {
      emitErrors: true
    }
  };

  var changeHandler = function(err, stats) {
    if (err) {
      conf.errorHandler('Webpack')(err);
    }

    $.util.log(stats.toString({
      colors: $.util.colors.supportsColor,
      chunks: false,
      hash: false,
      version: false
    }));

    browserSync.reload();

    if (watch) {
      console.log('yeah!');
      watch = false;
      done();
    }
  };

  var sources = [
    path.join(conf.paths.src, '**/*.ts'),
    path.join(conf.paths.src, 'translations/*.po'),
    path.join('!' + conf.paths.bower, '/**/*.ts')
  ];

  if (!test) {
    sources.push(path.join('!' + conf.paths.src, '/**/*.spec.ts'));
    sources.push(path.join('!' + conf.paths.src, '/**/*.mock.ts'));
  }

  return gulp.src(sources)
    .pipe(webpack(options, null, changeHandler))
    .pipe(gulp.dest(path.join(conf.paths.tmp)));
}

gulp.task('scripts', function() {
  return buildScripts(false, false);
});

gulp.task('scripts:watch', function(done) {
  return buildScripts(true, false, done);
});

gulp.task('scripts:test', function() {
  return buildScripts(false, true);
});

gulp.task('scripts:test-watch', function(done) {
  return buildScripts(true, true, done);
});

Here is the version of the packages I'm using:

"awesome-typescript-loader": "^0.17.0-rc.1",
"ng-annotate-loader": "^0.1.0",
"raw-loader": "^0.5.1",
"tslint": "^3.6.0",
"tslint-loader": "^2.1.3",
"typescript": "^1.8.9",
 "webpack-stream": "^3.1.0",

The generated sourcemaps by tslint have this suffix:

[code]

/** WEBPACK FOOTER **
 ** ./~/tslint-loader!./sources/main/main.config.ts
 **/

Whereas the "good" sourcemaps have this suffix:

[code]

/** WEBPACK FOOTER **
 ** ./sources/main/main.config.ts
 **/

Seems it may be a path issue?

tslint:recommended and tslint:latest do not work

Bug Report

  • TSLint version: 3.14.0
  • TypeScript version: 2.1.5

TypeScript code being linted

function hello(foo: string) {
  const str : string = 'bar' + foo;
  if (str)
    console.log('blah')
  console.log(str);
}

hello("foo")

with tslint webpack configuration:

tslint: {
    configuration: {
      "extends": "tslint:latest"
    }
}

Actual behavior

no warning are being reported

Expected behavior

warning should be printed in the terminal and console.

I tried both tslint:latest and tslint:recommended but neither worked. If I add the following to my config then I get an error for my curly braces:

rules: {curly: true}

Weird warnings/errors in webpack output

I'm getting a lot of these sorts warnings in my wepback output with [email protected] & [email protected]:

WARNING in ../ui/components/modal/components/dialog-actionsheet/dialog-actionsheet.component.ts


 @ ../ui/components/modal/index.ts 12:9-80
 @ ../app/shared/maps/maps.component.ts
 @ ../app/dashboard/menu/menu.component.ts
 @ ./module.ts
 @ ./bootstrap.ts

They appear to be empty. I tried reverting the changes in my PR that fixed the NonErrorEmittedErrors from webpack, but that just wrapped the empty warnings in NonErrorEmittedErrors...

I'm guessing this might be an interaction between tslint-loader & tslint^5? Not really sure where to start investigating.

typeCheck is too slow

The typeCheck option makes builds extremely slow because the Program is recreated for each file.

gulp-tslint solves this by forcing the user to pass the Program in as part of the configuration. I think the same could be done here by replacing the typeCheck with a program option? Or maybe allow passing the Program instead of a boolean to the typeCheck? Otherwise it will have to be cached somehow across files.

Write lint output to file?

I've looked over the documentation and didn't see this option, but please let me know if I just missed it.

It would be great if the loader could write lint output to a file for use on a CI server. I'd be happy to submit a pull request adding this functionality.

Thoughts?

should we support tslint@next ?

This issue has been created to continue discussion opened at pull request #55, which tried to fix issue #53 .

In order to keep master branch clean all changes from PR #55 were moved into new dev branch.

If we decided to have 2 release channels, stable channel will be published from master branch and unstable (potentially) dev channel will be published from dev branch.
If we decided to have 1 release channel and support both stable and *-dev versions of tslint, we can just merge that dev branch into master.
If we decided to support only stable versions of tslint, we can just delete that dev branch.

Specify custom tslint file

This may already exist but could not see it in the README.md. Is there a way to specify a custom location for the tsling.json file?

At the moment, it'll default to tslint.json in the root, but it would be good to be able to specify a path.

Thanks for the great loader!

Error Consuming a TypeScript Dependency

I have a project with peer scoped packages, and was hoping to be able to avoid running a compile step in one, or order to do development on the other, but webpack is bombing out with this error:

ERROR in ./~/@my-scope/components/index.ts
Module build failed: Error
    at new FatalError (C:\devel\repos\@my-scope\demo-site\node_modules\tslint\lib\error.js:40:23)
    at Function.findConfiguration (C:\devel\repos\@my-scope\demo-site\node_modules\tslint\lib\configuration.js:47:15)
    at resolveOptions (C:\devel\repos\@my-scope\demo-site\node_modules\tslint-loader\index.js:35:64)
    at Object.module.exports (C:\devel\repos\@my-scope\demo-site\node_modules\tslint-loader\index.js:124:17)
 @ ./src/app/app.module.ts 16:23-55
 @ ./src/main.ts
 @ multi app

loader config:

{
  test: /\.ts$/,
  enforce: 'pre',
  use: 'tslint-loader',
}

excluding /node_modules/ in the loader makes the webpack build run fine, but I assume means I won't be linting that dependency anymore. I can lint it other times/ways, but it's nice to be able to npm link and work in both scoped packages using one dev-server.

using

"tslint": "^4.3.1",
"tslint-loader": "^3.3.0",

How to add external ESLint configs?

It looks like there is support for ESLint. Can someone help me include the Google JS style guide?
I installed the dependencies as defined here: https://github.com/google/eslint-config-google

Updated my tslint.json file to this:

{
  "extends": ["tslint:recommended", "google"],
  "rules": {
    "quotemark": [true, "single", "avoid-escape"]
  }
}

This results in build errors.
Sorry, first time webpack user....

Use loader with tslint@next

I am fine with typescript@next and tslint@next, but tslint-loader's peerDependency blocks me. As for now I need to maintain fork. Could you either remove peerDependency from this loader, or publish separate version without it?

Support multiple reporters

Related to #7: It would also be nice to be able to have a normal console reporter and a file-based reporter run at the same time. Presumably it could be done by having tslint-loader supply its own format method, which would then delegate to the others.

modules not loaded

If I have something like this:

index.ts:

export const foo: MyModule.MyFoo = null;

and

myFoo.ts:

module MyModule {
  export interface MyFoo { /*...*/ }
}

ts-loader will not check whatever errors are inside the myFoo files. This happens becuase actually myFoo.ts is not imported. What's the best way to check referenced modules?

Enable greenkeeper

greenkeeper is awesome. Let's enable it on this repo to simplify dependency upgrades

Lint.Configuration.parseConfigFile Does Not Resolve "extends"

All,

After struggling to understand to understand why tslint-loader would not honor the "extends" directive in my tslint.config it appears that I've been able to isolate the cause.

index.js

function parseConfigFile(webpackInstance, configFile, options) {
  if (!options.configuration) {
    return Lint.Linter.findConfiguration(configFile, webpackInstance.resourcePath).results;
  }

  if (semver.satisfies(Lint.Linter.VERSION, '>=5.0.0')) {      
    Lint.Configuration.parseConfigFile(options.configuration);
  }

  return options.configuration;
}

My version of tslint is 5.4.0 and I am using a tslint.json located at my root which looks like this:

{
  "extends": [
    "tslint:recommended"
  ],
  "rules": {    
  }
}

Therefore the code will use Lint.Configuration.parseConfigFile to parse the config file. The problem is that in tslint (at least in 5.4.0) parseConfigFile does not traverse and resolve any of the rules provided via the "extends" option. I was able to fix this by using Lint.Configuration.loadConfigurationFromPath; the changed code looks like this:

function parseConfigFile(webpackInstance, configFile, options) {
  if (!options.configuration) {
    return Lint.Linter.findConfiguration(configFile, webpackInstance.resourcePath).results;
  }

  if (semver.satisfies(Lint.Linter.VERSION, '>=5.0.0')) {      
    return Lint.Configuration.loadConfigurationFromPath(configFile,configFile);
  }

  return options.configuration;
}

Using the above fix everything appears to work properly. Also worth mentioning is that in the tslint codebase parseConfigFile is only use internally by loadConfigurationFromPath...

Three questions:

  1. Has nobody else run into this issue??
  2. Am I completely doing something wrong or crazy...?
  3. If not, should I do a pull request...?

Warning "Cannot read property 'exports' of undefined" when running with type checking

When I enable typeCheck: true, in my tslint-loader configuration, Webpack suddenly outputs

Warning: Cannot read property 'exports' of undefined

I'm not running into this when I simply run tslint --project tsconfig.json --type-check.

Unfortunately, there's not much more info, but if there's any relevant debugging information I can gather, let me know.

merge method turns arrays into objects

For example, "quotemark": [ true, "single" ] will be turned into "quotemark": { 0: true, 1: "single" }.
The abstractRule's isEnabled check would fail because it's checking to see if value is an Array with Array.isArray(value).
These rules would be treated as disabled.

tslint-loader unexpected token

Ouput of webpack:

ERROR in ./server/index.ts
Module parse failed: /home/ubuntu/workspace/node_modules/tslint-loader/index.js!/home/ubuntu/workspace/server/index.ts Unexpected token (22:7)
You may need an appropriate loader to handle this file type.
| // Catch 404 and forward to error handler
| app.use((
| req: express.Request,
| res: express.Response,
| next: express.NextFunction) => {

If I take out the typing, leaving it just as:
app.use((req, res, next) => {
then everything is fine.

According to the TS docs [https://www.typescriptlang.org/docs/handbook/tsconfig-json.html], I shouldn't need to do anything with the old way of installing typings, typings install etc. I know I'm using beta for webpack but figured I'd get ahead 😄

./package.json:
"@types/body-parser": "0.0.33",
"@types/debug": "0.0.29",
"@types/express": "4.0.34",
"@types/morgan": "1.7.32",
"@types/node": "6.0.49",
"awesome-typescript-loader": "3.0.0-beta.3",
"tslint": "3.15.1",
"tslint-loader": "2.1.5",
"typescript": "2.0.10",
"webpack": "2.1.0-beta.27"

./config/webpack.config.js:
const webpack = require('webpack');
const plugins = [];

plugins.push(
new webpack.LoaderOptionsPlugin({
options: {
tslint: {
emitErrors: true,
failOnHint: true
}
}
})
);

module.exports = {
entry: {
server: './bin/www.ts'
},
output: {
filename: '[name].js',
path: './build',
libraryTarget: "commonjs"
},
devtool: 'source-map',
target: 'node',
externals: [
/^[a-z-0-9]+$/ // Ignore node_modules folder
],
resolve: {
// Add in .ts as a resolvable extension.
extensions: ['.ts'],
},
resolveLoader: {
modules: ['./node_modules']
},
module: {
rules: [{
enforce: 'pre',
test: /.ts$/,
loader: 'tslint-loader',
exclude: /(node_modules)/
}],
loaders: [{
test: /.ts$/,
exclude: [/node_modules/],
loader: 'awesome-typescript-loader'
}]
},
plugins
};

./tsconfig.json:
{
"compilerOptions": {
"module": "commonjs",
"target": "node",
"sourceMap": true,
"outDir": "build"
},
"exclude": [
"node_modules",
"build",
"config",
"release"
]
}

node_modules is in ./node_modules with all the @types in there ok.

fails if you lack module.exports.tslint.configuration (if you put your tslint config in a separate file)

this fails with tslint 3.15.x and tslint 4.0.x

// on 4.0.x
Module build failed: TypeError: Cannot read property 'findConfiguration' of undefined
at resolveOptions (.../node_modules/tslint-loader/index.js:28:63)

// on 3.15.x
Module build failed: TypeError: Cannot read property 'findConfiguration' of undefined
at resolveOptions (.../node_modules/tslint-loader/index.js:26:63)

Workaround is to have an empty configuration object in webpack.config.js
(at module.exports.tslint.configuration)

Interfaces not checked?

Hi,

the tslint-loader doen't check Rules in my typescript interfaces:

import {Component} from '@angular/core';
export interface Test {
  Test : string;
}

Running tslint standalone results in two warnings:

src/app/home/home.interface.ts[1, 9]: Unused import: 'Component'
src/app/home/home.interface.ts[4, 7]: expected nospace before colon in property-declaration

I use emitErrors: true and failOnHint: true to break the build. But during the webpack build with tslint-loader as a preloader no warnings/errors are emitted for violations in interfaces.

ERROR Module build failed: TypeError: ruleConfiguration.forEach is not a function

Getting an error when running Webpack.

ERROR in ./src/index.ts
Module build failed: TypeError: ruleConfiguration.forEach is not a function
    at Object.convertRuleOptions (/Users/colin/Projects/CMS-Web/node_modules/tslint/lib/configuration.js:357:23)
    at Linter.getEnabledRules (/Users/colin/Projects/CMS-Web/node_modules/tslint/lib/linter.js:194:47)
    at Linter.lint (/Users/colin/Projects/CMS-Web/node_modules/tslint/lib/linter.js:76:33)
    at lint (/Users/colin/Projects/CMS-Web/node_modules/tslint-loader/index.js:58:10)
    at Object.module.exports (/Users/colin/Projects/CMS-Web/node_modules/tslint-loader/index.js:128:3)

My Webpack config us just

{
        test: /\.ts$/,
        exclude: /node_modules/,
        loader: 'tslint-loader',
        enforce: 'pre'
},

tslint version: 5.1.0
tslint-loader version: 3.5.2
Webpack version: 2.4.1

webpack 2.1.0-beta.25 support ?

Hi.

I have a webpack 1.13.1 configuration that I try to convert to webpack 2.1.0-beta.25 configuration.

the preLoaders related configuration, I changed to loaders configuration with 'pre' set for enforce.
what I get left is the tslint configuration part.

now when I try to build the webpack project with 'npm run build' I get

For loader options: webpack 2 no longer allows custom properties in configuration.
Loaders should be updated to allow passing options via loader options in module.rules.

which means that I have to configure it somewhere else.. no idea where though. any ideas?

more information at http://stackoverflow.com/questions/39919793/tslint-loader-with-webpack-2-1-0-beta-25

thanks

Enable ESLint

It will be nice to add ESLint to this project.

It is not that big to benefit from ES6, so I don't think we need to bring in additional transpilation step. But having ESLint checks will ensure consistent coding standards for this repo.

Rules may extends eslint-config-recommended and use eslint-env=node.

Mention dependency on tslint

This may seem obvious, but... tslint-loader depends on tslint, and it is not listed anywhere in documentation.

The error (Cannot find module tslint) sounds almost like tslint-loader is broken and it takes as moment to realize what's actually going on. Could this be listed in a requirements section in the readme?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.