var shebangRegex = /^\n*#!\s*(?:\/usr\/bin\/env)?\s*(?:[^\n]*\/)*([^\/\n]+)(?:\n|$)/;
The shebang must be the first line because it is interpreted by the kernel, which looks at the two bytes at the start of an executable file. If these are #! the rest of the line is interpreted as the executable to run and with the script file available to that program.
Maybe this is the intention to detect also then the syntax is not completely to the standard because you want to document not to lint the code.
See this only as a hint. I don't know if this is good or bad.
I honestly don't know why that \n* is in there at all - as you say it has to be the first two bytes of the file so it definitely makes sense to take that out
in docker.js line 604 it is defined as
The shebang must be the first line because it is interpreted by the kernel, which looks at the two bytes at the start of an executable file. If these are #! the rest of the line is interpreted as the executable to run and with the script file available to that program.
Maybe this is the intention to detect also then the syntax is not completely to the standard because you want to document not to lint the code.
See this only as a hint. I don't know if this is good or bad.