Am I pretty?
Queen: Magic mirror on the wall, who’s the fairest one of all?
— Snow White and the Seven Dwarfs, 1937
The first thing to note about the script box.js
is the comment line:
1
// eslint-disable-next-line
The term eslint
refers to ESLint, a tool to analyze JavaScript code and help you find bugs/problems in your code. You might also want to use Prettier to help you to automatically and consistently format all your JavaScript files. The ESLint/Prettier combination helps to enforce a common style for all your JavaScript code.
The above comment line tells ESLint to ignore the line of code immediately below. We want the line
1
const doc = globalThis["document"];
to be as written, without any change by ESLint itself. If we remove the comment line // eslint-disable-next-line
, then ESLint would transform the above line of code to
1
const doc = globalThis.document;
which is not what we want.