From d34f13beaa5bc31921a4a55e12f368ab0d5d3889 Mon Sep 17 00:00:00 2001 From: Toastie Date: Wed, 2 Oct 2024 18:12:48 +1300 Subject: [PATCH] Updated README.md --- README.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c11146d..d583f40 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,76 @@ -# eslint-plugin-valkyriecoms +# @valkyriecoms/eslint-plugin +`@valkyriecoms/eslint-plugin` is an ESLint plugin designed for Valkyriecoms developers. This plugin helps you write code that adheres to the coding style and best practices of the Valkyriecoms project. + +## Installation + +First, install the plugin using npm. + +```bash +npm install --save-dev eslint @valkyriecoms/eslint-plugin @typescript-eslint/parser +``` + +## Usage + +Create `eslint.config.js` file and write as follows + +```javascript:eslint.config.js +import pluginValkyriecoms from '@valkyriecoms/eslint-plugin'; +import tsParser from '@typescript-eslint/parser'; + +export default [ + ...pluginValkyriecoms.configs['recommended'], + { + files: ['**/*.js', '**/*.jsx'], + languageOptions: { + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + }, + }, + }, + { + files: ['**/*.ts', '**/*.tsx'], + languageOptions: { + parserOptions: { + ecmaVersion: 'latest', + parser: tsParser, + project: ['./tsconfig.json'], + sourceType: 'module', + tsconfigRootDir: import.meta.dirname, + }, + }, + }, +]; +``` + +In tsconfig, strictNullChecks must be true. + +```json:tsconfig.json +{ + "compilerOptions": { + // ... + "strictNullChecks": true, + // ... + }, +} +``` + +Add the eslint task to `package.json` + +```json:package.json +{ + "scripts": { + "eslint": "eslint './**/*.{js,jsx,ts,tsx}'" + }, +} +``` + +Run the task + +``` +npm run eslint +``` + +## License +MIT License \ No newline at end of file