fix(linter): ensure tslint converter works with pnp (#18323)
This commit is contained in:
parent
eb392109f7
commit
f4b7ec2c0d
@ -14,7 +14,17 @@ import { conversionGenerator } from './convert-tslint-to-eslint';
|
|||||||
/**
|
/**
|
||||||
* Don't run actual child_process implementation of installPackagesTask()
|
* Don't run actual child_process implementation of installPackagesTask()
|
||||||
*/
|
*/
|
||||||
jest.mock('child_process');
|
jest.mock('child_process', () => {
|
||||||
|
return {
|
||||||
|
...jest.requireActual<any>('child_process'),
|
||||||
|
execSync: jest.fn((command: string) => {
|
||||||
|
if (command.includes('pnpm --version')) {
|
||||||
|
return '8.2.0';
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const appProjectName = 'angular-app-1';
|
const appProjectName = 'angular-app-1';
|
||||||
const appProjectRoot = `apps/${appProjectName}`;
|
const appProjectRoot = `apps/${appProjectName}`;
|
||||||
|
|||||||
@ -13,7 +13,17 @@ import { conversionGenerator } from './convert-tslint-to-eslint';
|
|||||||
/**
|
/**
|
||||||
* Don't run actual child_process implementation of installPackagesTask()
|
* Don't run actual child_process implementation of installPackagesTask()
|
||||||
*/
|
*/
|
||||||
jest.mock('child_process');
|
jest.mock('child_process', () => {
|
||||||
|
return {
|
||||||
|
...jest.requireActual<any>('child_process'),
|
||||||
|
execSync: jest.fn((command: string) => {
|
||||||
|
if (command.includes('pnpm --version')) {
|
||||||
|
return '8.2.0';
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const projectName = 'e2e-app-1';
|
const projectName = 'e2e-app-1';
|
||||||
const projectRoot = `apps/${projectName}`;
|
const projectRoot = `apps/${projectName}`;
|
||||||
|
|||||||
@ -103,8 +103,9 @@ export async function convertToESLintConfig(
|
|||||||
*/
|
*/
|
||||||
writeJsonFile(pathToTslintJson, updatedTSLintJson);
|
writeJsonFile(pathToTslintJson, updatedTSLintJson);
|
||||||
}
|
}
|
||||||
|
const pm = getPackageManagerCommand();
|
||||||
const reportedConfiguration = await findReportedConfiguration(
|
const reportedConfiguration = await findReportedConfiguration(
|
||||||
'npx tslint --print-config',
|
`${pm.exec} tslint --print-config`,
|
||||||
pathToTslintJson
|
pathToTslintJson
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -121,8 +122,7 @@ export async function convertToESLintConfig(
|
|||||||
* This error could occur if, for example, the user does not have a TSLint plugin installed correctly that they
|
* This error could occur if, for example, the user does not have a TSLint plugin installed correctly that they
|
||||||
* reference in their config.
|
* reference in their config.
|
||||||
*/
|
*/
|
||||||
const printConfigFailureMessageStart =
|
const printConfigFailureMessageStart = `Command failed: ${pm.exec} tslint --print-config "tslint.json"`;
|
||||||
'Command failed: npx tslint --print-config "tslint.json"';
|
|
||||||
if (
|
if (
|
||||||
reportedConfiguration.message.startsWith(printConfigFailureMessageStart)
|
reportedConfiguration.message.startsWith(printConfigFailureMessageStart)
|
||||||
) {
|
) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user