tslint-ionic-rules
raw JSON → 0.0.21 verified Fri May 01 auth: no javascript deprecated
Package of TSLint rules for Ionic Angular projects. Current version 0.0.21, last release Feb 2022. Provides two preset configurations: base and strict. Requires TSLint ^5.1.0 and TypeScript ^2.1.0 || ^3.0.0. Note: TSLint is deprecated in favor of ESLint; this package is no longer maintained for new projects.
Common errors
error Could not find rule: 'ionic-rule-name' ↓
cause The rule name does not exist; typo or wrong preset path.
fix
Use 'extends': 'tslint-ionic-rules/strict' and verify rule names from the source.
error Cannot find module 'tslint-ionic-rules' ↓
cause Package not installed or missing from node_modules.
fix
Run 'npm i -D tslint-ionic-rules' and ensure tslint.json is in the project root.
Warnings
deprecated TSLint is deprecated; use ESLint with @typescript-eslint instead. ↓
fix Migrate to ESLint using the Angular ESLint schematic: ng add @angular-eslint/schematics
breaking Requires TypeScript 2.1.0 to 3.x; incompatible with TypeScript >=4.0. ↓
fix Downgrade TypeScript to ^3.0.0 or migrate to ESLint-based rules.
gotcha The base preset extends 'tslint:recommended'. Custom rules may conflict with other rulesets. ↓
fix Review the full rules list at node_modules/tslint-ionic-rules/tslint.js before combining with other configs.
deprecated Package is unmaintained since 2019 (last commit Feb 2022). ↓
fix Use @ionic/eslint-config or ESLint with Angular preset.
Install
npm install tslint-ionic-rules yarn add tslint-ionic-rules pnpm add tslint-ionic-rules Imports
- extends wrong
// using non-existent path { "extends": "tslint-ionic-rules/base" }correct// in tslint.json { "extends": "tslint-ionic-rules" } - extends (strict) wrong
// using 'strict' as a separate config key { "extends": "tslint-ionic-rules", "rulesDirectory": ["strict"] }correct// in tslint.json { "extends": "tslint-ionic-rules/strict" } - npm install wrong
npm install tslint-ionic-rules --savecorrectnpm i -D tslint-ionic-rules
Quickstart
// 1. Install dependencies
npm i -D tslint-ionic-rules tslint typescript
// 2. Create tslint.json with:
{
"extends": "tslint-ionic-rules/strict",
"rules": {
"no-console": [true, "log", "error"]
}
}
// 3. Run lint
npx tslint -p tsconfig.json