fix linting errors
This commit is contained in:
parent
8b4b96bce2
commit
ac0d022411
|
@ -1,3 +1,5 @@
|
||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
|
||||||
export interface IHierarchyEntry<T extends IHierarchyEntry<T>> {
|
export interface IHierarchyEntry<T extends IHierarchyEntry<T>> {
|
||||||
links?: IHierarchyEntry<T>[];
|
links?: IHierarchyEntry<T>[];
|
||||||
}
|
}
|
||||||
|
@ -10,7 +12,7 @@ export class navLinkBuilder {
|
||||||
* @param order place order of the new link
|
* @param order place order of the new link
|
||||||
* @returns navLinks
|
* @returns navLinks
|
||||||
*/
|
*/
|
||||||
public static build<T extends IHierarchyEntry<T>>(currentLinks: T[], newLink: T, order: number) {
|
public static build<T extends IHierarchyEntry<T>>(currentLinks: T[], newLink: T, order: number): void {
|
||||||
const lastIndex = currentLinks.length - 1;
|
const lastIndex = currentLinks.length - 1;
|
||||||
const startorder:number = (currentLinks as any).__startorder || 0;
|
const startorder:number = (currentLinks as any).__startorder || 0;
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,9 @@ export class SPService {
|
||||||
private static GetAnchorUrl(headingValue: string): string {
|
private static GetAnchorUrl(headingValue: string): string {
|
||||||
let anchorUrl = `#${headingValue
|
let anchorUrl = `#${headingValue
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.replace(/[{}|\[\]\<\>#@"'^%`?;:\/=~\\\s\s]/g, " ")
|
.replace(/[{}|[\]<>#@"'^%`?;:/=~\\\s\s]/g, " ")
|
||||||
.replace(/^(-|\s)*|(-|\s)*$/g, "")
|
.replace(/^(-|\s)*|(-|\s)*$/g, "")
|
||||||
.replace(/\'|\?|\\|\/| |\&/g, "-")
|
.replace(/'|\?|\\|\/| |&/g, "-")
|
||||||
.replace(/-+/g, "-")
|
.replace(/-+/g, "-")
|
||||||
.replace(/[+]/g, "%2B") // https://github.com/pnp/sp-dev-fx-webparts/issues/3686
|
.replace(/[+]/g, "%2B") // https://github.com/pnp/sp-dev-fx-webparts/issues/3686
|
||||||
.substring(0, 128)}`;
|
.substring(0, 128)}`;
|
||||||
|
@ -56,6 +56,7 @@ export class SPService {
|
||||||
const data = await context.spHttpClient.get(`${context.pageContext.web.absoluteUrl}/_api/sitepages/pages?$select=CanvasContent1&$filter=Url eq '${currentPageUrl}'`, SPHttpClient.configurations.v1);
|
const data = await context.spHttpClient.get(`${context.pageContext.web.absoluteUrl}/_api/sitepages/pages?$select=CanvasContent1&$filter=Url eq '${currentPageUrl}'`, SPHttpClient.configurations.v1);
|
||||||
const jsonData = await data.json();
|
const jsonData = await data.json();
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
let canvasContent1JSON: any[];
|
let canvasContent1JSON: any[];
|
||||||
try {
|
try {
|
||||||
const canvasContent1 = jsonData.value?.[0].CanvasContent1;
|
const canvasContent1 = jsonData.value?.[0].CanvasContent1;
|
||||||
|
|
|
@ -17,17 +17,17 @@ export default class PageNavigator extends React.Component<IPageNavigatorProps,
|
||||||
this.onLinkClick = this.onLinkClick.bind(this);
|
this.onLinkClick = this.onLinkClick.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentDidMount() {
|
public componentDidMount(): void {
|
||||||
this.setState({ anchorLinks: this.props.anchorLinks, selectedKey: this.props.anchorLinks[0] ? this.props.anchorLinks[0].key : '' });
|
this.setState({ anchorLinks: this.props.anchorLinks, selectedKey: this.props.anchorLinks[0] ? this.props.anchorLinks[0].key : '' });
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentDidUpdate(prevProps: IPageNavigatorProps) {
|
public componentDidUpdate(prevProps: IPageNavigatorProps): void {
|
||||||
if (JSON.stringify(prevProps.anchorLinks) !== JSON.stringify(this.props.anchorLinks)) {
|
if (JSON.stringify(prevProps.anchorLinks) !== JSON.stringify(this.props.anchorLinks)) {
|
||||||
this.setState({ anchorLinks: this.props.anchorLinks, selectedKey: this.props.anchorLinks[0] ? this.props.anchorLinks[0].key : '' });
|
this.setState({ anchorLinks: this.props.anchorLinks, selectedKey: this.props.anchorLinks[0] ? this.props.anchorLinks[0].key : '' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onLinkClick(ev: React.MouseEvent<HTMLElement>, item?: INavLink) {
|
private onLinkClick(ev: React.MouseEvent<HTMLElement>, item?: INavLink): void {
|
||||||
this.setState({ selectedKey: item.key });
|
this.setState({ selectedKey: item.key });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue