Warning: TypeScript linter alert - the no-unused-variable rule is now outdated; however, I do not have this configuration enabled

After 3 long months, I came across a warning in a project that was being refreshed today.

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

Oddly enough, my tsconfig.json file does not appear to be utilizing this feature.

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

It might be a hidden configuration within one of the previous settings.

Can anyone provide guidance on how to resolve this issue?

If helpful

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

These are the devDependencies related to TypeScript in my package.json

"devDependencies": {
    ...
    "tslint": "^5.11.0",
    "typescript": "^2.9.1"
    ...
  },

Answer №1

Warning: The deprecated rule no-unused-variable has been replaced in TypeScript 2.9. It is recommended to utilize the built-in compiler checks instead.

  1. To address this issue, remove the outdated no-unused-variable from either your project or dependency's tslint.json configuration file.

  2. Ensure that you include the following compiler options in your tsconfig.json file.

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

Answer №2

According to reports, tslint has deprecated that particular rule (additional information available at https://github.com/palantir/tslint/pull/3919)

Please review your tslint.json file and delete the rule in question to resolve the warning message.

Answer №3

Support for the no-unused-variable rule is just one aspect of the changes happening in the world of linting tools. The entire TSLint project has now been deprecated, with developers encouraged to switch to typescript-eslint instead. You can find more information on this transition here.

If you're currently using TSLint, it may be time to start thinking about the migration process over to the new linter. More details can be found here.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Can you explain the significance of the syntax provided?

I've been going through the Angular tutorial, but I'm having trouble grasping the significance of this particular code snippet: return (error: any): Observable<T> => {...}; It seems like the function is returning another function, but ...

TypeScript - The key is missing from the type definition, yet it is present in reality

I'm currently working on developing my own XML builder using TypeScript, but I've run into a significant issue: Property 'children' does not exist in type 'XMLNode'. Property 'children' does not exist in type &apos ...

Ways to seamlessly change user profile picture on all components without needing to refresh the page

I believe this question pertains to the overall structure of React applications. When it comes to user sessions, I rely on - NextAuth.js All user information (including profile pictures) from NextAuth is saved on Supabase (PostgreSQL) How can I update ...

Pulling the month name based on a specific year and week using Javascript

In my HTML form, there are two fields called Year and Week. When the user chooses a Year and Week from the dropdowns, I would like to show the corresponding Month Name for that specific year and week. Is there anyone who can assist me in retrieving the m ...

What is the best way to clear a token from SessionStorage upon exiting an Angular application?

I need to clear my sessionStorage every time I exit my application. App Module: export class AppModule implements OnInit, OnDestroy{ constructor(private overlayService: OverlayService, private logger: LoggerService, private userService: UserService, pr ...

Spread an all-encompassing category across a collection

What is the method in TypeScript to "spread" a generic type across a union? type Box<T> = { content: T }; type Boxes<string | number> = Box<string> | Box<number>; (Given that we are aware of when to use Boxes versus Box) ...

Typescript support on Emacs

"Is there a way to enable Typescript syntax highlighting in Emacs?" I have been struggling with this for quite some time. Using Emacs 24 on an Ubuntu Virtualbox VM, I can't seem to get package-refresh-contents to work as it just hangs on "Contacting ...

Utilizing Typescript Generics in Arrow Function to Combine Two Arguments

For instance, I am working with this code in a .tsx file extension const Add = <T,>(arg0: T, arg1: T): T => arg0 + arg1; const A = Add(1, 2); const B = Add('1', '2') However, I am encountering an issue, as there is an error m ...

Transferring information using TypeScript

My issue arises when transferring data from HTML in the following format Karbohidrat :{{karbohidrat}} <button ion-button (click)="cekHalamanMakanan('karbohidrat')">View carbohydrate foods</button> <br> Then, I retrieve the kar ...

Integrating a non-nullable static type into memoized components leads to a lint error - refer to the example provided for

Example 1: When defining a non-nullable someStaticProperty, a lint error will be thrown: import { NamedExoticComponent, memo } from "react"; type WithComponentId = { componentId: string }; type ScreenComponentStaticMembers = { someStaticProperty: str ...

Analyzing elements within an array using Angular 4

I have an array filled with various Objects such as: [ {"id":1,"host":"localhost","filesize":73,"fileage":"2018-01-26 09:26:40"}, {"id":2,"host":"localhost","filesize":21,"fileage":"2018-01-26 09:26:32"}, {...} ] These objects are displayed in the fol ...

Creating a module within a component in angular - step by step guide

I am interested in dynamically creating a component inside another component. This will allow me to pass my dynamic HTML template directly to the decorator like this: //code /** * @param template is the HTML template * @param container is @ViewChild(& ...

Attaching the JSON data to ngModel in Angular 2

I have received a json response containing various fields, including the rewards.rewardName value. I'm trying to figure out how to bind this specific value to [(ngModel)] in Angular 2. [ { "id": 18, "gname": "learning ramayanam", "goalCat ...

When attempting to create a fresh NestJS module, a message pops up stating: "An error occurred while

Currently running MacOS Monterey with the M1 chip as my OS. I installed NestJS CLI using the command: sudo npm install -g @nestjs/cli When creating a new Nest project with nest new message, everything goes smoothly. However, when attempting to generate a ...

Creating a circular array of raycast directions with HTML Canvas 2D

I'm currently working on implementing raycasting in typescript with HTML Canvas 2D based on the tutorial from this video: https://youtu.be/TOEi6T2mtHo. However, I've encountered an issue where the rays being cast consistently point in a single di ...

Can HTML tag attributes be accessed in CSS within the Shadow-DOM?

As I work on developing a custom component using StencilJS, I find myself needing to adjust the outline behavior when users navigate through it with either a keyboard or mouse. My component employs ShadowDOM and I aim to extract an HTML tag attribute from ...

What is the best way to transform an array containing double sets of brackets into a single set of brackets?

Is there a way to change the format of this list [[" ", " ", " ", " ", " ", " ", " ", " ", " ", " "]] to look like [" ", " ", " &qu ...

Creating Typescript libraries with bidirectional peer dependencies: A complete guide

One of my libraries is responsible for handling requests, while the other takes care of logging. Both libraries need configuration input from the client, and they are always used together. The request library makes calls to the logging library in various ...

Error in TypeScript when utilizing an Enum as a string

Attempting to include a string enum in my Angular 2 project resulted in an error during the npm project startup: ERROR in e:/projects/dbtool-fullstack/dbtool-client/src/app/shared/models/full-m odels/enums/Sex.ts (2,10): Type '"Male"' is not ass ...

Ensure that the variable is not 'undefined' and that it is a single, clean value

In my node backend project, I've encountered a situation with my TypeScript code where a variable occasionally prints as the string 'undefined' instead of just being undefined. Is there a more elegant way to check that the variable is not eq ...