Skip to content

Commit 94ca819

Browse files
hawkgsKeen Yee Liau
authored and
Keen Yee Liau
committed
fix(@schematics/angular): linting errors in AST utils spec
1 parent 86f1884 commit 94ca819

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

packages/schematics/angular/utility/ast-utils_spec.ts

+15-8
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import {
1616
addExportToModule,
1717
addProviderToModule,
1818
addSymbolToNgModuleMetadata,
19-
insertAfterLastOccurrence,
2019
findNodes,
20+
insertAfterLastOccurrence,
2121
} from './ast-utils';
2222

2323

@@ -39,6 +39,7 @@ function applyChanges(path: string, content: string, changes: Change[]): string
3939
return getFileContent(tree, path);
4040
}
4141

42+
// tslint:disable-next-line:no-big-function
4243
describe('ast utils', () => {
4344
let modulePath: string;
4445
let moduleContent: string;
@@ -209,20 +210,23 @@ describe('ast utils', () => {
209210
});
210211

211212
describe('insertAfterLastOccurrence', () => {
212-
const filePath: string = './src/foo.ts';
213+
const filePath = './src/foo.ts';
213214

214215
it('should work for the default scenario', () => {
215216
const fileContent = `const arr = ['foo'];`;
216217
const source = getTsSource(filePath, fileContent);
217-
const arrayNode = findNodes(source.getChildren().shift() as ts.Node, ts.SyntaxKind.ArrayLiteralExpression);
218+
const arrayNode = findNodes(
219+
source.getChildren().shift() as ts.Node,
220+
ts.SyntaxKind.ArrayLiteralExpression,
221+
);
218222
const elements = (arrayNode.pop() as ts.ArrayLiteralExpression).elements;
219223

220224
const change = insertAfterLastOccurrence(
221-
elements as any as ts.Node[],
225+
elements as unknown as ts.Node[],
222226
`, 'bar'`,
223227
filePath,
224228
elements.pos,
225-
ts.SyntaxKind.StringLiteral
229+
ts.SyntaxKind.StringLiteral,
226230
);
227231
const output = applyChanges(filePath, fileContent, [change]);
228232

@@ -233,15 +237,18 @@ describe('ast utils', () => {
233237
it('should work without occurrences', () => {
234238
const fileContent = `const arr = [];`;
235239
const source = getTsSource(filePath, fileContent);
236-
const arrayNode = findNodes(source.getChildren().shift() as ts.Node, ts.SyntaxKind.ArrayLiteralExpression);
240+
const arrayNode = findNodes(
241+
source.getChildren().shift() as ts.Node,
242+
ts.SyntaxKind.ArrayLiteralExpression,
243+
);
237244
const elements = (arrayNode.pop() as ts.ArrayLiteralExpression).elements;
238245

239246
const change = insertAfterLastOccurrence(
240-
elements as any as ts.Node[],
247+
elements as unknown as ts.Node[],
241248
`'bar'`,
242249
filePath,
243250
elements.pos,
244-
ts.SyntaxKind.StringLiteral
251+
ts.SyntaxKind.StringLiteral,
245252
);
246253
const output = applyChanges(filePath, fileContent, [change]);
247254

0 commit comments

Comments
 (0)