{"id":20625,"library":"tslint-loader","title":"tslint-loader","description":"Webpack loader for TSLint, version 3.5.4, last updated in 2019. Integrates TSLint into webpack build pipeline to lint TypeScript files during compilation. Supports custom config files, type-checked rules, formatters, and file output. Compatible with webpack 1-4, but requires TSLint >=4.0.0. Key differentiator: seamlessly adds linting as a pre-loader step in webpack, with options to emit errors or fail builds on hints. Less active now due to TSLint deprecation in favor of ESLint with TypeScript.","status":"maintenance","version":"3.5.4","language":"javascript","source_language":"en","source_url":"https://github.com/wbuchwalter/tslint-loader","tags":["javascript","tslint","typescript","webpack","loader","linting"],"install":[{"cmd":"npm install tslint-loader","lang":"bash","label":"npm"},{"cmd":"yarn add tslint-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add tslint-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for linting functionality","package":"tslint","optional":false}],"imports":[{"note":"This is a webpack loader, not a JavaScript import. It is referenced by name in webpack configuration.","wrong":"import tslintLoader from 'tslint-loader'","symbol":"tslint-loader","correct":"// In webpack config, use loader string 'tslint-loader'"}],"quickstart":{"code":"// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.ts$/,\n        enforce: 'pre',\n        use: [\n          {\n            loader: 'tslint-loader',\n            options: {\n              configFile: 'tslint.json',\n              emitErrors: true,\n              failOnHint: true,\n              typeCheck: true,\n              tsConfigFile: 'tsconfig.json'\n            }\n          }\n        ]\n      }\n    ]\n  }\n}","lang":"javascript","description":"Configures tslint-loader as a pre-loader in webpack to lint all .ts files before compilation, with options for type checking and error handling."},"warnings":[{"fix":"Use eslint-loader with @typescript-eslint/parser and @typescript-eslint/eslint-plugin.","message":"TSLint is deprecated in favor of ESLint with TypeScript. Consider migrating to eslint-loader or @typescript-eslint.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Update TSLint to version 4.0.0 or higher.","message":"Requires TSLint >=4.0.0, not compatible with TSLint 3.x.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Set enforce: 'pre' in the rule configuration.","message":"The loader must be applied as a pre-loader using 'enforce: pre' to ensure it runs before compilation.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Use appropriate configuration syntax for your webpack version.","message":"Webpack 1 uses 'preLoaders' and 'tslint' config property, while webpack 2+ uses 'rules'.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Ensure tsconfig.json exists and contains necessary compiler options.","message":"Setting 'typeCheck: true' requires a valid tsconfig.json file and may slow down compilation.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use webpack 3 or lower, or switch to eslint-loader.","cause":"Incompatibility with webpack 4+ due to deprecated API.","error":"Module build failed: TypeError: loader.runAsChild is not a function"},{"fix":"Run 'npm install --save-dev tslint tslint-loader'.","cause":"tslint-loader not installed or not in node_modules.","error":"Error: Could not load tslint-loader: The loader name is not recognized."},{"fix":"Set configFile to a string like 'tslint.json' or false.","cause":"configFile option expects a string path, but received another type.","error":"TypeError: configFile is not a string"},{"fix":"Run 'npm install --save-dev tslint'.","cause":"Missing peer dependency tslint.","error":"Error: Cannot find module 'tslint'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}