Skip to content

Commit 9b4f3d1

Browse files
authored
style: enabled no-console eslint rule (#DS-2920) (#1104)
1 parent a0412f8 commit 9b4f3d1

18 files changed

Lines changed: 65 additions & 11 deletions

File tree

.eslintrc.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ const javascriptAndTypescriptRules = {
115115
'no-useless-escape': 0,
116116
'no-self-assign': 0,
117117
'no-prototype-builtins': 0,
118+
'no-console': 1,
118119

119120
// plugin:promise
120121
'promise/catch-or-return': 0,
@@ -253,6 +254,7 @@ const componentsDevRules = {
253254
1,
254255
...noRestrictedGlobalsOptionsForSSR
255256
],
257+
'no-console': 0,
256258

257259
// plugin:@angular-eslint
258260
'@angular-eslint/directive-selector': [
@@ -295,6 +297,7 @@ const componentsExamplesRules = {
295297
1,
296298
...noRestrictedGlobalsOptionsForSSR
297299
],
300+
'no-console': 0,
298301

299302
// plugin:@angular-eslint
300303
'@angular-eslint/prefer-standalone': 1,
@@ -379,6 +382,45 @@ const specRules = {
379382
}
380383
};
381384

385+
/**
386+
* Override rules for /tools
387+
*
388+
* @type {import('eslint').Linter.ConfigOverride}
389+
*/
390+
const toolsRules = {
391+
files: ['tools/**/*.ts', 'tools/**/*.js'],
392+
rules: {
393+
// plugin:eslint
394+
'no-console': 0
395+
}
396+
};
397+
398+
/**
399+
* Override rules for /packages/schematics/
400+
*
401+
* @type {import('eslint').Linter.ConfigOverride}
402+
*/
403+
const schematicsRules = {
404+
files: ['packages/schematics/**/*.ts', 'packages/schematics/**/*.js'],
405+
rules: {
406+
// plugin:eslint
407+
'no-console': 0
408+
}
409+
};
410+
411+
/**
412+
* Override rules for /packages/cli/
413+
*
414+
* @type {import('eslint').Linter.ConfigOverride}
415+
*/
416+
const cliRules = {
417+
files: ['packages/cli/**/*.ts', 'packages/cli/**/*.js'],
418+
rules: {
419+
// plugin:eslint
420+
'no-console': 0
421+
}
422+
};
423+
382424
/** @type {import('eslint').Linter.ConfigOverride} */
383425
const prettierRules = {
384426
files: ['*.js', '*.ts', '*.html'],
@@ -416,6 +458,9 @@ const config = {
416458
componentsExamplesRules,
417459
componentsRules,
418460
specRules,
461+
toolsRules,
462+
schematicsRules,
463+
cliRules,
419464
// should be last
420465
prettierRules
421466
]

apps/docs/scripts/build-tokens.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable no-console */
2+
13
const StyleDictionary = require('style-dictionary');
24
const getPlatformConfig = require('@koobiq/tokens-builder/configs/index.js');
35

packages/components/app-switcher/app-switcher.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-console */
12
import { OverlayContainer } from '@angular/cdk/overlay';
23
import { Component, DebugElement, Provider, Type } from '@angular/core';
34
import { ComponentFixture, TestBed, fakeAsync, inject } from '@angular/core/testing';

packages/components/code-block/code-block-highlight.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export class KbqCodeBlockHighlight {
5656
let { language } = file;
5757

5858
if (!language || !hljs.getLanguage(language)) {
59+
// eslint-disable-next-line no-console
5960
console.warn(
6061
`[KbqCodeBlock] Unknown file language: "${language}". Fall back to "${this.fallbackFileLanguage}".`,
6162
file
@@ -73,10 +74,12 @@ export class KbqCodeBlockHighlight {
7374
});
7475

7576
if (illegal) {
77+
// eslint-disable-next-line no-console
7678
console.warn('[KbqCodeBlock] File content contains illegal characters.', file);
7779
}
7880

7981
if (relevance === 0) {
82+
// eslint-disable-next-line no-console
8083
console.warn('[KbqCodeBlock] File content does not match the specified programming language.', file);
8184
}
8285

@@ -137,6 +140,7 @@ export class KbqCodeBlockHighlight {
137140

138141
addStyles();
139142
} else {
143+
// eslint-disable-next-line no-console
140144
console.error('highlight.js not detected!');
141145
}
142146

@@ -298,6 +302,7 @@ export class KbqCodeBlockHighlight {
298302
}
299303
}
300304
} catch (e) {
305+
// eslint-disable-next-line no-console
301306
console.error('LineNumbers error: ', e);
302307
}
303308
}

packages/components/core/common-behaviors/color.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export function mixinColor<T extends Constructor<HasElementRef>>(
7575

7676
this.color = defaultColor;
7777

78+
// eslint-disable-next-line no-console
7879
console.warn('mixinColor deprecated and will be deleted in next major release');
7980
}
8081
};

packages/components/core/common-behaviors/common-module.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export class KbqCommonModule {
6262

6363
private checkDoctypeIsDefined(): void {
6464
if (this.document && !this.document.doctype) {
65+
// eslint-disable-next-line no-console
6566
console.warn(
6667
'Current document does not have a doctype. This may cause ' +
6768
'some koobiq components not to behave as expected.'

packages/components/core/common-behaviors/disabled.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export function mixinDisabled<T extends Constructor<{}>>(base: T): CanDisableCto
2727
constructor(...args: any[]) {
2828
super(...args);
2929

30+
// eslint-disable-next-line no-console
3031
console.warn('mixinDisabled deprecated and will be deleted in next major release');
3132
}
3233
};

packages/components/core/common-behaviors/error-state.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export function mixinErrorState<T extends Constructor<HasErrorState>>(base: T):
4141
constructor(...args: any[]) {
4242
super(...args);
4343

44+
// eslint-disable-next-line no-console
4445
console.warn('mixinErrorState deprecated and will be deleted in next major release');
4546
}
4647

packages/components/core/common-behaviors/tabindex.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export function mixinTabIndex<T extends Constructor<CanDisable>>(base: T, defaul
3333
constructor(...args: any[]) {
3434
super(...args);
3535

36+
// eslint-disable-next-line no-console
3637
console.warn('mixinTabIndex deprecated and will be deleted in next major release');
3738
}
3839
};

packages/components/core/pop-up/pop-up-trigger.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ export abstract class KbqPopUpTrigger<T> implements OnInit, OnDestroy {
179179
} else {
180180
this.placement = PopUpPlacements.Top;
181181

182+
// eslint-disable-next-line no-console
182183
console.warn(`Unknown position: ${value}. Will used default position: ${this.placement}`);
183184
}
184185

0 commit comments

Comments
 (0)