Answer the question
In order to leave comments, you need to log in
Why does eslint throw an error 'arg' is defined but never used?
RangeSlider(arg? : any): JQuery;
I get an error
on the line
'arg' is defined but never used
$.fn.RangeSlider = function(userOptions): JQuery
import { Model } from '../Model/Model';
import View from '../View/View';
import Presenter from '../Presenter/Presenter';
declare global {
interface JQuery {
RangeSlider(arg? : any): JQuery;
}
}
export interface ISettings {
min: number;
max: number;
isTwoRunners: boolean;
isScaleVisible: boolean;
isVertical: boolean;
isTooltipsVisible: boolean;
valueFrom: number;
valueTo: number;
step: number;
}
(function($) {
const defaultSettings: ISettings = {
min: 0,
max: 100,
isTwoRunners: true,
isScaleVisible: false,
isTooltipsVisible: true,
isVertical: false,
valueFrom: 30,
valueTo: 70,
step: 1,
};
$.fn.RangeSlider = function(userOptions): JQuery {
const mergedSettings = $.extend({}, defaultSettings, userOptions);
const elementId: string | null = this[0] ? `#${this[0].id}` : null;
const model: Model = new Model(mergedSettings);
const view: View = new View(elementId);
const presenter: Presenter = new Presenter(model, view);
return this;
};
}(jQuery));
$('#range-slider').RangeSlider({
min: 100,
max: 150,
valueFrom: 140,
valueTo: 149,
isScaleVisible: true,
isVertical: false,
step: 10,
});
RangeSlider(): JQuery;
Type '(userOptions: any) => JQuery' is not assignable to type '() => JQuery'.
Answer the question
In order to leave comments, you need to log in
Wangyu you have the original no-unused-vars rule from eslint itself, which does not understand type descriptions from TypeScript, you should use the rule from the @typescript-eslint/no-unused-vars plugin instead
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question