Last active
November 26, 2021 12:53
-
-
Save santoshyadavdev/004a7866f58099956ff78902ca9a512f to your computer and use it in GitHub Desktop.
Migration script from tslint to eslint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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