What exactly is this prettier error?:
error Insert '·' prettier/prettier
Does it expect a space after () in?:
beforeEach(function() {
What's the way to ignore that in eslint/prettier?
Prettier expects a space before the functions' ()
, i.e., between the word function
and the opening parenthesis:
beforeEach(function () {
// Here -------^
Insert
·eslintprettier/prettier
is an error which you will get if you haven't given proper spacing. Here it denotes space by .
In your case, the prettier formatter expects you to give space in the function and ()
inside the beforeEach()
. So changing your code from -
beforeEach(function() {
to
beforeEach(function () {
would solve the issue.
Note: In most text editors, you have the option to format on save by which you can set the text editor to automatically format the code as per the default formatted so that you won't need to worry about solving these issues. Once you save the document, your code will get auto-formatted.
Also, you can ignore if you don't want to format as per the change suggested. For eg. In VSCode, you will get options if you hover over the error -
You can choose to fix the problem, disable it for the line or even for entire file.