Skip to content

Commit 2ca0f42

Browse files
authored
Merge pull request DSpace#5089 from guillermo-escire/feature/3949
Remove console.log and enforce ESLint no-console rule (DSpace#3949)
2 parents 2f5ddfe + 3f76a37 commit 2ca0f42

File tree

16 files changed

+23
-38
lines changed

16 files changed

+23
-38
lines changed

.eslintrc.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
"error",
7171
{
7272
"allow": [
73-
"log",
7473
"warn",
7574
"dir",
7675
"timeLog",

cypress/plugins/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = (on, config) => {
1313
// Define "log" and "table" tasks, used for logging accessibility errors during CI
1414
// Borrowed from https://github.com/component-driven/cypress-axe#in-cypress-plugins-file
1515
log(message: string) {
16-
console.log(message);
16+
console.info(message);
1717
return null;
1818
},
1919
table(message: string) {

src/app/admin/admin-edit-cms-metadata/admin-edit-cms-metadata.component.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ describe('AdminEditCmsMetadataComponent', () => {
117117
it('should render textareas of the languages', () => {
118118
const languagesLength = environment.languages.filter((l) => l.active).length;
119119
const textareas = fixture.debugElement.queryAll(By.css('textarea'));
120-
console.log(textareas.length, languagesLength);
121120
expect(textareas).toHaveSize(languagesLength);
122121
});
123122

src/app/app.metareducers.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ let actionCounter = 0;
66
export function debugMetaReducer(reducer) {
77
return (state, action) => {
88
actionCounter++;
9-
console.log('@ngrx action', actionCounter, action.type);
10-
console.log('state', JSON.stringify(state));
11-
console.log('action', JSON.stringify(action));
12-
console.log('------------------------------------');
9+
console.debug('@ngrx action', actionCounter, action.type);
10+
console.debug('state', JSON.stringify(state));
11+
console.debug('action', JSON.stringify(action));
12+
console.debug('------------------------------------');
1313
return reducer(state, action);
1414
};
1515
}

src/app/core/data/debug-response-parsing.service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { RestRequest } from './rest-request.model';
88
@Injectable({ providedIn: 'root' })
99
export class DebugResponseParsingService implements ResponseParsingService {
1010
parse(request: RestRequest, data: RawRestResponse): RestResponse {
11-
console.log('request', request, 'data', data);
1211
return undefined;
1312
}
1413
}

src/app/core/dspace-rest/dspace-rest.service.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ describe('DspaceRestService', () => {
8686
});
8787

8888
it('should log an error', () => {
89-
spyOn(console, 'log');
89+
spyOn(console, 'error');
9090

9191
dspaceRestService.get(url).subscribe(() => undefined, (err: unknown) => {
92-
expect(console.log).toHaveBeenCalled();
92+
expect(console.error).toHaveBeenCalled();
9393
});
9494

9595
const req = httpMock.expectOne(url);

src/app/core/dspace-rest/dspace-rest.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class DspaceRestService {
6565
statusText: res.statusText,
6666
})),
6767
catchError((err: unknown) => observableThrowError(() => {
68-
console.log('Error: ', err);
68+
console.error('Error: ', err);
6969
return this.handleHttpError(err);
7070
})),
7171
);

src/app/core/testing/auth-service.stub.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ export class AuthServiceStub {
3939
authStatus.eperson = createSuccessfulRemoteDataObject$(EPersonMock);
4040
return of(authStatus);
4141
} else {
42-
console.log('error');
4342
throw (new Error('Message Error test'));
4443
}
4544
}

src/app/notifications/suggestions/sources/suggestion-sources.component.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ describe('SuggestionSourcesComponent', () => {
8383
beforeEach(waitForAsync(() => {
8484
// Mock the suggestion source data service to return an empty list
8585
mockSuggestionSourceDataService.getSources.and.returnValue(mockPaginatedListRD);
86-
console.log(mockSuggestionSourceDataService);
8786
fixture = TestBed.createComponent(SuggestionSourcesComponent);
8887
component = fixture.componentInstance;
8988
fixture.detectChanges();

src/app/notifications/suggestions/sources/suggestion-sources.component.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
distinctUntilChanged,
2222
map,
2323
switchMap,
24-
tap,
2524
} from 'rxjs/operators';
2625

2726
import { AlertComponent } from '../../../shared/alert/alert.component';
@@ -80,7 +79,6 @@ export class SuggestionSourcesComponent {
8079
}),
8180
takeUntilDestroyed(),
8281
).subscribe((results: Partial<PaginatedList<SuggestionSource>>) => {
83-
console.log(results);
8482
this.sources$.next(results.page);
8583
this.totalElements$.next(results.pageInfo?.totalElements ?? 0);
8684
this.loading$.next(false);
@@ -104,7 +102,6 @@ export class SuggestionSourcesComponent {
104102

105103
return this.suggestionSourceDataService.getSources(options).pipe(
106104
getFirstCompletedRemoteData(),
107-
tap(console.log),
108105
map((result: RemoteData<PaginatedList<SuggestionSource>>) => {
109106
return result.hasSucceeded ? result.payload : { page: [], pageInfo: null };
110107
}),

0 commit comments

Comments
 (0)