├── .editorconfig ├── LICENSE └── README.md /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright © 2014 Nicolas Bevacqua 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # function qualityGuide () { 2 | 3 | > A **quality conscious** and _organic_ JavaScript quality guide 4 | 5 | This style guide aims to provide the ground rules for an application's JavaScript code, such that it's highly readable and consistent across different developers on a team. The focus is put on quality and coherence across the different pieces of your application. 6 | 7 | ## Goal 8 | 9 | These suggestions aren't set in stone, they aim to provide a baseline you can use in order to write more consistent codebases. To maximize effectiveness, share the styleguide among your co-workers and attempt to enforce it. Don't become obsessed about code style, as it'd be fruitless and counterproductive. Try and find the sweet spot that makes everyone in the team comfortable developing for your codebase, while not feeling frustrated that their code always fails automated style checking because they added a single space where they weren't supposed to. It's a thin line, but since it's a very personal line I'll leave it to you to do the drawing. 10 | 11 | > Use together with [bevacqua/css][32] for great good! 12 | 13 | Feel free to fork this style guide, or better yet, send [Pull Requests][33] this way! 14 | 15 | ## Table of Contents 16 | 17 | 1. [Modules](#modules) 18 | 2. [Strict Mode](#strict-mode) 19 | 3. [Spacing](#spacing) 20 | 4. [Semicolons](#semicolons) 21 | 5. [Style Checking](#style-checking) 22 | 6. [Linting](#linting) 23 | 7. [Strings](#strings) 24 | 8. [Variable Declaration](#variable-declaration) 25 | 9. [Conditionals](#conditionals) 26 | 10. [Equality](#equality) 27 | 11. [Ternary Operators](#ternary-operators) 28 | 12. [Functions](#functions) 29 | 13. [Prototypes](#prototypes) 30 | 14. [Object Literals](#object-literals) 31 | 15. [Array Literals](#array-literals) 32 | 16. [Regular Expressions](#regular-expressions) 33 | 17. [`console` Statements](#console-statements) 34 | 18. [Comments](#comments) 35 | 19. [Variable Naming](#variable-naming) 36 | 20. [Polyfills](#polyfills) 37 | 21. [Everyday Tricks](#everyday-tricks) 38 | 22. [License](#license) 39 | 40 | ## Modules 41 | 42 | This style guide assumes you're using a module system such as [CommonJS][1], [AMD][2], [ES6 Modules][3], or any other kind of module system. Modules systems provide individual scoping, avoid leaks to the `global` object, and improve code base organization by **automating dependency graph generation**, instead of having to resort to manually creating multiple `