How to make tslint monitor changes in a specific folder?

I am using webpack 2 and it will tell me if there are compilation problems with my typewritten code. However, I did not find a way to run tslint through it and run it with every change detected by the web package when it runs in dev-server mode.

I tried to make tslint-loader work , but for every file in my project, it just tells me:

/src/main.tsNo valid rules specified

I use this as such:

rules: [
  {
    test: /\.ts$/,
    enforce: 'pre',
    loader: 'tslint-loader',
    options: {
      configuration: {
        configFile: true // I have also tried setting this to "tslint.json"
      }
    }
  },
  ... more loaders...

There is still no joy.

Is there any way:

  1. Can the tslint-loader that I use inform me of lint errors in webpack-dev-server mode every time I make a change?
  2. tslint , "" ? - tslint ./src/**/*.ts -t --force, --watch, tslint.

(, VS Code), . , webpack, package.json.

!

+7
2

script, , npm-watch: https://www.npmjs.com/package/npm-watch.

, , . :

npm-watch :

$ npm install npm-watch --save-dev

package.json :

"watch": {
    "lint": "src/main.ts"
},
"scripts": {
    "lint": "tslint src/**/*.ts -t verbose",
    "watch": "npm-watch"
},

, npm-watch - , , tslint.

Update:

, "" package.json, , , chokidar. , .

package.json:

"scripts": {
    "lint:watch": "chokidar webpack.config.* src/**/*.ts buildScripts/**/*.ts -c \"npm run lint\" --initial --verbose"
},

, -c, , , - .

, :

$ npm run lint:watch

-initial, - .

+13

TypeScript, , , tsc -w .

 "scripts": {
    "start": "tsc -w",
  }
0

Source: https://habr.com/ru/post/1671068/


All Articles