[Meta] Code style question: Wrap JS code at 80 columns?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.7k
- Forks
- 1.9k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 5
Description
Hi folks.
I've been hacking away on the various JS files, whether for bug-fixes or feature additions, and I've noticed that past authors have been fairly diligent about wrapping their JS code at about 80 columns.
And something else comes to mind as well: we recently ran the gyp and other Python code through Black, a fairly strongly-opinionated Python code formatter that has decided 88 columns is the way to go, at least for that language.
Is it safe to say I should follow in the previous authors' footsteps and try to make lines of JS code fit in 80 columns? (Should I go for 88? I suppose that's more appropriate for Python, where indentation is meaningful to how the code operates. It's a lot easier to fit some of the JS code patterns I have attempted in 88 columns, but admittedly at the expense of readability.)
I'm not sure if I like things like this, but they make my code fit in 80 columns:
var config = process.config ? JSON.parse(JSON.stringify(process.config)) : {}
vs
var config =
process.config ? JSON.parse(JSON.stringify(process.config)) : {}
log.verbose('build dir', '"build" dir needed to be created?', isNew ? 'Yes' : 'No')
vs
log.verbose(
'build dir', '"build" dir needed to be created?', isNew ? 'Yes' : 'No'
)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue discusses wrapping JavaScript at 80 or 88 columns and notes that the Python code was formatted with Black, but it names no files or tests. Start by reviewing the existing JavaScript style and the project's Black formatting choice; done means reaching and documenting a project-wide decision on the preferred JavaScript wrapping style.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, python
- Domain
- tooling
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100