question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Shebang first line should be excluded from maximum line length

See original GitHub issue

Having the following error message which seems to be correct, and expected, but arguing for a slight change of policy here:

src/server/database.js|1 col 1 error| Line 1 exceeds the maximum line length of 100. (max-len)

I don’t think shebangs should count when checking maximum line length. The motivation for this is given the extreme difficulties (polyglot) multi-line shebangs bring to the table, add to that the common use practice of having shell executable node.js programs, one is inclined to think a configuration such as below, is a viable form of opening a JS file (this is what actually triggered the error).

#!/usr/bin/env NODE_PATH='.' NODE_ENV='development' NODE_CONFIG_DIR='./config' /usr/local/bin/babel-node

The point regarding this is backed even further (I feel) by the fact that a lot of these so-called environment variables, usually found in either system-, or user-wide shell scope really don’t apply so much to quite a few Node.js variables (or how they are used). E.g. I can have plenty of projects all with different env a few with development, others with production. Same goes for config… (ok doesn’t make for very good practice to keep changing around the config path, but you get my drift).

Now it is also considered bad practice to set environment variables from (JS) code, e.g. process.env.NODE_PATH = '.' (doesn’t work actually, too late for that but the following does) or process.env.NODE_ENV = 'development';.

From this, I’ve come to conclude in a most of our use cases, the shebangs are really the most viable solution to cleanly and reliably set these conditions in quickly to run one-off scripts, for testing, debugging, development etc. (the production services all rely on systemd service environment variables).

It goes without saying that I rather not set the whole eslint to allow for e.g. 120 columns or beyond.

Thoughts?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kaicataldocommented, Aug 25, 2016

Closing this because we haven’t moved forward with it in months.

0reactions
robjenscommented, Nov 9, 2016

Ah… thanks for the tip shreevatsa.

Read more comments on GitHub >

github_iconTop Results From Across the Web

(shebang) line length limitation - linux - Super User
Limit of length depends on implementation. I recently investigated similar question and I found this wonderful report by Sven Mascheck about ...
Read more >
Shebang line limit in bash and linux kernel - Stack Overflow
I'm trying to execute python scripts automatically generated by zc.buildout so I don't have control over them. My problem is that the shebang...
Read more >
Multiple arguments in shebang - Unix & Linux Stack Exchange
If the first line of a file of shell commands starts with the characters #! , the results are unspecified. This basically means...
Read more >
Shebang (Unix) - Wikipedia
The shebang line is usually ignored by the interpreter, because the "#" character is a comment marker in many scripting languages; some language...
Read more >
details about the shebang mechanism
Test results on various systems: ; [2], If the shebang line exceeds 255 characters, it gets cut down to exactly 80 characters--or the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found