From e7b3f7bffe1899fa87bf32e529d11951d21dbcf9 Mon Sep 17 00:00:00 2001 From: "Jose A. Cabaneros" Date: Mon, 21 Oct 2024 18:14:28 +0200 Subject: [PATCH] fix(readme): update readme --- README.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++++---- src/index.ts | 3 +-- 2 files changed, 53 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index fecf7b7..54858bc 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,17 @@ # @empathyco/eslint-config +![NPM Version](https://img.shields.io/npm/v/%40empathyco%2Feslint-config) +[![code style](https://antfu.me/badge-code-style.svg)](https://github.com/antfu/eslint-config) + +- [ESLint](https://eslint.org/) as code linter sharing configuration preset. +- [Prettier](https://github.com/prettier/prettier) as code formatter sharing configuration preset. - [@antfu/eslint-config](https://github.com/antfu/eslint-config) as default ESLint config preset. -- [Prettier](https://github.com/prettier/prettier) as code formatter sharing config preset. - [@eslint/config-inspector](https://github.com/eslint/config-inspector) the visual tool for inspecting and understanding your ESLint flat configs. +> [!NOTE] +> The ESLint and Prettier dependencies are referenced in the package itself, so there is no +> needed to install them in your project. + ## Usage ### Install @@ -12,7 +20,9 @@ npm i -D eslint @empathyco/eslint-config ``` -And create `eslint.config.mjs` in your project root: +### ESLint config + +Create `eslint.config.mjs` in your project root: ```js // eslint.config.mjs @@ -21,9 +31,19 @@ import { empathyco } from '@empathyco/eslint-config'; export default empathyco(); ``` -### Add script for package.json +### Prettier config + +Reference shared config file into `package.json`: + +```json +{ + "prettier": "@empathyco/eslint-config/prettier" +} +``` + +### Add scripts for `package.json` -For example: +This is a script set that you can add to your repository: ```json { @@ -36,3 +56,31 @@ For example: } } ``` + +### Customization + +Configure the initial preset with the same parameters as expose [@antfu/eslint-config](https://github.com/antfu/eslint-config/blob/main/README.md#customization) + +Example: + +```js +import { empathyco } from '@empathyco/eslint-config'; + +export default empathyco( + // Configures for empathyco's (antfu) config. + {}, + // From the second arguments they are ESLint Flat Configs. + // You can have multiple configs. + { + rules: { + 'vue/custom-event-name-casing': 'off' + } + }, + { + files: ['**/*.spec.{ts,tsx,js,jsx}'], + rules: { + 'jsdoc/check-param-names': 'off' + } + } +); +``` diff --git a/src/index.ts b/src/index.ts index 96b70b4..36649da 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,6 +33,5 @@ export async function empathyco(options: AntfuParams[0] = {}, ...userConfigs: An /** * Pending: - * Stylelint? - * Publish NPM package (GitHub actions) + * Stylelint */