{"id":16758459,"url":"https://github.com/kessler/nodejs-coding-guidelines","last_synced_at":"2026-02-09T09:05:28.743Z","repository":{"id":13249431,"uuid":"15934326","full_name":"kessler/nodejs-coding-guidelines","owner":"kessler","description":"Node.js coding conventions and guidelines","archived":false,"fork":false,"pushed_at":"2014-01-15T13:26:55.000Z","size":103,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T18:18:55.535Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"ironSource/nodejs-coding-guidelines","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kessler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-15T12:18:19.000Z","updated_at":"2022-11-02T20:00:49.000Z","dependencies_parsed_at":"2023-01-14T10:45:14.959Z","dependency_job_id":null,"html_url":"https://github.com/kessler/nodejs-coding-guidelines","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kessler/nodejs-coding-guidelines","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kessler%2Fnodejs-coding-guidelines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kessler%2Fnodejs-coding-guidelines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kessler%2Fnodejs-coding-guidelines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kessler%2Fnodejs-coding-guidelines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kessler","download_url":"https://codeload.github.com/kessler/nodejs-coding-guidelines/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kessler%2Fnodejs-coding-guidelines/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29260426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T04:11:57.159Z","status":"ssl_error","status_checked_at":"2026-02-09T04:11:56.117Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T04:05:25.319Z","updated_at":"2026-02-09T09:05:28.729Z","avatar_url":"https://github.com/kessler.png","language":null,"readme":"Node.js Coding guidelines\n==========================\n\n## Tab size is 4 space\nDo not indent using mixed spaces and tabs ever\n\n## New lines\nOnly linux newline terminator `\\n` is allow in a repository. Windows `\\n\\r` is forbidden\n\n## No trailing whitespace\nDo not leaving trailing whitespace at the end of files or lines of code.\n\n## Semicolons\nUsing semicolons is a long time argument in the javascript community. If you don't want to use semicolons, make sure that you understand the [rules](http://inimino.org/~inimino/blog/javascript_semicolons) PERFECTLY.\n\n## Use single quotes\nUse only single quotes, unless its a .json file.\n\n*Right*\n```js\nvar x = 'lalala';\n```\n\n*Wrong*\n```js\nvar x = \"lalala\";\n```\n\n## Opening braces go on the same line\n*Right*\n```js\nfunction foo () {\n}\n```\n\n*Wrong*\n```js\nfunction foo()\n{\n}\n```\n## Variables \n\nTBD\n\n## Use UpperCamelCase for script files the contain a single class definition\n*Right*\n```\nFooBar.js\n```\n\n*wrong*\n```\nfooBar.js\nfoo_bar.js\n```\n\n## Use lowerCamelCase for script files with mixed content (not the above)\n\n## Use lowerCamelCase for variables, properties and function names\n\nVariables, properties and function names should use `lowerCamelCase`.  They\nshould also be descriptive. Single character variables and uncommon\nabbreviations should generally be avoided.\n\n*Right:*\n```js\nvar fooBar = 1;\n```\n\n*Wrong:*\n```js\nvar foo_bar = 1;\n```\n\n## Use UpperCamelCase for class names\n\nClass names should be capitalized using `UpperCamelCase`.\n\n*Right:*\n```js\nfunction MyClass() {\n}\n```\n\n*Wrong:*\n```js\nfunction myClass() {\n}\n```\n\n*Wrong:*\n```js\nfunction my_Class() {\n}\n```\n\n## Use UPPERCASE for Constants\n\nConstants should be declared as regular variables or static class properties,\nusing all uppercase letters.\n\nNode.js / V8 actually supports mozilla's [const][const] extension, but\nunfortunately that cannot be applied to class members, nor is it part of any\nECMA standard.\n\n*Right:*\n```js\nvar SECOND = 1 * 1000;\n\nfunction File() {\n}\nFile.FULL_PERMISSIONS = 0777;\n```\n\n*Wrong:*\n```js\nconst SECOND = 1 * 1000;\n\nfunction File() {\n}\nFile.fullPermissions = 0777;\n```\n\n[const]: https://developer.mozilla.org/en/JavaScript/Reference/Statements/const\n\n## Object / Array creation\n\nUse trailing commas and put *short* declarations on a single line. Only quote\nkeys when your interpreter complains:\n\n*Right:*\n```js\nvar a = ['hello', 'world'];\nvar b = {\n  good: 'code',\n  'is generally': 'pretty',\n};\n```\n\n*Wrong:*\n\n```js\nvar a = [\n  'hello', 'world'\n];\nvar b = {\"good\": 'code'\n        , is generally: 'pretty'\n        };\n```\n\n## Use the === operator\n\nAlmost always use the triple equality operator as it will work just as expected. Only rarely will you need ==\n\n*Right:*\n```js\nvar a = 0;\nif (a === '') {\n  console.log('winning');\n}\n\n```\n\n*Wrong:*\n```js\nvar a = 0;\nif (a == '') {\n  console.log('losing');\n}\n```\n\n## Specify all require statements at the start of a file\n\n*Right:*\n```js\n  var dependency = require('dependency');\n  \n  var x = dependency.foo();\n```\n\n*Wrong:*\n```js\nvar a = { b: 'c' };\n\nconsole.log(require('util').inspect(a));\n```\n\n*Wrong:*\n```js\nfunction x() {\n}\n\nvar fs = require('fs');\n```\n\n## Module exports should be at start of a file\nPreferably as close as possible to the require statements.\n\nSome ideas and varbatim text taken from:\n[felixge node style guide](https://github.com/felixge/node-style-guide/blob/master/Readme.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkessler%2Fnodejs-coding-guidelines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkessler%2Fnodejs-coding-guidelines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkessler%2Fnodejs-coding-guidelines/lists"}