Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nikolay-borzov/template-javascript
Template for my JavaScript projects
https://github.com/nikolay-borzov/template-javascript
Last synced: 19 days ago
JSON representation
Template for my JavaScript projects
- Host: GitHub
- URL: https://github.com/nikolay-borzov/template-javascript
- Owner: nikolay-borzov
- License: mit
- Created: 2021-02-06T10:43:48.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-12-17T17:52:48.000Z (11 months ago)
- Last Synced: 2024-10-12T17:47:24.477Z (25 days ago)
- Language: JavaScript
- Size: 1010 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JavaScript template
[![ru](https://img.shields.io/badge/lang-ru-%23d52b1e)](./README.ru.md)
[![NPM version][npm-image]][npm-url]
[![Style Guide][style-guide-image]][style-guide-url]
[![Inline docs][docs-image]][docs-url][npm-image]: https://img.shields.io/npm/v/@nikolay-borzov/template-javascript.svg
[npm-url]: https://npmjs.org/package/@nikolay-borzov/template-javascript
[style-guide-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[style-guide-url]: https://standardjs.com
[docs-image]: https://inch-ci.org/github/nikolay-borzov/template-javascript.svg?branch=master
[docs-url]: https://inch-ci.org/github/nikolay-borzov/template-javascriptA template for JavaScript project with essential (IMHO) configuration and dependencies. No transforming or bundling.
# Node.js
- Require version >= 20
- [`type: module`](https://nodejs.org/api/esm.html)
- [`exports`](https://nodejs.org/docs/latest-v12.x/api/packages.html#packages_main_entry_point_export) in addition to `main` field# Linting and formatting
Lint with [ESLint](https://eslint.org). Format with [Prettier](https://prettier.io/) (as part of ESLint linting process).
## Rules set
- [`eslint:recommended`](https://eslint.org/docs/rules/)
- [`plugin:jsdoc/recommended`](https://github.com/gajus/eslint-plugin-jsdoc)
- [`plugin:unicorn/recommended`](https://github.com/sindresorhus/eslint-plugin-unicorn)
- [`prettier-standard/prettier-file`](https://github.com/npetruzzelli/eslint-config-prettier-standard)
- Some sensible overrides (See [`.eslintrc.cjs`](.eslintrc.cjs))# Testing
Test with [ava](https://github.com/avajs/ava). Tests are in a separate directory.
## Coverage
Collect coverage with [c8](https://github.com/bcoe/c8). [nyc](https://github.com/istanbuljs/nyc) can't be used until [#1353](https://github.com/istanbuljs/nyc/issues/1353) and [1287](https://github.com/istanbuljs/nyc/issues/1287) issues are resolved.
# `pre-commit` hook
Using [lint-staged](https://github.com/okonet/lint-staged) and [husky](https://github.com/typicode/husky):
- Lint staged code and run tests
- Lint all files when ESLint config is changed
- Format all supported files with [prettier](https://prettier.io/4)# `commit-msg` hook
Lint commit message to be [conventional](https://www.conventionalcommits.org/en/v1.0.0/)
# Configs
Keep config files in the root.
# `jsconfig.json`
- Define JavaScript project
- Include only `src` and `tests` directories
- Enable type checking on JavaScript files
- Enable all strict type checking options