Forgot to update the README file
This commit is contained in:
parent
aea54f6a31
commit
91a2b50e72
1 changed files with 21 additions and 37 deletions
44
README.md
44
README.md
|
@ -7,41 +7,25 @@
|
|||
First, install the plugin using npm.
|
||||
|
||||
```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
|
||||
|
||||
Create `eslint.config.js` file and write as follows
|
||||
Create `.eslintrc.cjs` 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: {
|
||||
```javascript:.eslintrc.cjs
|
||||
module.exports = {
|
||||
root: true,
|
||||
parserOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.ts', '**/*.tsx'],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
parser: tsParser,
|
||||
tsconfigRootDir: __dirname,
|
||||
project: ['./tsconfig.json'],
|
||||
sourceType: 'module',
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
ignorePatterns: ['**/.eslintrc.cjs'],
|
||||
extends: [
|
||||
'plugin:@valkyriecoms/recommended',
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
In tsconfig, strictNullChecks must be true.
|
||||
|
@ -49,9 +33,9 @@ In tsconfig, strictNullChecks must be true.
|
|||
```json:tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
// ...
|
||||
...
|
||||
"strictNullChecks": true,
|
||||
// ...
|
||||
...
|
||||
},
|
||||
}
|
||||
```
|
||||
|
@ -61,7 +45,7 @@ Add the eslint task to `package.json`
|
|||
```json:package.json
|
||||
{
|
||||
"scripts": {
|
||||
"eslint": "eslint './**/*.{js,jsx,ts,tsx}'"
|
||||
"eslint": "eslint . --ext .js,.jsx,.ts,.tsx"
|
||||
},
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue