1

After upgrading ESLint and other packages in my project I started getting the following error in some of my components:

'InsertClassNameHere' was used before it was defined

ESLint Error

The problem is that I need to access the getters from inside the class below the @Component decorator. This only worked if I explicitly set the type on the Component decorator like so:

@Component<InsertClassNameHere>

After the upgrade it no longer works because of the ESLint error.

When I remove the class name reference from the @Component decorator, the getters are no longer accessible:

ESLint Error 2

Do you know how I can either reference the class name below the decorator or access the getters of the component without referencing it?

1 Answer 1

2

This is probably due the ESLint rule no-use-before-define. Your code seems to be relying on accessing hoisted identifiers before they are defined. Therefore it might be best to disable that rule entirely for your SFCs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.