fix(core): remove .eslintrc double extends update on move (#6765)
* fix(core): remove eslintrc double extends update on move * fix(core): move eslintrc move logic back to eslint update
This commit is contained in:
parent
81d36ee737
commit
3b2f0b64ea
@ -65,6 +65,35 @@ describe('updateEslint', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should update .eslintrc.json extends path when project is moved from subdirectory', async () => {
|
||||||
|
await libraryGenerator(tree, {
|
||||||
|
name: 'test',
|
||||||
|
directory: 'api',
|
||||||
|
linter: Linter.EsLint,
|
||||||
|
standaloneConfig: false,
|
||||||
|
});
|
||||||
|
// This step is usually handled elsewhere
|
||||||
|
tree.rename('libs/api/test/.eslintrc.json', 'libs/test/.eslintrc.json');
|
||||||
|
const projectConfig = readProjectConfiguration(tree, 'api-test');
|
||||||
|
|
||||||
|
const newSchema = {
|
||||||
|
projectName: 'api-test',
|
||||||
|
destination: 'test',
|
||||||
|
importPath: '@proj/test',
|
||||||
|
updateImportPath: true,
|
||||||
|
newProjectName: 'test',
|
||||||
|
relativeToRootDestination: 'libs/test',
|
||||||
|
};
|
||||||
|
|
||||||
|
updateEslintrcJson(tree, newSchema, projectConfig);
|
||||||
|
|
||||||
|
expect(readJson(tree, '/libs/test/.eslintrc.json')).toEqual(
|
||||||
|
expect.objectContaining({
|
||||||
|
extends: ['../../.eslintrc.json'],
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('should preserve .eslintrc.json non-relative extends when project is moved to subdirectory', async () => {
|
it('should preserve .eslintrc.json non-relative extends when project is moved to subdirectory', async () => {
|
||||||
await libraryGenerator(tree, {
|
await libraryGenerator(tree, {
|
||||||
name: 'my-lib',
|
name: 'my-lib',
|
||||||
|
|||||||
@ -40,6 +40,9 @@ export function updateProjectRootFiles(
|
|||||||
if (!extname(file).startsWith('.js')) {
|
if (!extname(file).startsWith('.js')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (file === '.eslintrc.json') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const oldContent = tree.read(
|
const oldContent = tree.read(
|
||||||
join(schema.relativeToRootDestination, file),
|
join(schema.relativeToRootDestination, file),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user