Updated readme and package files
This commit is contained in:
parent
b6f0d89dce
commit
316d799711
2 changed files with 38 additions and 22 deletions
46
README.md
46
README.md
|
@ -7,25 +7,41 @@
|
|||
First, install the plugin using npm.
|
||||
|
||||
```bash
|
||||
npm install --save-dev eslint @valkyriecoms/eslint-plugin @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-import
|
||||
npm install --save-dev eslint @valkyriecoms/eslint-plugin @typescript-eslint/parser
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Create `.eslintrc.cjs` file and write as follows
|
||||
Create `eslint.config.js` file and write as follows
|
||||
|
||||
```javascript:.eslintrc.cjs
|
||||
module.exports = {
|
||||
root: true,
|
||||
```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: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: ['./tsconfig.json'],
|
||||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
},
|
||||
ignorePatterns: ['**/.eslintrc.cjs'],
|
||||
extends: [
|
||||
'plugin:@valkyriecoms/recommended',
|
||||
],
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.ts', '**/*.tsx'],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
parser: tsParser,
|
||||
project: ['./tsconfig.json'],
|
||||
sourceType: 'module',
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
```
|
||||
|
||||
In tsconfig, strictNullChecks must be true.
|
||||
|
@ -33,9 +49,9 @@ In tsconfig, strictNullChecks must be true.
|
|||
```json:tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
...
|
||||
// ...
|
||||
"strictNullChecks": true,
|
||||
...
|
||||
// ...
|
||||
},
|
||||
}
|
||||
```
|
||||
|
@ -45,7 +61,7 @@ Add the eslint task to `package.json`
|
|||
```json:package.json
|
||||
{
|
||||
"scripts": {
|
||||
"eslint": "eslint . --ext .js,.jsx,.ts,.tsx"
|
||||
"eslint": "eslint './**/*.{js,jsx,ts,tsx}'"
|
||||
},
|
||||
}
|
||||
```
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"type": "commonjs",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"eslint": "eslint . --ext .js,.jsx,.ts,.tsx"
|
||||
"eslint": "eslint ./**/*.{js,jsx,ts,tsx}"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
|
|
Loading…
Reference in a new issue