Detect deprecated API usage

Viewed 418

Could you advice me how to turn on deprecated API detection in TypeScript project? I use Visual Studio Code. What I already did:

  • installed eslint: yarn add eslint -D
  • installed eslint-plugin-deprecate: yarn add eslint-plugin-deprecate -D
  • installed typescript-eslint: yarn add -D typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin
  • created a .eslintrc file with the following content:
{
    "plugins": [
        "@typescript-eslint",
        "deprecate"
    ],
    "parser": "@typescript-eslint/parser",
    "extends": [
        "eslint:recommended",
        "plugin:@typescript-eslint/eslint-recommended",
        "plugin:@typescript-eslint/recommended"
    ]
}

Then I ran eslint . --ext .ts command in terminal and there were no expected errors or warnings though my code uses deprecated API:

const audioContext = new AudioContext();
const processor = audioContext.createScriptProcessor(2048, 1, 1);
//onaudioprocess is deprecated
processor.onaudioprocess = event => {
    console.log(event);
    //...
}
0 Answers
Related