Skip to content

Commit 97367eb

Browse files
authored
Merge pull request #12506 from IgniteUI/lint-unused
chore(lint): making unused vars and args error
2 parents 5b63921 + cc6d8c9 commit 97367eb

24 files changed

+3029
-3275
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
],
2727
"no-unused-vars": "off",
2828
"@typescript-eslint/no-unused-vars": [
29-
"warn",
29+
"error",
3030
{
3131
"varsIgnorePattern": "_",
3232
"argsIgnorePattern": "^_"

e2e/cypress/plugins/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// Plugins enable you to tap into, modify, or extend the internal behavior of Cypress
22
// For more info, visit https://on.cypress.io/plugins-api
3-
module.exports = (on, config) => {}
3+
module.exports = (_on, _config) => {}

package-lock.json

Lines changed: 2906 additions & 3159 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,18 @@
5353
},
5454
"private": true,
5555
"dependencies": {
56-
"@angular/animations": "^15.0.0",
57-
"@angular/common": "^15.0.0",
58-
"@angular/compiler": "^15.0.0",
59-
"@angular/core": "^15.0.0",
60-
"@angular/forms": "^15.0.0",
61-
"@angular/platform-browser": "^15.0.0",
62-
"@angular/platform-browser-dynamic": "^15.0.0",
63-
"@angular/router": "^15.0.0",
56+
"@angular/animations": "^15.1.0",
57+
"@angular/common": "^15.1.0",
58+
"@angular/compiler": "^15.1.0",
59+
"@angular/core": "^15.1.0",
60+
"@angular/forms": "^15.1.0",
61+
"@angular/platform-browser": "^15.1.0",
62+
"@angular/platform-browser-dynamic": "^15.1.0",
63+
"@angular/router": "^15.1.0",
6464
"@igniteui/material-icons-extended": "^2.10.0",
6565
"@types/hammerjs": "^2.0.40",
6666
"@types/source-map": "0.5.2",
67-
"core-js": "^3.26.1",
67+
"core-js": "^3.27.1",
6868
"fflate": "^0.7.3",
6969
"hammerjs": "^2.0.8",
7070
"igniteui-theming": "^1.2.0",
@@ -77,30 +77,30 @@
7777
"zone.js": "~0.12.0"
7878
},
7979
"devDependencies": {
80-
"@angular-devkit/build-angular": "^15.0.0",
81-
"@angular-devkit/schematics": "^15.0.0",
82-
"@angular-eslint/builder": "^15.1.0",
83-
"@angular-eslint/eslint-plugin": "^15.1.0",
84-
"@angular-eslint/eslint-plugin-template": "^15.1.0",
85-
"@angular-eslint/schematics": "^15.1.0",
86-
"@angular-eslint/template-parser": "^15.1.0",
87-
"@angular/cli": "^15.0.0",
88-
"@angular/compiler-cli": "^15.0.0",
89-
"@angular/language-service": "^15.0.0",
80+
"@angular-devkit/build-angular": "^15.1.1",
81+
"@angular-devkit/schematics": "^15.1.1",
82+
"@angular-eslint/builder": "^15.2.0",
83+
"@angular-eslint/eslint-plugin": "^15.2.0",
84+
"@angular-eslint/eslint-plugin-template": "^15.2.0",
85+
"@angular-eslint/schematics": "^15.2.0",
86+
"@angular-eslint/template-parser": "^15.2.0",
87+
"@angular/cli": "^15.1.1",
88+
"@angular/compiler-cli": "^15.1.0",
89+
"@angular/language-service": "^15.1.0",
9090
"@angularclass/hmr": "^3.0.0",
91-
"@cypress/schematic": "^2.3.0",
91+
"@cypress/schematic": "^2.4.0",
9292
"@types/estree": "^1.0.0",
93-
"@types/jasmine": "^4.3.0",
93+
"@types/jasmine": "^4.3.1",
9494
"@types/jasminewd2": "^2.0.10",
95-
"@types/node": "^18.11.0",
95+
"@types/node": "^18.11.18",
9696
"@types/sass-true": "^6.0.2",
9797
"@types/webpack-env": "^1.16.3",
98-
"@typescript-eslint/eslint-plugin": "^5.43.0",
99-
"@typescript-eslint/parser": "^5.43.0",
98+
"@typescript-eslint/eslint-plugin": "^5.48.1",
99+
"@typescript-eslint/parser": "^5.48.1",
100100
"browser-sync": "^2.27.11",
101-
"cypress": "latest",
101+
"cypress": "^12.3.0",
102102
"del": "^6.0.0",
103-
"eslint": "^8.28.0",
103+
"eslint": "^8.32.0",
104104
"eslint-plugin-import": "2.25.2",
105105
"eslint-plugin-jsdoc": "37.9.1",
106106
"eslint-plugin-prefer-arrow": "1.2.2",
@@ -116,7 +116,7 @@
116116
"hammer-simulator": "0.0.1",
117117
"ig-typedoc-theme": "^4.2.0",
118118
"igniteui-sassdoc-theme": "^1.1.4",
119-
"igniteui-webcomponents": "^4.0.0",
119+
"igniteui-webcomponents": "^4.1.1",
120120
"jasmine": "^4.5.0",
121121
"jasmine-core": "~4.5.0",
122122
"karma": "^6.3.11",
@@ -125,16 +125,16 @@
125125
"karma-jasmine": "~5.1.0",
126126
"karma-parallel": "^0.3.1",
127127
"karma-spec-reporter": "^0.0.34",
128-
"ng-packagr": "^15.0.0",
129-
"postcss-scss": "^4.0.3",
128+
"ng-packagr": "^15.1.1",
129+
"postcss-scss": "^4.0.6",
130130
"sass": "^1.56.0",
131131
"sass-true": "^6.0.1",
132132
"sassdoc": "^2.7.4",
133133
"sassdoc-plugin-localization": "^1.4.3",
134-
"stylelint": "^14.15.0",
134+
"stylelint": "^14.16.1",
135135
"stylelint-scss": "^4.1.0",
136136
"ts-node": "^10.8.1",
137-
"typedoc": "^0.23.21",
137+
"typedoc": "^0.23.24",
138138
"typedoc-plugin-localization": "^2.4.0",
139139
"typescript": "4.8.4"
140140
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// Plugins enable you to tap into, modify, or extend the internal behavior of Cypress
22
// For more info, visit https://on.cypress.io/plugins-api
3-
module.exports = (on, config) => {}
3+
module.exports = (_on, _config) => {}

projects/igniteui-angular/src/lib/action-strip/action-strip.component.spec.ts

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import { IgxActionStripComponent } from './action-strip.component';
22
import { Component, ViewChild, ElementRef, ViewContainerRef } from '@angular/core';
33
import { configureTestSuite } from '../test-utils/configure-suite';
44
import { IgxIconModule } from '../icon/public_api';
5-
import { TestBed, fakeAsync, waitForAsync } from '@angular/core/testing';
5+
import { TestBed } from '@angular/core/testing';
66
import { By } from '@angular/platform-browser';
77
import { wait } from '../test-utils/ui-interactions.spec';
88
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
99
import { IgxToggleModule } from '../directives/toggle/toggle.directive';
1010
import { IgxActionStripModule } from './action-strip.module';
11+
import { IgxDropDownModule } from '../drop-down/public_api';
1112

1213
const ACTION_STRIP_CONTAINER_CSS = 'igx-action-strip__actions';
1314
const DROP_DOWN_LIST = 'igx-drop-down__list';
@@ -20,33 +21,38 @@ describe('igxActionStrip', () => {
2021
let innerContainer: ViewContainerRef;
2122

2223
describe('Unit tests: ', () => {
23-
const mockViewContainerRef = jasmine.createSpyObj('ViewContainerRef', ['element']);
24-
const mockRenderer2 = jasmine.createSpyObj('Renderer2', ['appendChild', 'removeChild']);
25-
const mockContext = jasmine.createSpyObj('context', ['element']);
26-
const mockDisplayDensity = jasmine.createSpyObj('IDisplayDensityOptions', ['displayDensity']);
27-
const cdr = jasmine.createSpyObj('ChangeDetectorRef', ['detectChanges']);
28-
29-
it('should properly get/set hidden', () => {
30-
actionStrip = new IgxActionStripComponent(mockViewContainerRef, mockRenderer2, mockDisplayDensity, cdr);
31-
expect(actionStrip.hidden).toBeFalsy();
32-
actionStrip.hidden = true;
33-
expect(actionStrip.hidden).toBeTruthy();
24+
25+
configureTestSuite(() => {
26+
return TestBed.configureTestingModule({
27+
declarations: [
28+
IgxActionStripComponent
29+
],
30+
imports: [
31+
NoopAnimationsModule,
32+
IgxDropDownModule
33+
]
34+
});
3435
});
3536

3637
it('should properly show and hide using API', () => {
37-
actionStrip = new IgxActionStripComponent(mockViewContainerRef, mockRenderer2, mockDisplayDensity, cdr);
38-
actionStrip.show(mockContext);
38+
fixture = TestBed.createComponent(IgxActionStripComponent);
39+
actionStrip = fixture.componentInstance as IgxActionStripComponent;
40+
fixture.detectChanges();
41+
42+
const el = document.createElement('div');
43+
fixture.debugElement.nativeElement.appendChild(el);
44+
actionStrip.show(el);
3945
expect(actionStrip.hidden).toBeFalsy();
40-
expect(actionStrip.context).toBe(mockContext);
46+
expect(actionStrip.context).toBe(el);
4147
actionStrip.hide();
4248
expect(actionStrip.hidden).toBeTruthy();
49+
fixture.debugElement.nativeElement.removeChild(el);
4350
});
4451
});
4552

4653
describe('Initialization and rendering tests: ', () => {
47-
configureTestSuite();
48-
beforeAll(waitForAsync(() => {
49-
TestBed.configureTestingModule({
54+
configureTestSuite(() => {
55+
return TestBed.configureTestingModule({
5056
declarations: [
5157
IgxActionStripTestingComponent
5258
],
@@ -56,16 +62,18 @@ describe('igxActionStrip', () => {
5662
NoopAnimationsModule,
5763
IgxToggleModule
5864
]
59-
}).compileComponents();
60-
}));
61-
beforeEach(fakeAsync(() => {
65+
})
66+
});
67+
68+
beforeEach(() => {
6269
fixture = TestBed.createComponent(IgxActionStripTestingComponent);
6370
fixture.detectChanges();
6471
actionStrip = fixture.componentInstance.actionStrip;
6572
actionStripElement = fixture.componentInstance.actionStripElement;
6673
parentContainer = fixture.componentInstance.parentContainer;
6774
innerContainer = fixture.componentInstance.innerContainer;
68-
}));
75+
});
76+
6977
it('should be overlapping its parent container when no context is applied', () => {
7078
const parentBoundingRect = parentContainer.nativeElement.getBoundingClientRect();
7179
const actionStripBoundingRect = actionStripElement.nativeElement.getBoundingClientRect();
@@ -102,9 +110,8 @@ describe('igxActionStrip', () => {
102110
});
103111

104112
describe('render content as menu', () => {
105-
configureTestSuite();
106-
beforeAll(waitForAsync(() => {
107-
TestBed.configureTestingModule({
113+
configureTestSuite(() => {
114+
return TestBed.configureTestingModule({
108115
declarations: [
109116
IgxActionStripMenuTestingComponent,
110117
IgxActionStripCombinedMenuTestingComponent
@@ -115,8 +122,8 @@ describe('igxActionStrip', () => {
115122
NoopAnimationsModule,
116123
IgxToggleModule
117124
]
118-
}).compileComponents();
119-
}));
125+
});
126+
});
120127

121128
it('should render tree-dot button which toggles the content as menu', () => {
122129
fixture = TestBed.createComponent(IgxActionStripMenuTestingComponent);

projects/igniteui-angular/src/lib/core/selection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export class IgxSelectionAPIService {
177177
* @param componentID ID of the component, which we add new items to.
178178
* @param itemIDs Array of IDs of the items to add to component selection.
179179
*/
180-
public deselect_items(componentID: string, itemID: any[], clearSelection?: boolean) {
180+
public deselect_items(componentID: string, itemID: any[], _clearSelection?: boolean) {
181181
this.set(componentID, this.delete_items(componentID, itemID));
182182
}
183183

projects/igniteui-angular/src/lib/core/touch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export class HammerGesturesManager {
127127
* @param element The DOM element used to create the manager on.
128128
*/
129129
public getManagerForElement(element: EventTarget): HammerManager {
130-
const result = this._hammerManagers.filter((value, index, array) => value.element === element);
130+
const result = this._hammerManagers.filter(value => value.element === element);
131131
return result.length ? result[0].manager : null;
132132
}
133133

projects/igniteui-angular/src/lib/data-operations/filtering-condition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class IgxBooleanFilteringOperand extends IgxFilteringOperand {
7777
name: 'all',
7878
isUnary: true,
7979
iconName: 'select-all',
80-
logic: (target: boolean) => true
80+
logic: (_target: boolean) => true
8181
}, {
8282
name: 'true',
8383
isUnary: true,

projects/igniteui-angular/src/lib/data-operations/pivot-sort-strategy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ export class DefaultPivotGridRecordSortingStrategy extends DefaultSortingStrateg
1717
valueResolver: (obj: any, key: string, isDate?: boolean) => any,
1818
isDate?: boolean,
1919
isTime?: boolean,
20-
grid?: PivotGridType) {
20+
_grid?: PivotGridType) {
2121
const reverse = (dir === SortingDirection.Desc ? -1 : 1);
2222
const cmpFunc = (obj1, obj2) => this.compareObjects(obj1, obj2, fieldName, reverse, ignoreCase, this.getFieldValue, isDate, isTime);
2323
return this.arraySort(data, cmpFunc);
2424
}
2525

26-
protected getFieldValue(obj: IPivotGridRecord, key: string, isDate: boolean = false, isTime: boolean = false): any {
26+
protected getFieldValue(obj: IPivotGridRecord, key: string, _isDate: boolean = false, _isTime: boolean = false): any {
2727
return obj.aggregationValues.get(key);
2828
}
2929
}
@@ -52,7 +52,7 @@ export class DefaultPivotSortingStrategy extends DefaultSortingStrategy {
5252
return this.arraySort(data, cmpFunc);
5353
}
5454

55-
protected getFieldValue(obj: any, key: string, isDate: boolean = false, isTime: boolean = false): any {
55+
protected getFieldValue(obj: any, key: string, _isDate: boolean = false, isTime: boolean = false): any {
5656
let resolvedValue = PivotUtil.extractValueFromDimension(this.dimension, obj) || obj[0];
5757
const formatAsDate = this.dimension.dataType === GridColumnDataType.Date || this.dimension.dataType === GridColumnDataType.DateTime;
5858
if (formatAsDate) {

0 commit comments

Comments
 (0)