Skip to content

Commit 6b1ddcb

Browse files
authored
chore(editors, banner, nav-drawer): fix eslint warnings (#9860)
1 parent f74d12d commit 6b1ddcb

32 files changed

+212
-133
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,19 @@ All notable changes for each version of this project will be documented in this
121121
- `onAppended` -> `contentAppended`
122122
- `onAnimation` -> `animationStarting`
123123

124+
- `IgxMaskDirective`
125+
- **Breaking Change** - Deprecated property `placeholder` is now removed;
126+
- **Breaking Change** - `IgxMaskDirective` events are renamed as follows:
127+
- `onValueChange` -> `valueChanged`
128+
124129
- **Breaking Change** - `IgxBannerComponent` events are renamed as follows:
125130
- `onOpening` -> `opening`
126131
- `onOpened` -> `opened`
127132
- `onClosing` -> `closing`
128133
- `onClosed` -> `closed`
129134

130135
- `IgxExpansionPanelComponent`
136+
- **Breaking Change** - `IExpansionPanelEventArgs.panel` - Deprecated event property `panel` is removed. Usе `owner` property to get a reference to the panel.
131137
- **Breaking Change** - `IgxExpansionPanelComponent` events are renamed as follows:
132138
- `onCollapsed` -> `contentCollapsed`
133139
- `onExpanded` -> `contentExpanded`
@@ -144,6 +150,8 @@ All notable changes for each version of this project will be documented in this
144150
...
145151
</igx-expansion-panel>
146152
```
153+
- `IgxBanner`
154+
- `BannerEventArgs.banner` - Deprecated. Usе `owner` property to get a reference to the banner.
147155

148156
- `IgxDropDown`
149157
- **Breaking Change** - The dropdown items no longer takes focus unless `allowItemsFocus` is set to `true`.

projects/igniteui-angular/migrations/common/ServerHost.ts

+13-13
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export class ServerHost implements ts.server.ServerHost {
144144

145145
//#region Not implemented methods
146146

147-
public write(data: string): void {
147+
public write(_data: string): void {
148148
throw new Error('Method "write" not implemented.');
149149
// ts.sys.write(data);
150150
}
@@ -154,27 +154,27 @@ export class ServerHost implements ts.server.ServerHost {
154154
// return ts.sys.writeOutputIsTTY();
155155
}
156156

157-
public writeFile(path: string, data: string, writeByteOrderMark?: boolean): void {
157+
public writeFile(_path: string, _data: string, _writeByteOrderMark?: boolean): void {
158158
throw new Error('Method "writeFile" not implemented.');
159159
// return ts.sys.writeFile(path, data, writeByteOrderMark);
160160
}
161161

162-
public createDirectory(path: string): void {
162+
public createDirectory(_path: string): void {
163163
throw new Error('Method "createDirectory" not implemented.');
164164
// return ts.sys.createDirectory(path);
165165
}
166166

167-
public setModifiedTime(path: string, time: Date): void {
167+
public setModifiedTime(_path: string, _time: Date): void {
168168
throw new Error('Method "setModifiedTime" not implemented.');
169169
// return ts.sys.setModifiedTime(path, time);
170170
}
171171

172-
public deleteFile(path: string): void {
172+
public deleteFile(_path: string): void {
173173
throw new Error('Method "deleteFile" not implemented.');
174174
// return ts.sys.deleteFile(path);
175175
}
176176

177-
public createHash(data: string): string {
177+
public createHash(_data: string): string {
178178
throw new Error('Method "createHash" not implemented.');
179179
// return ts.sys.createHash(data);
180180
}
@@ -184,17 +184,17 @@ export class ServerHost implements ts.server.ServerHost {
184184
// return ts.sys.getMemoryUsage();
185185
}
186186

187-
public exit(exitCode?: number): void {
187+
public exit(_exitCode?: number): void {
188188
throw new Error('Method "exit" not implemented.');
189189
// return ts.sys.exit(exitCode);
190190
}
191191

192-
public setTimeout(callback: (...argsv: any[]) => void, ms: number, ...args: any[]): any {
192+
public setTimeout(_callback: (...argsv: any[]) => void, _ms: number, ..._args: any[]): any {
193193
throw new Error('Method "setTimeout" not implemented.');
194194
// return ts.sys.setTimeout(callback, ms, ...args);
195195
}
196196

197-
public clearTimeout(timeoutId: any): void {
197+
public clearTimeout(_timeoutId: any): void {
198198
throw new Error('Method "clearTimeout" not implemented.');
199199
// return ts.sys.clearTimeout(timeoutId);
200200
}
@@ -204,22 +204,22 @@ export class ServerHost implements ts.server.ServerHost {
204204
// return ts.sys.clearScreen();
205205
}
206206

207-
public base64decode(input: string): string {
207+
public base64decode(_input: string): string {
208208
throw new Error('Method "base64decode" not implemented.');
209209
// return ts.sys.base64decode(input);
210210
}
211211

212-
public base64encode(input: string): string {
212+
public base64encode(_input: string): string {
213213
throw new Error('Method "base64encode" not implemented.');
214214
// return ts.sys.base64encode(input);
215215
}
216216

217-
public setImmediate(callback: (...argsv: any[]) => void, ...args: any[]): any {
217+
public setImmediate(_callback: (...argsv: any[]) => void, ..._args: any[]): any {
218218
throw new Error('Method "setImmediate" not implemented.');
219219
// return setImmediate(callback, ...args);
220220
}
221221

222-
public clearImmediate(timeoutId: any): void {
222+
public clearImmediate(_timeoutId: any): void {
223223
throw new Error('Method "clearImmediate" not implemented.');
224224
// return clearImmediate(timeoutId);
225225
}

projects/igniteui-angular/migrations/common/UpdateChanges.spec.ts

-10
Original file line numberDiff line numberDiff line change
@@ -897,16 +897,6 @@ export class AppModule { }`);
897897

898898
it('Should be able to replace property of an event', () => {
899899
pending('set up tests for migrations through lang service');
900-
const membersConfig = {
901-
member: 'onGridKeydown',
902-
replaceWith: 'gridKeydown',
903-
definedIn: [
904-
'IgxGridComponent',
905-
'IgxTreeGridComponent',
906-
'IgxHierarchicalGridComponent',
907-
'IgxRowIslandComponent'
908-
]
909-
};
910900
const fileContent =
911901
`import { Component } from '@angular/core';
912902
import { IGridCreatedEventArgs } from 'igniteui-angular';

projects/igniteui-angular/migrations/common/UpdateChanges.ts

-2
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ export class UpdateChanges {
296296

297297
let base: string;
298298
let replace: string;
299-
let groups = 1;
300299
let searchPattern;
301300

302301
if (type === BindingType.Output) {
@@ -306,7 +305,6 @@ export class UpdateChanges {
306305
// Match both bound - [name] - and regular - name
307306
base = String.raw`(\s\[?)${change.name}(\s*\]?=)(["'])(.*?)\3`;
308307
replace = String.raw`$1${change.replaceWith}$2$3$4$3`;
309-
groups = 3;
310308
}
311309

312310
let reg = new RegExp(base, 'g');

projects/igniteui-angular/migrations/common/tsPlugin/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { TSLanguageService } from './TSLanguageService';
22

33
const init = (modules: { typescript: typeof import('typescript/lib/tsserverlibrary') }) => {
4-
const ts = modules.typescript;
4+
const _ts = modules.typescript;
55
let tsLanguageService = null;
66

77
/**

projects/igniteui-angular/migrations/update-12_0_0/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ See https://www.infragistics.com/products/ignite-ui-angular/angular/components/t
5757
const changes = new Map<string, FileChange[]>();
5858
const htmlFiles = update.templateFiles;
5959
const sassFiles = update.sassFiles;
60-
const tsFiles = update.tsFiles;
60+
const _tsFiles = update.tsFiles;
6161
let applyComment = false;
6262

6363
const applyChanges = () => {
@@ -127,7 +127,7 @@ See https://www.infragistics.com/products/ignite-ui-angular/angular/components/t
127127
findElementNodes(parseFile(host, path), comp.tags).
128128
map(node => getSourceOffset(node as Element)).
129129
forEach(offset => {
130-
const { startTag, endTag, file, node } = offset;
130+
const { startTag, file, node } = offset;
131131
// Label content
132132
let labelText = '';
133133
if (hasAttribute(node, 'label')) {

projects/igniteui-angular/migrations/update-12_1_0/changes/members.json

+10-2
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,20 @@
8282
"definedIn": [
8383
"IgxExpansionPanelComponent"
8484
]
85-
},{
85+
},
86+
{
8687
"member": "onInteraction",
8788
"replaceWith": "interaction",
8889
"definedIn": [
8990
"IgxExpansionPanelHeaderComponent"
9091
]
92+
},
93+
{
94+
"member": "onValueChange",
95+
"replaceWith": "valueChanged",
96+
"definedIn": [
97+
"IgxMaskDirective"
98+
]
9199
}
92100
]
93-
}
101+
}

projects/igniteui-angular/migrations/update-12_1_0/changes/outputs.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@
5656
"selector": "igx-banner",
5757
"type": "component"
5858
}
59+
},
60+
{
61+
"name": "onValueChange",
62+
"replaceWith": "valueChanged",
63+
"owner": {
64+
"selector": "[igxMask]",
65+
"type": "directive"
66+
}
5967
}
6068
]
61-
}
69+
}

projects/igniteui-angular/migrations/update-12_1_0/index.spec.ts

+90-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ describe(`Update to ${version}`, () => {
2424

2525
const migrationName = 'migration-21';
2626
const lineBreaksAndSpaceRegex = /\s/g;
27-
// eslint-disable-next-line max-len
28-
const noteText = `<!--NOTE: This component has been updated by Infragistics migration: v${version}\nPlease check your template whether all bindings/event handlers are correct.-->`;
2927

3028
beforeEach(() => {
3129
appTree = new UnitTestTree(new EmptyTree());
@@ -176,6 +174,50 @@ export class TestComponent implements OnInit {
176174
}`);
177175
});
178176

177+
it('should update mask event subscriptions in .html file', async () => {
178+
appTree.create(
179+
'/testSrc/appPrefix/component/test.component.html', `
180+
<input igxInput type="text" [igxMask]="'(####) 00-00-00 Ext. 9999'" (onValueChange)="handleEvent()" />`);
181+
const tree = await schematicRunner.runSchematicAsync(migrationName, {}, appTree)
182+
.toPromise();
183+
184+
expect(tree.readContent('/testSrc/appPrefix/component/test.component.html'))
185+
.toEqual(`
186+
<input igxInput type="text" [igxMask]="'(####) 00-00-00 Ext. 9999'" (valueChanged)="handleEvent()" />`);
187+
});
188+
189+
it('should update mask event subscriptions .ts file', async () => {
190+
pending('ts language service tests do not pass');
191+
appTree.create(
192+
'/testSrc/appPrefix/component/test.component.ts', `
193+
import { Component, OnInit } from '@angular/core';
194+
import { IgxMaskDirective } from 'igniteui-angular';
195+
export class TestComponent implements OnInit {
196+
@ViewChild(IgxMaskDirective)
197+
public mask: IgxMaskDirective
198+
199+
public ngOnInit() {
200+
this.mask.onValueChange.subscribe();
201+
}
202+
}`);
203+
const tree = await schematicRunner.runSchematicAsync(migrationName, {}, appTree)
204+
.toPromise();
205+
206+
expect(tree.readContent('/testSrc/appPrefix/component/test.component.ts'))
207+
.toEqual(`
208+
import { Component, OnInit } from '@angular/core';
209+
import { IgxMaskDirective } from 'igniteui-angular';
210+
export class TestComponent implements OnInit {
211+
@ViewChild(IgxMaskDirective)
212+
public mask: IgxMaskDirective
213+
214+
public ngOnInit() {
215+
this.mask.valueChanged;
216+
}
217+
}`);
218+
});
219+
220+
179221
it('should update expansion panel event subscriptions in .html file', async () => {
180222
appTree.create(
181223
'/testSrc/appPrefix/component/test.component.html', `
@@ -196,6 +238,52 @@ export class TestComponent implements OnInit {
196238
</igx-expansion-panel>`);
197239
});
198240

241+
it('Should remove references to deprecated `banner` property of `BannerEventArgs`', async () => {
242+
pending('set up tests for migrations through lang service');
243+
appTree.create(
244+
'/testSrc/appPrefix/component/expansion-test.component.ts',
245+
`import { Component, ViewChild } from '@angular/core';
246+
import { IgxBanner } from 'igniteui-angular';
247+
248+
@Component({
249+
selector: 'app-banner-test',
250+
templateUrl: './banner-test.component.html',
251+
styleUrls: ['./banner-test.component.scss']
252+
})
253+
export class BannerTestComponent {
254+
255+
@ViewChild(IgxBannerComponent, { static: true })
256+
public panel: IgxBannerComponent;
257+
258+
public onBannerOpened(event: BannerEventArgs) {
259+
console.log(event.banner);
260+
}
261+
}`
262+
);
263+
const tree = await schematicRunner
264+
.runSchematicAsync('migration-17', {}, appTree)
265+
.toPromise();
266+
const expectedContent = `import { Component, ViewChild } from '@angular/core';
267+
import { IgxBanner } from 'igniteui-angular';
268+
269+
@Component({
270+
selector: 'app-banner-test',
271+
templateUrl: './banner-test.component.html',
272+
styleUrls: ['./banner-test.component.scss']
273+
})
274+
export class BannerTestComponent {
275+
276+
@ViewChild(IgxBannerComponent, { static: true })
277+
public panel: IgxBannerComponent;
278+
279+
public onBannerOpened(event: BannerEventArgs) {
280+
console.log(event.owner);
281+
}
282+
}`;
283+
expect(
284+
tree.readContent('/testSrc/appPrefix/component/expansion-test.component.ts')
285+
).toEqual(expectedContent);
286+
});
199287
it('should remove paging property and define a igx-paginator component instead', async () => {
200288
appTree.create(
201289
'/testSrc/appPrefix/component/test.component.html', `

projects/igniteui-angular/migrations/update-9_0_1/index.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/te
55

66
describe('Update 9.0.1', () => {
77
let appTree: UnitTestTree;
8-
const schematicRunner = new SchematicTestRunner('ig-migrate', path.join(__dirname, '../migration-collection.json'));
8+
const _schematicRunner = new SchematicTestRunner('ig-migrate', path.join(__dirname, '../migration-collection.json'));
99
const configJson = {
1010
defaultProject: 'testProj',
1111
projects: {

projects/igniteui-angular/schematics/ng-add/index.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Firefox ESR
7878
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
7979
`;
8080

81-
const browserslistrcMissingIE = `
81+
const _browserslistrcMissingIE = `
8282
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
8383
# For additional information regarding the format and rule options, please see:
8484
# https://github.com/browserslist/browserslist#queries

0 commit comments

Comments
 (0)