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