JavaScript style and best practices based on Google's official JavaScript Style Guide...
Comprehensive JavaScript style and best practices guide based on Google's official JavaScript Style Guide, designed for AI agents and LLMs. Contains 47 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
Reference these guidelines when:
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Module System & Imports | CRITICAL | module- |
| 2 | Language Features | CRITICAL | lang- |
| 3 | Type Safety & JSDoc | HIGH | type- |
| 4 | Naming Conventions | HIGH | naming- |
| 5 | Control Flow & Error Handling | MEDIUM-HIGH | control- |
| 6 | Functions & Parameters | MEDIUM | func- |
| 7 | Objects & Arrays | MEDIUM | data- |
| 8 | Formatting & Style | LOW | format- |
module-avoid-circular-dependencies - Prevent loading failures from circular importsmodule-file-extension-in-imports - Include .js extension in import pathsmodule-named-exports-over-default - Prefer named exports for consistencymodule-no-duplicate-imports - Import from same file only oncemodule-no-import-aliasing - Keep original export namesmodule-source-file-structure - Follow standard file structure orderlang-const-over-let-over-var - Use const by default, never varlang-es6-classes-over-prototypes - Use class syntax over prototype manipulationlang-explicit-semicolons - Always use explicit semicolonslang-no-eval - Never use eval or Function constructorlang-no-modify-builtins - Never modify built-in prototypeslang-no-non-standard-features - Use only standard ECMAScript featureslang-no-primitive-wrappers - Never use primitive wrapper objectslang-no-with-statement - Never use the with statementtype-cast-with-parentheses - Use parentheses for type caststype-enum-annotations - Annotate enums with static literal valuestype-explicit-nullability - Use explicit nullability modifierstype-jsdoc-required-for-exports - Require JSDoc for exported functionstype-template-parameters - Always specify template parameterstype-typedef-for-complex-types - Use typedef for complex object typesnaming-constant-case-for-constants - Use CONSTANT_CASE for immutable valuesnaming-descriptive-over-brief - Prefer descriptive names over brevitynaming-file-naming-conventions - Use lowercase with dashes or underscoresnaming-lowercamelcase-for-methods - Use lowerCamelCase for methods and variablesnaming-no-dollar-prefix - Avoid dollar sign prefix in identifiersnaming-uppercamelcase-for-classes - Use UpperCamelCase for classescontrol-comment-empty-catch - Document empty catch blockscontrol-for-of-over-for-in - Prefer for-of over for-incontrol-strict-equality - Use strict equality except for null checkscontrol-switch-default-last - Always include default case in switchcontrol-throw-error-objects - Always throw Error objectsfunc-arrow-functions-for-nested - Prefer arrow functions for nested functionsfunc-arrow-parentheses - Always use parentheses around arrow paramsfunc-default-parameters - Use default parameters instead of conditionalsfunc-rest-parameters-over-arguments - Use rest parameters over argumentsfunc-spread-over-apply - Use spread operator instead of applydata-array-literals-over-constructor - Use array literals over Array constructordata-destructuring-for-multiple-values - Use destructuring for multiple propertiesdata-no-mixing-quoted-unquoted-keys - Never mix quoted and unquoted keysdata-object-literals-over-constructor - Use object literals over constructordata-spread-over-concat-slice - Use spread over concat and slicedata-trailing-commas - Use trailing commas in multi-line literalsformat-braces-required - Always use braces for control structuresformat-column-limit - Limit lines to 80 charactersformat-one-statement-per-line - Place one statement per lineformat-single-quotes - Use single quotes for string literalsformat-two-space-indent - Use two-space indentationRead individual reference files for detailed explanations and code examples:
For a complete compiled guide with all rules, see AGENTS.md.
| File | Description |
|---|---|
| AGENTS.md | Complete compiled guide with all rules |
| references/_sections.md | Category definitions and ordering |
| assets/templates/_template.md | Template for new rules |
| metadata.json | Version and reference information |