Skip to content

Commit 257c74a

Browse files
committed
all warnings are resolved
1 parent 86faaf5 commit 257c74a

34 files changed

+398
-376
lines changed

.eslintrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = {
2424
// Require Jest module mocking APIs to be called before any other statements in their code block. https://www.npmjs.com/package/@rushstack/eslint-plugin
2525
'@rushstack/hoist-jest-mock': 1,
2626
// Require regular expressions to be constructed from string constants rather than dynamically building strings at runtime. https://www.npmjs.com/package/@rushstack/eslint-plugin-security
27-
'@rushstack/security/no-unsafe-regexp': 1,
27+
'@rushstack/security/no-unsafe-regexp': 0,
2828
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json
2929
'@typescript-eslint/adjacent-overload-signatures': 1,
3030
// STANDARDIZED BY: @typescript-eslint\eslint-plugin\dist\configs\recommended.json

src/common/Interfaces.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import { ISPField } from './SPEntities';
1010
export interface IContext {
1111
spHttpClient: SPHttpClient;
1212
pageContext: PageContext;
13-
listView?: ListViewAccessor | null;
14-
field?: SPField | null;
13+
listView?: ListViewAccessor | undefined;
14+
field?: SPField | undefined;
1515
}
1616

1717
/**
@@ -26,4 +26,4 @@ export interface IFields {
2626
*/
2727
export interface IProps {
2828
context: IContext;
29-
}
29+
}

src/common/SPEntities.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export interface ICultureDateTimeFormat {
155155
TimeSeparator: string;
156156
UniversalSortableDateTimePattern: string;
157157
YearMonthPattern: string;
158-
eras: any[];
158+
eras: any[]; // eslint-disable-line @typescript-eslint/no-explicit-any
159159
}
160160

161161
/**

src/common/dal/ListItemRepository.ts

+38-30
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,45 @@
11
import { SPHttpClient } from '@microsoft/sp-http';
22

33
export class ListItemRepository {
4-
constructor(protected SiteUrl: string, protected SPClient: SPHttpClient) {
4+
constructor(protected SiteUrl: string, protected SPClient: SPHttpClient) {
55

6-
}
7-
/**
8-
*
9-
* @param filterText text value of the filter part of oData query 'Id eq 1'
10-
* @param listId
11-
* @param internalColumnName
12-
* @param keyInternalColumnName
13-
* @param webUrl
14-
* @param top
15-
* @param orderBy text value of the filter part of oData query 'Title desc, Created'
16-
*/
17-
public async getListItemsByFilterClause(filterText: string, listId: string, internalColumnName: string, keyInternalColumnName?: string, webUrl?: string, top?: number, orderBy?: string): Promise<any[]> {
18-
try {
19-
const webAbsoluteUrl = !webUrl ? this.SiteUrl : webUrl;
20-
let apiUrl = `${webAbsoluteUrl}/_api/web/lists('${listId}')/items?$select=${keyInternalColumnName || 'Id'},${internalColumnName}&$filter=${filterText}&$top=${top}`;
21-
if (orderBy) {
22-
apiUrl += `&$orderBy=${orderBy}`;
23-
}
24-
const data = await this.SPClient.get(apiUrl, SPHttpClient.configurations.v1);
25-
if (data.ok) {
26-
const results = await data.json();
27-
if (results && results.value && results.value.length > 0) {
28-
return results.value;
29-
}
30-
}
31-
32-
return [];
33-
} catch (error) {
34-
return Promise.reject(error);
6+
}
7+
/**
8+
*
9+
* @param filterText text value of the filter part of oData query 'Id eq 1'
10+
* @param listId
11+
* @param internalColumnName
12+
* @param keyInternalColumnName
13+
* @param webUrl
14+
* @param top
15+
* @param orderBy text value of the filter part of oData query 'Title desc, Created'
16+
*/
17+
public async getListItemsByFilterClause(
18+
filterText: string,
19+
listId: string,
20+
internalColumnName: string,
21+
keyInternalColumnName?: string,
22+
webUrl?: string,
23+
top?: number,
24+
orderBy?: string
25+
): Promise<any[]> { // eslint-disable-line @typescript-eslint/no-explicit-any
26+
try {
27+
const webAbsoluteUrl = !webUrl ? this.SiteUrl : webUrl;
28+
let apiUrl = `${webAbsoluteUrl}/_api/web/lists('${listId}')/items?$select=${keyInternalColumnName || 'Id'},${internalColumnName}&$filter=${filterText}&$top=${top}`;
29+
if (orderBy) {
30+
apiUrl += `&$orderBy=${orderBy}`;
31+
}
32+
const data = await this.SPClient.get(apiUrl, SPHttpClient.configurations.v1);
33+
if (data.ok) {
34+
const results = await data.json();
35+
if (results && results.value && results.value.length > 0) {
36+
return results.value;
3537
}
38+
}
39+
40+
return [];
41+
} catch (error) {
42+
return Promise.reject(error);
3643
}
44+
}
3745
}

src/common/extensions/String.extensions.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ declare global {
1111
}
1212
}
1313

14-
declare var window: any;
14+
declare const window: any; // eslint-disable-line @typescript-eslint/no-explicit-any
15+
16+
/* eslint-disable no-extend-native */
1517

1618
/**
1719
* Parses number in invariant culture
@@ -60,7 +62,7 @@ String.prototype._parseNumber = function (culture: ICultureInfo): number {
6062
}
6163
let intPart: string;
6264
let fractionalPart: string;
63-
let decimalSeparatorIdx: number = base.indexOf(numberFormat.NumberDecimalSeparator);
65+
const decimalSeparatorIdx: number = base.indexOf(numberFormat.NumberDecimalSeparator);
6466
if (decimalSeparatorIdx < 0) {
6567
intPart = base;
6668
fractionalPart = null;
@@ -70,11 +72,11 @@ String.prototype._parseNumber = function (culture: ICultureInfo): number {
7072
fractionalPart = base.substr(decimalSeparatorIdx + numberFormat.NumberDecimalSeparator.length);
7173
}
7274
intPart = intPart.split(numberFormat.NumberGroupSeparator).join('');
73-
var n = numberFormat.NumberGroupSeparator.replace(/\u00A0/g, ' ');
75+
const n = numberFormat.NumberGroupSeparator.replace(/\u00A0/g, ' ');
7476
if (numberFormat.NumberGroupSeparator !== n) {
7577
intPart = intPart.split(n).join('');
7678
}
77-
var result: string = symbol + intPart;
79+
let result: string = symbol + intPart;
7880
if (fractionalPart !== null) {
7981
result += '.' + fractionalPart;
8082
}
@@ -128,3 +130,5 @@ String.prototype._parseNumberNegativePattern = function (numberFormat: ICultureN
128130
}
129131
return ['', this];
130132
};
133+
134+
/* eslint-enable no-extend-native */
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { createTheme, getTheme, ITheme } from "office-ui-fabric-react/lib/Styling";
1+
import { Theme } from "@fluentui/theme";
2+
import { createTheme, getTheme, IPalette, ITheme } from "office-ui-fabric-react/lib/Styling";
23

34
export const fluentUIDefaultTheme = (): ITheme => {
4-
let currentTheme;
5-
const themeColorsFromWindow: any = (window as any).__themeState__.theme;
5+
let currentTheme: Theme;
6+
const themeColorsFromWindow: Partial<IPalette> = window.__themeState__.theme;
67
if (themeColorsFromWindow) {
78
currentTheme = createTheme({
89
palette: themeColorsFromWindow
@@ -12,4 +13,4 @@ export const fluentUIDefaultTheme = (): ITheme => {
1213
currentTheme = getTheme();
1314

1415
return currentTheme;
15-
};
16+
};

src/common/mocks/RequestClientMock.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export class RequestClientMock extends SPHttpClient {
44
public Requests: { url: string, method: string, options?: ISPHttpClientOptions, resultString: string }[] = [];
55
public OnRequest: (url: string, method: string, options?: ISPHttpClientOptions) => void;
66
public fetch(url: string, configuration: SPHttpClientConfiguration, options: ISPHttpClientOptions): Promise<SPHttpClientResponse> {
7-
let mockedResponse = this.Requests.filter(req => req.method === options.method && req.url === url)[0];
7+
const mockedResponse = this.Requests.filter(req => req.method === options.method && req.url === url)[0];
88
let response: Response;
99
if (mockedResponse) {
1010
response = new Response(mockedResponse.resultString, {

src/common/model/ITeam.ts

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
2-
31
export interface ITeam {
42
id: string;
53
createdDateTime?: string;
64
displayName: string;
75
description: string;
86
internalId?: string;
97
classification?: string;
10-
specialization?: any;
11-
visibility?: any;
8+
specialization?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
9+
visibility?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
1210
webUrl?: string;
1311
isArchived: boolean;
14-
isMembershipLimitedToOwners?: any;
15-
memberSettings?: any;
16-
guestSettings?: any;
17-
messagingSettings?: any;
18-
funSettings?: any;
19-
discoverySettings?: any;
12+
isMembershipLimitedToOwners?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
13+
memberSettings?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
14+
guestSettings?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
15+
messagingSettings?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
16+
funSettings?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
17+
discoverySettings?: any; // eslint-disable-line @typescript-eslint/no-explicit-any
2018
}
2119

src/common/model/ITeamMember.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export interface ITeamMenber {
22
'@odata.type': string;
33
id: string;
4-
roles: any[];
4+
roles: any[]; // eslint-disable-line @typescript-eslint/no-explicit-any
55
displayName: string;
66
userId: string;
77
email: string;

src/common/telemetry/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const CONTROL_TYPE = "react";
1111
* @param componentName
1212
* @param properties
1313
*/
14-
export function track(componentName: string, properties: any = {}): void {
14+
export function track(componentName: string, properties: any = {}): void { // eslint-disable-line @typescript-eslint/no-explicit-any
1515
const telemetry = PnPTelemetry.getInstance();
1616
telemetry.trackEvent(componentName, {
1717
version,
@@ -22,7 +22,7 @@ export function track(componentName: string, properties: any = {}): void {
2222
});
2323
}
2424

25-
export const useTelemetry = (componentName: string, properties: any = {}) => {
25+
export const useTelemetry = (componentName: string, properties: any = {}): void => { // eslint-disable-line @typescript-eslint/no-explicit-any
2626
const [hasBeenCalled, setHasBeenCalled] = React.useState<boolean>(false);
2727

2828
if (hasBeenCalled) {

0 commit comments

Comments
 (0)