Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
541 views
in Technique[技术] by (71.8m points)

tslint - TypeScript linter warning: no-unused-variable is deprecated; but I'm not using this config

Today I see this warning in a project being refreshed after 3 months.

no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.

But my tsconfig.json does not seem to use this.

{
  "compilerOptions": {
    "lib": ["es6"],
    "module": "commonjs",
    "noImplicitReturns": true,
    "outDir": "lib",
    "sourceMap": true,
    "target": "es6",
    "allowJs" : true
  },
  "compileOnSave": true,
  "include": [
    "src"
  ]
}

Probably it's a config implicit in any of the previous configs.

Could you point me to what to do to fix it?

If usefull

$ node -v
v10.3.0
$ npm -v
6.1.0

And these are devDependencies relates to type script in my package.json

"devDependencies": {
    ...
    "tslint": "^5.11.0",
    "typescript": "^2.9.1"
    ...
  },
question from:https://stackoverflow.com/questions/51621162/typescript-linter-warning-no-unused-variable-is-deprecated-but-im-not-using-t

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.

  1. Remove deprecated no-unused-variable from your or dependency tslint.json file.

  2. Specify the following compiler options in your tsconfig.json file.

"compilerOptions": {
  "noUnusedLocals": true,                /* Report errors on unused locals. */
  "noUnusedParameters": true             /* Report errors on unused parameters. */
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...