js-conventions
JavaScript Code Style
Use following conventions for JavaScript and TypeScript code.
Preparations
- Add to dev dependencies in package.json if not added:
- eslint-config-metarhia
- eslint, prettier
- Add scripts in package.json if not added:
- "lint": "eslint . && prettier --check "/*.js" "/.json" "**/.md" "*/.ts""
- "fix": "eslint . --fix && prettier --write "/*.js" "/.json" "**/.md" "*/.ts""
- Before and after code analysis with AI run
npm run lintandnpm t - Use
npm run fixif errors/warnings detected to auto-fix when possible
Formatting
- Use single quotes and semicolons
- Keep max line length 80 (ignore URLs)
More from metarhia/metaskills
js-gof
Apply Gang of Four and related design patterns in JavaScript and TypeScript. Use when implementing creational, structural, or behavioral patterns, or when the user mentions factories, builder, prototype, flyweight, singleton, object pool, adapter, wrapper, decorator, proxy, bridge, composite, facade, chain of responsibility, command, interpreter, iterator, mediator, memento, EventEmitter, EventTarget, state, strategy, template method, visitor, revealing constructor, actor, service locator, or any other pattern.
13js-data-structures
Implement and use data structures in JavaScript. Use when working with arrays, sets, maps, other collections, queues, lists, trees, graphs, circular buffers, caches, or when the user mentions data structures, BTree, or choosing between Map/Object/Set/Array.
6error-handling
Apply error handling and recovery patterns in JavaScript/TypeScript or Node.js. Use when implementing error handling, retry logic, or when the user mentions domain errors, error recovery, error escalation.
5npm-publish
Prepare an npm package for publishing. Handles version bump, CHANGELOG update, typings check, test run, README refresh, package.json audit, and npm pack verification. Use when the user asks to prepare a release, bump version, publish a package, or do release prep.
4