Skip to content

Commit f4c3c0f

Browse files
committed
Eslint arreglos y chau warnings test
1 parent f0f6c57 commit f4c3c0f

20 files changed

+88
-76
lines changed

build/demo-release.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import * as fs from 'fs';
33
import { cmd } from './util';
44

55
/* eslint-disable @typescript-eslint/no-var-requires */
6-
var ghpages: any = require('gh-pages');
6+
var ghpages: typeof import('gh-pages') = require('gh-pages');
77
var dir: string = path.resolve(path.join(__dirname, '../', 'demo-dist'));
88

99
// CNAME FILE
1010
cmd('mkdir ', [`-p ${dir}`]);
11-
fs.writeFile(`${dir}/CNAME`, 'ngx-jsonapi.reyesoft.com', function(err: any) {
11+
fs.writeFile(`${dir}/CNAME`, 'ngx-jsonapi.reyesoft.com', function(err: NodeJS.ErrnoException | null) {
1212
if (err) {
1313
return console.log(err);
1414
}

build/tasks.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as util from './util';
55
* Cleans the top level dist folder. All npm-ready packages are created
66
* in the dist folder.
77
*/
8-
export function removeDistFolder(config: Config): Promise<string> {
8+
export function removeDistFolder(_config: Config): Promise<string> {
99
return util.exec('rimraf', ['./dist']);
1010
}
1111

@@ -133,7 +133,7 @@ export async function createUmdBundles(config: Config): Promise<void> {
133133
* Removes any leftover TypeScript files from previous compilation steps,
134134
* leaving any type definition files in place
135135
*/
136-
export async function cleanTypeScriptFiles(config: Config): Promise<void> {
136+
export async function cleanTypeScriptFiles(_config: Config): Promise<void> {
137137
const tsFilesGlob: string = './dist/**/*.ts';
138138
const dtsFilesFlob: string = './dist/**/*.d.ts';
139139
const filesToRemove: Array<string> = await util.getListOfFiles(tsFilesGlob, dtsFilesFlob);
@@ -198,7 +198,7 @@ export async function removeRemainingSourceMapFiles(config: Config): Promise<voi
198198
* Copies the type definition files and NGC metadata files to
199199
* the root of the distribution
200200
*/
201-
export async function copyTypeDefinitionFiles(config: Config): Promise<void> {
201+
export async function copyTypeDefinitionFiles(_config: Config): Promise<void> {
202202
/*
203203
const packages = util.getTopLevelPackages(config);
204204
const files = await util.getListOfFiles(
@@ -246,7 +246,7 @@ export async function minifyUmdBundles(config: Config): Promise<void> {
246246
export async function copyDocs(config: Config): Promise<void> {
247247
const packages: Array<string> = util.getTopLevelPackages(config);
248248

249-
await mapAsync(packages, async pkg => {
249+
await mapAsync(packages, async _pkg => {
250250
// const source = `./src/${pkg}`;
251251
const source: string = `.`;
252252
// const target = `./dist/${pkg}`;
@@ -262,7 +262,7 @@ export async function copyDocs(config: Config): Promise<void> {
262262
export async function copyPackageJsonFiles(config: Config):Promise<void> {
263263
const packages: Array<string> = util.getAllPackages(config);
264264

265-
await mapAsync(packages, async pkg => {
265+
await mapAsync(packages, async _pkg => {
266266
// const source = `./src/${pkg}`;
267267
const source: string = `./src`;
268268
// const target = `./dist/${pkg}`;
@@ -275,7 +275,7 @@ export async function copyPackageJsonFiles(config: Config):Promise<void> {
275275
/**
276276
* Removes the packages folderPromise<void>
277277
*/
278-
export async function removePackagesFolder(config: Config): Promise<void> {
278+
export async function removePackagesFolder(_config: Config): Promise<void> {
279279
await util.removeRecursively('./dist');
280280
}
281281

@@ -287,8 +287,6 @@ export async function publishToRepo(config: Config): Promise<void> {
287287
const SOURCE_DIR: string = `./dist/${pkg}`;
288288
const REPO_URL: string = `[email protected]:ngrx/${pkg}-builds.git`;
289289
const REPO_DIR: string = `./tmp/${pkg}`;
290-
const SHA: string = await util.git([`rev-parse HEAD`]);
291-
const SHORT_SHA: string = await util.git([`rev-parse --short HEAD`]);
292290
const COMMITTER_USER_NAME: string = await util.git([
293291
`--no-pager show -s --format='%cN' HEAD`
294292
]);
@@ -326,8 +324,8 @@ export async function publishToRepo(config: Config): Promise<void> {
326324

327325
export function mapAsync<T>(
328326
list: Array<T>,
329-
mapFn: (v: T, i: number) => Promise<any>
330-
): Promise<any> {
327+
mapFn: (v: T, i: number) => Promise<unknown>
328+
): Promise<unknown> {
331329
return Promise.all(list.map(mapFn));
332330
}
333331

build/util.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import * as fsExtra from 'fs-extra';
55
import * as path from 'path';
66
import * as rimraf from 'rimraf';
77
import { Config, PackageDescription } from './config';
8+
import * as ora from 'ora';
89

9-
export type RunnerFn = (config: Config) => Promise<any>;
10+
11+
export type RunnerFn = (config: Config) => Promise<unknown>;
1012
export type TaskDef = [string, RunnerFn];
1113
export type BaseFn = (command: string) => string;
1214

@@ -104,16 +106,14 @@ export function getPackageFilePath(pkg: string, filename: string): string {
104106
}
105107

106108
// eslint-disable-next-line @typescript-eslint/no-var-requires
107-
const sorcery: any = require('sorcery');
109+
const sorcery: typeof import('sorcery') = require('sorcery');
108110
export async function mapSources(file: string): Promise<void> {
109-
const chain: any = await sorcery.load(file);
111+
const chain = await sorcery.load(file);
110112
chain.write();
111113
}
112114

113-
// eslint-disable-next-line @typescript-eslint/no-var-requires
114-
const ora: any = require('ora');
115-
async function runTask(name: string, taskFn: () => Promise<any>): Promise<void> {
116-
const spinner: any = ora(name);
115+
async function runTask(name: string, taskFn: () => Promise<unknown>): Promise<void> {
116+
const spinner = ora(name);
117117

118118
try {
119119
spinner.start();

demo/app/app.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ export class AppComponent /* implements OnInit */ {
2020
jsonapiCore.loadingsDone = (): void => {
2121
this.loading = '';
2222
};
23-
jsonapiCore.loadingsOffline = (error): void => {
23+
jsonapiCore.loadingsOffline = (_error): void => {
2424
this.loading = 'No connection!!!';
2525
};
26-
jsonapiCore.loadingsError = (error): void => {
26+
jsonapiCore.loadingsError = (_error): void => {
2727
this.loading = 'No connection 2!!!';
2828
};
2929
}

demo/app/authors/components/author.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class AuthorComponent {
2121
public constructor(
2222
protected authorsService: AuthorsService,
2323
protected photosService: PhotosService,
24-
booksService: BooksService,
24+
_booksService: BooksService,
2525
private route: ActivatedRoute
2626
) {
2727
route.params.subscribe(({ id }) => {
@@ -50,7 +50,7 @@ export class AuthorComponent {
5050
.save
5151
/* { include: ['book'] } */
5252
()
53-
.subscribe((success) => {
53+
.subscribe((_success) => {
5454
console.log('author saved', author.toObject());
5555
});
5656
}
@@ -66,7 +66,7 @@ export class AuthorComponent {
6666
currentAuthor.attributes.name = newName || currentAuthor.attributes.name;
6767
console.log('author data for save with book include', currentAuthor.toObject({ include: ['books'] }));
6868
console.log('author data for save without any include', currentAuthor.toObject());
69-
currentAuthor.save(/* { include: ['book'] } */).subscribe((success) => {
69+
currentAuthor.save(/* { include: ['book'] } */).subscribe((_success) => {
7070
console.log('author saved', currentAuthor.toObject());
7171
});
7272
}

demo/app/authors/components/authors.component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ import { BooksService } from '../../books/books.service';
77
import { AuthorsComponent } from './authors.component';
88
import { DocumentCollection, JsonapiConfig, JSONAPI_STORE_SERVICE, JSONAPI_RIPPER_SERVICE, StoreService, JsonRipper } from 'ngx-jsonapi';
99
import { provideNgxJsonapiStandalone } from 'ngx-jsonapi/ngx-jsonapi.provider';
10-
import { ActivatedRoute } from '@angular/router';
10+
import { ActivatedRoute, Params } from '@angular/router';
1111

1212
describe('AuthorsComponent', () => {
1313
let component: AuthorsComponent;
1414
let fixture: ComponentFixture<AuthorsComponent>;
1515

16-
const queryParams$: BehaviorSubject<any> = new BehaviorSubject<any>({});
16+
const queryParams$: BehaviorSubject<Params> = new BehaviorSubject<Params>({});
1717

18-
const authorsServiceMock: any = {
18+
const authorsServiceMock: AuthorsService = {
1919
all: () => of(new DocumentCollection())
20-
};
20+
} as AuthorsService;
2121

2222
beforeEach(waitForAsync(() => {
2323
TestBed.configureTestingModule({

demo/app/authors/components/authors.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { BooksService } from './../../books/books.service';
22
import { Component } from '@angular/core';
33
import { CommonModule } from '@angular/common';
44
import { RouterModule, ActivatedRoute } from '@angular/router';
5-
import { DocumentCollection, Photo } from 'ngx-jsonapi';
5+
import { DocumentCollection } from 'ngx-jsonapi';
66
import { AuthorsService, Author } from './../authors.service';
77
import { CollectionInfoComponent } from '../../shared/collection-info.component';
88
import { CollectionPaginatorComponent } from '../../shared/collection-paginator.component';
@@ -20,7 +20,7 @@ export class AuthorsComponent {
2020
public constructor(
2121
private route: ActivatedRoute,
2222
private authorsService: AuthorsService,
23-
booksService: BooksService
23+
_booksService: BooksService
2424
) {
2525
route.queryParams.subscribe(({ page }) => {
2626
authorsService

demo/app/books/books.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ export class BooksService extends Service<Book> {
3232
public ttl: number = 1;
3333

3434
// executed before get data from server
35-
public parseFromServer(attributes: any): void {
35+
public parseFromServer(attributes: { title: string; [key: string]: unknown }): void {
3636
attributes.title = '📖 ' + attributes.title;
3737
}
3838

3939
// executed before send to server
40-
public parseToServer(attributes: any): void {
41-
if ('title' in attributes) {
40+
public parseToServer(attributes: { title?: string; [key: string]: unknown }): void {
41+
if ('title' in attributes && typeof attributes.title === 'string') {
4242
attributes.title = attributes.title.replace('📖 ', '');
4343
}
4444
}

demo/app/books/components/books.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class BooksComponent {
4242
});
4343
}
4444

45-
public getAll(remotefilter: any): void {
45+
public getAll(remotefilter: Record<string, unknown>): void {
4646
// we add some remote filter
4747
remotefilter.date_published = {
4848
since: '1983-01-01',
@@ -63,7 +63,7 @@ export class BooksComponent {
6363
},
6464
(error) => console.log('error books controller', error)
6565
);
66-
books$.toPromise().then((success) => console.log('books loaded PROMISE'));
66+
books$.toPromise().then((_success) => console.log('books loaded PROMISE'));
6767
}
6868

6969
public delete(book: Resource): void {

demo/app/photos/photos.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
1+
import { Component } from '@angular/core';
22

3-
import { Service, DocumentCollection } from 'ngx-jsonapi';
3+
import { DocumentCollection } from 'ngx-jsonapi';
44
import { Photo, PhotosService } from './photos.service';
55

66
@Component({
@@ -22,9 +22,9 @@ export class PhotosComponent {
2222
this.makeRequest(5);
2323
}
2424

25-
public makeRequest(id: any): void {
25+
public makeRequest(id: number): void {
2626
this.photosService.all().subscribe((photos) => {
27-
this.photos = photos as any;
27+
this.photos = photos as DocumentCollection<Photo>;
2828
console.log('photos success', id, this.photos);
2929
});
3030
}

0 commit comments

Comments
 (0)