I am trying to create a web part to deploy to SharePoint Online. Following this Connect your web part to SharePoint.

When I add the code below. I receive the errors below.

Do you have to have Office 365 Admin permissions to this to run? I am a Site Collection Administrator. Or maybe it's something else?

Error TS6133: '_getListData' is declared but its value is never read. Error @typescript-eslint/no-empty-function: Unexpected empty arrow function.

private _getListData(): Promise<ISPLists> {
  return this.context.spHttpClient.get(`${this.context.pageContext.web.absoluteUrl}/_api/web/lists?$filter=Hidden eq false`, SPHttpClient.configurations.v1)
    .then((response: SPHttpClientResponse) => {
      return response.json();
    .catch(() => {});

2 Answers 2


It's definitely not a permission issue. Something is tripping up eslint when your web part is being built.

Specifically (per the error message) it seems to be violating the no-empty-function rule.

If we take a look at that rule here: https://eslint.org/docs/latest/rules/no-empty-function

it starts to look like maybe it's that catch block that is the empty function violating the rule?

Maybe try changing the catch to

.catch((err) => { console.log(err); });

just so it's not empty?


If you are new to SPFx and started learning it, my suggestion is to use the PnP JS, the more convenient way to work with SharePoint list, libraries, user profile, taxonomy etc..

private GetLists():Promise<any>{
    return sp.web.lists.filter(‘Hidden eq false’).get().then((data) =>{
      console.log(“Total number of
lists are “ + data.length);
      return data;

Below are the few links for your reference :

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.