Forgot to update the README file

This commit is contained in:
Toastie (DCS Team) 2024-10-02 23:53:19 +13:00
parent aea54f6a31
commit 91a2b50e72
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4

View file

@ -7,52 +7,36 @@
First, install the plugin using npm. First, install the plugin using npm.
```bash ```bash
npm install --save-dev eslint @valkyriecoms/eslint-plugin @typescript-eslint/parser npm install --save-dev eslint @valkyriecoms/eslint-plugin @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import
``` ```
## Usage ## Usage
Create `eslint.config.js` file and write as follows Create `.eslintrc.cjs` file and write as follows
```javascript:eslint.config.js ```javascript:.eslintrc.cjs
import pluginValkyriecoms from '@valkyriecoms/eslint-plugin'; module.exports = {
import tsParser from '@typescript-eslint/parser'; root: true,
parserOptions: {
export default [ tsconfigRootDir: __dirname,
...pluginValkyriecoms.configs['recommended'], project: ['./tsconfig.json'],
{
files: ['**/*.js', '**/*.jsx'],
languageOptions: {
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
},
}, },
{ ignorePatterns: ['**/.eslintrc.cjs'],
files: ['**/*.ts', '**/*.tsx'], extends: [
languageOptions: { 'plugin:@valkyriecoms/recommended',
parserOptions: { ],
ecmaVersion: 'latest', };
parser: tsParser,
project: ['./tsconfig.json'],
sourceType: 'module',
tsconfigRootDir: import.meta.dirname,
},
},
},
];
``` ```
In tsconfig, strictNullChecks must be true. In tsconfig, strictNullChecks must be true.
```json:tsconfig.json ```json:tsconfig.json
{ {
"compilerOptions": { "compilerOptions": {
// ... ...
"strictNullChecks": true, "strictNullChecks": true,
// ... ...
}, },
} }
``` ```
@ -60,9 +44,9 @@ Add the eslint task to `package.json`
```json:package.json ```json:package.json
{ {
"scripts": { "scripts": {
"eslint": "eslint './**/*.{js,jsx,ts,tsx}'" "eslint": "eslint . --ext .js,.jsx,.ts,.tsx"
}, },
} }
``` ```