Package Exports
- @ionic/eslint-config
- @ionic/eslint-config/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ionic/eslint-config) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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).
Usage
Remove existing
.eslintrc.*file, if present.Install
eslintand the config.npm install -D eslint @ionic/eslint-configAdd the following to
package.json:"eslintConfig": { "extends": "@ionic/eslint-config/recommended" }
📝 You can also use the base rule set: @ionic/eslint-config
With Prettier and @ionic/prettier-config
Set up Prettier and
@ionic/prettier-config.When using with Prettier and
@ionic/prettier-config, ESLint should run first. Set up your scripts inpackage.jsonlike this:"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 complainnpm run fmt: attempt to autofix lint issues and autoformat code
📝 Not every rule in this configuration is autofixable, so
npm run fmtmay continue failing until lint issues are addressed manually.
With Husky
Install husky:
npm install -D huskyAdd the following to
package.json:"husky": { "hooks": { "pre-commit": "npm run lint" } },