This is a JavaScript template repository that provides a basic structure for starting a new JavaScript project. It includes configuration for testing with Jest, linting with ESLint and Prettier, and a GitHub Actions workflow for automatically running tests on every pull request. Yarn is the package manager used for managing dependencies in this template.
To use this template repository for your own project, follow these steps:
-
Click the "Use this template" button on GitHub to create a new repository based on this template.
-
Clone your new repository to your local machine:
git clone https://github.com/your-username/your-new-repo.git
-
Navigate to the cloned repository:
cd your-new-repo
-
Install project dependencies using Yarn:
yarn install
-
Start adding your JavaScript code to the
src
directory. You can create new files and modules under thesrc
directory as needed. -
To expose your modules, update the
index.js
file in the root directory. For example:import * as hello from './src/hello.js'; import * as yourNewModule from './src/yourNewModule.js' export default { hello, yourNewModule };
This template includes Jest for testing your JavaScript code. Test files should be placed under the src/__tests__
directory. You can run tests using the following command:
yarn test
Jest will automatically discover and run all test files under src/__tests__
.
This template uses ESLint and Prettier for code linting and formatting. It also includes the eslint-plugin-unicorn
for additional linting rules. You can check and fix linting issues using the following commands:
To check for linting issues:
yarn lint
To automatically fix some of the linting issues:
yarn lint:fix
A GitHub Actions workflow is included in this template that runs the tests on every pull request. You don't need to configure anything for this to work; it's set up to run automatically.
This project is licensed under the MIT License - see the LICENSE file for details.