UNPKG

@under-io/eslint

Version:

Under engineering ESLint configurations

132 lines (85 loc) 5.36 kB
<a name="readme-top"></a> <!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://under.io"> <img src="https://assets-global.website-files.com/651c689e4d564732c9cbe9ec/6539093da716523a452427b4_under-footer-icon-bg.svg" alt="Logo" width="80" height="80"> </a> <h2 align="center">@under-io/eslint</h2> <p align="center"> A collection of ESLint rulesets designed to help efficiently scaffold Under Engineering projects. <br /> <br /> <a href="#">Report Bug</a> · <a href="#">Request Feature</a> </p> </div> <!-- TABLE OF CONTENTS --> <details> <summary>Table of Contents</summary> <ol> <li> <a href="#implementation">Implementation</a> </li> <li> <a href="#getting-started">Getting Started</a> </li> <li><a href="#installation">Installation</a></li> <li><a href="#making-changes">Making Changes</a></li> <li><a href="#publishing">Publishing to npm</a></li> <li><a href="#license">License</a></li> </ol> </details> <!-- IMPLEMENTATION --> ## Implementation - **Battle tested:** The `@under-io/eslint` rules have been vetted across a broad set of projects, teams, and requirements. These rules embody a way of working that scales. - **Designed for Prettier:** The `@under-io/eslint` ruleset is intentionally designed to be paired with the [Prettier](https://prettier.io/) code formatter. This synergy streamlines development by sparing developers from being inundated with lint "errors" for minor concerns such as spaces and commas. These issues are resolved automatically when you save or commit a file. Prettier also circumvents unnecessary debates, as its default settings have undergone extensive community discussions and widespread adoption, eliminating the need to rehash established conventions. - **Explicit:** The ruleset deliberately refrains from importing any "recommended" templates from other ESLint packages (other than comments). This choice alleviates concerns related to precedence issues arising from import order and mitigates the confusion associated with files overriding or undoing settings from one another. Instead, the ruleset takes a transparent approach by explicitly defining all the rules it deems important, ensuring clarity and consistency in rule configuration. - **Minimal configuration:** To implement this ruleset, you'll need to configure your **eslint.config.mjs** file with two lines of code. Our aim is to streamline repository maintenance by offering a concise collection of **eslint.config.mjs** configurations that can be shared across various projects. Occasionally, this approach may include rules that have no impact on a particular project. However, in practice, the cost of installing and executing unused rules proves to be minimal. <!-- GETTING STARTED --> ## Getting Started Implementing the ruleset into your project is an easy and straightforward process. Start by installing the package, then proceed to generate an **eslint.config.mjs** configuration file and export the Under eslint config. ### Installation To install the package, do this: ```sh $ cd your-project-folder $ npm install --save-dev eslint typescript @under-io/eslint ``` After package installation, create an **eslint.config.mjs** config file in the root of your project and paste the following: **eslint.config.mjs** ```ts import Config from '@under-io/eslint' export default Config ``` The `@under-io/eslint` ruleset is designed and intended to be used in conjunction with the Prettier code formatter. For general instructions on setting that up, please refer to the [Prettier docs](https://prettier.io/docs/en/index.html). <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- TESTING --> ## Making Changes Testing changes locally before publishing is straightforward. The easiest way to test updates is by creating a `.tgz` package using `npm pack` and installing it in a local project. Run the following command in the root of the repository: ```sh npm pack ``` _This generates a .tgz file in the project directory, which bundles the package as it would appear when published._ In a separate project where you want to test the package, paste the `.tgz` file and run: ```sh npm install /path/to/@under-io-eslint-1.0.0.tgz ``` _Replace @under-io-eslint-1.0.0.tgz with the name of the generated .tgz that you copied_ <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- PUBLISHING --> ## Publishing Publishing changes to `@under-io/eslint` follows an automated workflow using [Changesets](https://github.com/changesets/changesets) and our repository pipeline. When you've finished making changes, run the Changeset CLI to generate a new version bump: ```sh npm run changeset ``` _This will prompt you to describe the change and determine whether it's a **patch**, **minor**, or **major** update._ Then commit and push the changes, including the generated changeset file. Once the PR is created, the pipeline takes over and handles publishing to npm automatically. <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- LICENSE --> ## License Distributed under the MIT License. See `LICENSE.txt` for more information. <p align="right">(<a href="#readme-top">back to top</a>)</p> `@under-io/eslint` is part of the [Under](https://under.io/) family of projects.