No, this is not a mistake. The “X” icon requires a placeholder option. Without it, the clearAllow option cannot be used. So the correct code would be like this:
$(".js-example-placeholder-single").select2({ placeholder: "Put some text...", allowClear : true });
By the way, there is an undocumented option called debug. If you pass it to the select2 () method, the errors found will be printed to the console. For example, the code below:
$(".js-example-placeholder-single").select2({ //placeholder: "Put some text...", allowClear : true, debug: true });
Will get to the browser console:

Why does allowClear require a placeholder option?
The real drop-down list created with the <select> and <option> elements is hidden using select2. And created a new one.
In the drop-down list created by the new creator, the field that the user sees (without the drop-down list) is automatically created. Each time you select a new option, select2 will change the previous field to a new one.
When the X icon is clicked, it will also delete the main field. And creates a new field with placeholder parameters.
source share