Skip to content

Instantly share code, notes, and snippets.

@santoshyadavdev
Last active November 26, 2021 12:53
Show Gist options
  • Save santoshyadavdev/004a7866f58099956ff78902ca9a512f to your computer and use it in GitHub Desktop.
Save santoshyadavdev/004a7866f58099956ff78902ca9a512f to your computer and use it in GitHub Desktop.
Migration script from tslint to eslint
import { existsSync } from 'fs'
const execSync = require('child_process').execSync;
const angularJson = require('./angular.json');
const angularProjectsEntries: [
key: string,
value: { projectType: string; architect: {} }
][] = Object.entries(angularJson.projects);
angularProjectsEntries.forEach(([key, value]) => {
const target = angularJson.projects[key]['architect']['lint'];
if (target?.builder === '@angular-devkit/build-angular:tslint') {
const tslint = existsSync(`${angularJson.projects[key]['root']}/tslint.json`);
if (tslint) {
console.log(`migrating ${key} to eslint`);
execSync(`nx g convert-tslint-to-eslint ${key}`);
console.log(`migration completed for ${key}`);
}
else {
console.log(`${key} has no tslint.json`);
}
}
})
// run below script for mgration
// npx ts-node migrate-to-eslint.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment