https://github.com/cap-go/eslint-config
Common eslint rules/preferences for capacitor plugins
https://github.com/cap-go/eslint-config
Last synced: about 2 months ago
JSON representation
Common eslint rules/preferences for capacitor plugins
- Host: GitHub
- URL: https://github.com/cap-go/eslint-config
- Owner: Cap-go
- License: mit
- Created: 2024-05-03T17:03:18.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-05-03T17:04:13.000Z (12 months ago)
- Last Synced: 2024-05-22T18:28:00.656Z (11 months ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @ionic/eslint-config
Shared ESLint config used in Ionic and Capacitor projects.
This is meant to be used alongside Prettier (with [`@ionic/prettier-config`](https://github.com/ionic-team/prettier-config/)).
## Usage
1. Remove existing `.eslintrc.*` file, if present.
1. Install `eslint` and the config.```
npm install -D eslint @ionic/eslint-config
```1. Add the following to `package.json`:
```
"eslintConfig": {
"extends": "@ionic/eslint-config/recommended"
}
```:memo: You can also use the base rule set: `@ionic/eslint-config`
### With Prettier and `@ionic/prettier-config`
1. Set up Prettier and [`@ionic/prettier-config`](https://github.com/ionic-team/prettier-config/).
1. When using with Prettier and `@ionic/prettier-config`, ESLint should run first. Set up your scripts in `package.json` like this:```json
"scripts": {
"lint": "npm run eslint && npm run prettier -- --check",
"fmt": "npm run eslint -- --fix && npm run prettier -- --write",
"prettier": "prettier \"**/*.ts\"",
"eslint": "eslint . --ext .ts",
}
```- `npm run lint`: for checking if ESLint and Prettier complain
- `npm run fmt`: attempt to autofix lint issues and autoformat code:memo: Not every rule in this configuration is autofixable, so `npm run fmt` may continue failing until lint issues are addressed manually.
### With Husky
1. Install [husky](https://github.com/typicode/husky):
```
npm install -D husky
```1. Add the following to `package.json`:
```
"husky": {
"hooks": {
"pre-commit": "npm run lint"
}
},
```