Skip to content

Commit 978e0d8

Browse files
author
Shahak Yosef
committed
Merged PR 215560: A few ESLint fixes
A few ESLint fixes
1 parent 7801d1e commit 978e0d8

11 files changed

+73
-82
lines changed

.eslintignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
# Task 512388: Fix eslint warnings and errors in tests
2-
test/*
2+
test/*
3+
/node_modules/*
4+
demo/*
5+
/**/*.js
6+
dist/*

.eslintrc.js

+40-58
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,18 @@ module.exports = {
2121
],
2222
"rules": {
2323
"@typescript-eslint/adjacent-overload-signatures": "warn",
24-
"@typescript-eslint/array-type": [
25-
"warn",
26-
{
27-
"default": "array-simple"
28-
}
29-
],
24+
"@typescript-eslint/array-type": "off",
3025
"@typescript-eslint/await-thenable": "warn",
31-
"@typescript-eslint/ban-ts-comment": "warn",
26+
"@typescript-eslint/ban-ts-comment": "off",
3227
"@typescript-eslint/ban-types": [
3328
"warn",
3429
{
3530
"types": {
3631
"Object": {
3732
"message": "Avoid using the `Object` type. Did you mean `object`?"
3833
},
39-
"Function": {
40-
"message": "Avoid using the `Function` type. Prefer a specific function type, like `() => void`."
41-
},
34+
"Function": false,
35+
"object": false,
4236
"Boolean": {
4337
"message": "Avoid using the `Boolean` type. Did you mean `boolean`?"
4438
},
@@ -54,16 +48,18 @@ module.exports = {
5448
}
5549
}
5650
],
57-
"@typescript-eslint/consistent-type-assertions": "warn",
5851
"@typescript-eslint/consistent-type-definitions": "warn",
59-
"@typescript-eslint/dot-notation": "warn",
52+
"@typescript-eslint/dot-notation": "off",
6053
"@typescript-eslint/explicit-member-accessibility": [
6154
"off",
6255
{
6356
"accessibility": "explicit"
6457
}
6558
],
66-
"@typescript-eslint/explicit-module-boundary-types": "warn",
59+
"@typescript-eslint/explicit-module-boundary-types": [
60+
"warn",
61+
{ "allowArgumentsExplicitlyTypedAsAny": true }
62+
],
6763
"@typescript-eslint/indent": [
6864
"warn",
6965
2,
@@ -90,6 +86,13 @@ module.exports = {
9086
}
9187
}
9288
],
89+
"@typescript-eslint/explicit-function-return-type": [
90+
"error",
91+
{
92+
"allowExpressions": true,
93+
"allowDirectConstAssertionInArrowFunctions": true
94+
}
95+
],
9396
"@typescript-eslint/member-ordering": "off",
9497
"@typescript-eslint/naming-convention": "off",
9598
"@typescript-eslint/no-array-constructor": "warn",
@@ -98,29 +101,33 @@ module.exports = {
98101
"@typescript-eslint/no-explicit-any": "off",
99102
"@typescript-eslint/no-extra-non-null-assertion": "warn",
100103
"@typescript-eslint/no-extra-semi": "warn",
101-
"@typescript-eslint/no-floating-promises": "warn",
104+
"@typescript-eslint/no-floating-promises": "off",
102105
"@typescript-eslint/no-for-in-array": "warn",
103106
"@typescript-eslint/no-implied-eval": "warn",
104-
"@typescript-eslint/no-inferrable-types": "warn",
107+
"@typescript-eslint/no-inferrable-types": "off",
105108
"@typescript-eslint/no-misused-new": "warn",
106-
"@typescript-eslint/no-misused-promises": "warn",
109+
"@typescript-eslint/no-misused-promises": "off",
107110
"@typescript-eslint/no-namespace": "warn",
108111
"@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
109112
"@typescript-eslint/no-non-null-assertion": "warn",
110113
"@typescript-eslint/no-parameter-properties": "off",
111114
"@typescript-eslint/no-this-alias": "warn",
112115
"@typescript-eslint/no-unnecessary-type-assertion": "warn",
113-
"@typescript-eslint/no-unsafe-assignment": "warn",
114-
"@typescript-eslint/no-unsafe-call": "warn",
116+
"@typescript-eslint/no-unsafe-assignment": "off",
117+
"@typescript-eslint/no-unsafe-call": "off",
115118
"@typescript-eslint/no-unsafe-member-access": "off",
116-
"@typescript-eslint/no-unsafe-return": "warn",
119+
"@typescript-eslint/no-unsafe-return": "off",
117120
"@typescript-eslint/no-unused-expressions": "warn",
118-
"@typescript-eslint/no-unused-vars": "warn",
121+
"@typescript-eslint/no-unused-vars": [
122+
"warn",
123+
{
124+
"args": "after-used", "argsIgnorePattern": "^_"
125+
}
126+
],
119127
"@typescript-eslint/no-use-before-define": "off",
120128
"@typescript-eslint/no-var-requires": "warn",
121129
"@typescript-eslint/prefer-as-const": "warn",
122130
"@typescript-eslint/prefer-for-of": "warn",
123-
"@typescript-eslint/prefer-function-type": "warn",
124131
"@typescript-eslint/prefer-namespace-keyword": "warn",
125132
"@typescript-eslint/prefer-regexp-exec": "off",
126133
"@typescript-eslint/quotes": [
@@ -131,10 +138,9 @@ module.exports = {
131138
],
132139
"@typescript-eslint/require-await": "warn",
133140
"@typescript-eslint/restrict-plus-operands": "warn",
134-
"@typescript-eslint/restrict-template-expressions": "warn",
141+
"@typescript-eslint/restrict-template-expressions": "off",
135142
"@typescript-eslint/semi": [
136-
"warn",
137-
"always"
143+
"error",
138144
],
139145
"@typescript-eslint/triple-slash-reference": [
140146
"warn",
@@ -145,21 +151,16 @@ module.exports = {
145151
}
146152
],
147153
"@typescript-eslint/type-annotation-spacing": "warn",
148-
"@typescript-eslint/unbound-method": "warn",
154+
"@typescript-eslint/unbound-method": "off",
149155
"@typescript-eslint/unified-signatures": "warn",
150-
"arrow-body-style": "warn",
151-
"arrow-parens": [
152-
"warn",
153-
"always"
154-
],
156+
"arrow-parens": "off",
155157
"brace-style": [
156158
"off",
157159
"1tbs"
158160
],
159161
"comma-dangle": "off",
160162
"complexity": "off",
161163
"constructor-super": "warn",
162-
"curly": "warn",
163164
"eol-last": "warn",
164165
"eqeqeq": [
165166
"warn",
@@ -178,7 +179,7 @@ module.exports = {
178179
"Undefined",
179180
],
180181
"id-match": "warn",
181-
"import/order": "warn",
182+
"import/order": "off",
182183
"jsdoc/check-alignment": "warn",
183184
"jsdoc/check-indentation": "warn",
184185
"jsdoc/newline-after-description": "warn",
@@ -189,7 +190,6 @@ module.exports = {
189190
"max-len": "off",
190191
"new-parens": "warn",
191192
"no-array-constructor": "off",
192-
"no-bitwise": "warn",
193193
"no-caller": "warn",
194194
"no-cond-assign": "warn",
195195
"no-console": "off",
@@ -201,44 +201,26 @@ module.exports = {
201201
"no-fallthrough": "off",
202202
"no-implied-eval": "off",
203203
"no-invalid-this": "off",
204-
"no-multiple-empty-lines": "warn",
204+
"no-multiple-empty-lines": ["error", { "max": 1 }],
205205
"no-new-wrappers": "warn",
206-
"no-shadow": [
207-
"warn",
208-
{
209-
"hoist": "all"
210-
}
211-
],
212-
"no-throw-literal": "warn",
206+
"no-shadow": "off",
213207
"no-trailing-spaces": "warn",
214208
"no-undef-init": "warn",
215-
"no-underscore-dangle": "warn",
209+
"no-underscore-dangle": "off",
216210
"no-unsafe-finally": "warn",
217211
"no-unused-labels": "warn",
218-
"no-unused-vars": "off",
219212
"no-var": "warn",
220-
"object-shorthand": ["warn", "never"],
221-
"one-var": [
222-
"warn",
223-
"never"
224-
],
225-
"prefer-arrow/prefer-arrow-functions": "off",
226-
"prefer-const": "warn",
213+
"object-shorthand": "off",
214+
"one-var": "off",
215+
"prefer-const": "off",
227216
"prefer-rest-params": "warn",
228217
"quote-props": [
229218
"warn",
230219
"consistent-as-needed"
231220
],
232221
"radix": "warn",
233222
"require-await": "off",
234-
"space-before-function-paren": [
235-
"warn",
236-
{
237-
"anonymous": "never",
238-
"asyncArrow": "always",
239-
"named": "never"
240-
}
241-
],
223+
"space-before-function-paren": "off",
242224
"spaced-comment": [
243225
"warn",
244226
"always",

dist/powerbi-client.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1566,11 +1566,13 @@ declare module "report" {
15661566
private isMobileSettings;
15671567
/**
15681568
* Return the current zoom level of the report.
1569+
*
15691570
* @returns {Promise<number>}
15701571
*/
15711572
getZoom(): Promise<number>;
15721573
/**
15731574
* Sets the report's zoom level.
1575+
*
15741576
* @param zoomLevel zoom level to set
15751577
*/
15761578
setZoom(zoomLevel: number): Promise<void>;

dist/powerbi.js

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/powerbi.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/FilterBuilders/filterBuilder.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { IFilterTarget } from "powerbi-models";
55

66
/**
77
* Generic filter builder for BasicFilter, AdvancedFilter, RelativeDate, RelativeTime and TopN
8-
*
8+
*
99
* @class
1010
*/
1111
export class FilterBuilder {
@@ -26,21 +26,21 @@ export class FilterBuilder {
2626
*
2727
* @returns {FilterBuilder}
2828
*/
29-
withTargetObject(target: IFilterTarget) {
29+
withTargetObject(target: IFilterTarget): this {
3030
this.target = target;
3131
return this;
3232
}
3333

3434
/**
3535
* Sets target property for filter with column target object
36-
*
36+
*
3737
* ```
3838
* const filterBuilder = new FilterBuilder().withColumnTarget(tableName, columnName);
3939
* ```
4040
*
4141
* @returns {FilterBuilder}
4242
*/
43-
withColumnTarget(tableName: string, columnName: string) {
43+
withColumnTarget(tableName: string, columnName: string): this {
4444
this.target = { table: tableName, column: columnName };
4545
return this;
4646
}
@@ -54,7 +54,7 @@ export class FilterBuilder {
5454
*
5555
* @returns {FilterBuilder}
5656
*/
57-
withMeasureTarget(tableName: string, measure: string) {
57+
withMeasureTarget(tableName: string, measure: string): this {
5858
this.target = { table: tableName, measure: measure };
5959
return this;
6060
}
@@ -68,7 +68,7 @@ export class FilterBuilder {
6868
*
6969
* @returns {FilterBuilder}
7070
*/
71-
withHierarchyLevelTarget(tableName: string, hierarchy: string, hierarchyLevel: string) {
71+
withHierarchyLevelTarget(tableName: string, hierarchy: string, hierarchyLevel: string): this {
7272
this.target = { table: tableName, hierarchy: hierarchy, hierarchyLevel: hierarchyLevel };
7373
return this;
7474
}
@@ -82,7 +82,7 @@ export class FilterBuilder {
8282
*
8383
* @returns {FilterBuilder}
8484
*/
85-
withColumnAggregation(tableName: string, columnName: string, aggregationFunction: string) {
85+
withColumnAggregation(tableName: string, columnName: string, aggregationFunction: string): this {
8686
this.target = { table: tableName, column: columnName, aggregationFunction: aggregationFunction };
8787
return this;
8888
}
@@ -96,7 +96,7 @@ export class FilterBuilder {
9696
*
9797
* @returns {FilterBuilder}
9898
*/
99-
withHierarchyLevelAggregationTarget(tableName: string, hierarchy: string, hierarchyLevel: string, aggregationFunction: string) {
99+
withHierarchyLevelAggregationTarget(tableName: string, hierarchy: string, hierarchyLevel: string, aggregationFunction: string): this {
100100
this.target = { table: tableName, hierarchy: hierarchy, hierarchyLevel: hierarchyLevel, aggregationFunction: aggregationFunction };
101101
return this;
102102
}

src/embed.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ export abstract class Embed {
525525
const extensionsArray = this.config?.settings?.extensions as models.IExtension[];
526526
if (Array.isArray(extensionsArray)) {
527527
this.commands = [];
528-
extensionsArray.map((extension: models.IExtension) => { if (extension?.command) { this.commands.push(extension.command) } });
528+
extensionsArray.map((extension: models.IExtension) => { if (extension?.command) { this.commands.push(extension.command); } });
529529
}
530530

531531
if (isBootstrap) {
@@ -707,10 +707,10 @@ export abstract class Embed {
707707
*
708708
* @hidden
709709
*/
710-
private setIframe(isLoad: boolean, phasedRender?: boolean, isBootstrap?: boolean, registerQueryCallback?: boolean): void {
710+
private setIframe(isLoad: boolean, phasedRender?: boolean, isBootstrap?: boolean): void {
711711
if (!this.iframe) {
712712
const iframeContent = document.createElement("iframe");
713-
let embedUrl = this.config.uniqueId ? addParamToUrl(this.config.embedUrl, 'uid', this.config.uniqueId) : this.config.embedUrl;
713+
const embedUrl = this.config.uniqueId ? addParamToUrl(this.config.embedUrl, 'uid', this.config.uniqueId) : this.config.embedUrl;
714714

715715
iframeContent.style.width = '100%';
716716
iframeContent.style.height = '100%';

src/page.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class Page implements IPageNode, IFilterable {
9191
*
9292
* @type {ICustomPageSize}
9393
*/
94-
mobileSize: ICustomPageSize;
94+
mobileSize: ICustomPageSize;
9595

9696
/**
9797
* Page display options as saved in the report.

0 commit comments

Comments
 (0)