feat(core): migrate prettier to v2.3.1 (#5623)

This commit is contained in:
Phillip Barta 2021-06-17 16:44:30 +02:00 committed by GitHub
parent 3c833e44fe
commit fe97444d78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
105 changed files with 4885 additions and 9350 deletions

View File

@ -5,8 +5,7 @@ module.exports = {
{ value: 'docs', name: 'docs: Documentation only changes' },
{
value: 'cleanup',
name:
'cleanup: A code change that neither fixes a bug nor adds a feature',
name: 'cleanup: A code change that neither fixes a bug nor adds a feature',
},
{
value: 'chore',
@ -64,8 +63,7 @@ module.exports = {
customScope: 'Denote the SCOPE of this change:',
subject:
'Write a SHORT, IMPERATIVE (lowercase) description of the change:\n',
body:
'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
breaking: 'List any BREAKING CHANGES (optional):\n',
footer:
'List any ISSUES CLOSED by this change (optional). E.g.: #31, #34:\n',

View File

@ -21,9 +21,8 @@ export class ProjectList {
setCheckedProjects(selectedProjects: string[]) {
Object.keys(this.checkboxes).forEach((projectName) => {
this.checkboxes[projectName].checked = selectedProjects.includes(
projectName
);
this.checkboxes[projectName].checked =
selectedProjects.includes(projectName);
});
}

View File

@ -43,16 +43,14 @@ export class SidebarComponent {
);
this.displayOptionsPanel.render(displayOptionsPanelContainer);
const focusedProjectPanelContainer = document.getElementById(
'focused-project'
);
const focusedProjectPanelContainer =
document.getElementById('focused-project');
this.focusedProjectPanel = new FocusedProjectPanel(
focusedProjectPanelContainer
);
const textFilterPanelContainer = document.getElementById(
'text-filter-panel'
);
const textFilterPanelContainer =
document.getElementById('text-filter-panel');
this.textFilterPanel = new TextFilterPanel(textFilterPanelContainer);
const projectListContainer = document.getElementById('project-lists');

View File

@ -85,38 +85,32 @@ export const nxExamplesGraph: ProjectGraphCache = {
ext: '.ts',
},
{
file:
'libs/products/product-detail-page/src/lib/product-detail-page/product-detail-page.component.html',
file: 'libs/products/product-detail-page/src/lib/product-detail-page/product-detail-page.component.html',
hash: 'fd5fa276dc13f789ae5d7a37703a296753aec8be',
ext: '.html',
},
{
file:
'libs/products/product-detail-page/src/lib/product-detail-page/product-detail-page.component.scss',
file: 'libs/products/product-detail-page/src/lib/product-detail-page/product-detail-page.component.scss',
hash: '98fbca8900da6d5c5f6373558f5bd69efe190780',
ext: '.scss',
},
{
file:
'libs/products/product-detail-page/src/lib/product-detail-page/product-detail-page.component.spec.ts',
file: 'libs/products/product-detail-page/src/lib/product-detail-page/product-detail-page.component.spec.ts',
hash: 'e8390b7218d2dca9eb4be8d2b1cc08e1b1c0de1b',
ext: '.ts',
},
{
file:
'libs/products/product-detail-page/src/lib/product-detail-page/product-detail-page.component.ts',
file: 'libs/products/product-detail-page/src/lib/product-detail-page/product-detail-page.component.ts',
hash: 'c20bd27b12494827624a3835b1ec6475efaf0913',
ext: '.ts',
},
{
file:
'libs/products/product-detail-page/src/lib/products-product-detail-page.module.spec.ts',
file: 'libs/products/product-detail-page/src/lib/products-product-detail-page.module.spec.ts',
hash: '01541f218a3a1b95b056fd9d2d1b578e5a2e3d9a',
ext: '.ts',
},
{
file:
'libs/products/product-detail-page/src/lib/products-product-detail-page.module.ts',
file: 'libs/products/product-detail-page/src/lib/products-product-detail-page.module.ts',
hash: '5c06b527e7ffe870f1960a74a845106beca79b6b',
ext: '.ts',
},
@ -262,44 +256,37 @@ export const nxExamplesGraph: ProjectGraphCache = {
ext: '.ts',
},
{
file:
'libs/shared/product/state/src/lib/+state/products.actions.ts',
file: 'libs/shared/product/state/src/lib/+state/products.actions.ts',
hash: '4c0efeeec1adfcecd34b20bda87fce5f24a64675',
ext: '.ts',
},
{
file:
'libs/shared/product/state/src/lib/+state/products.reducer.spec.ts',
file: 'libs/shared/product/state/src/lib/+state/products.reducer.spec.ts',
hash: 'b2821f72394868ca503eb637f2891564851583eb',
ext: '.ts',
},
{
file:
'libs/shared/product/state/src/lib/+state/products.reducer.ts',
file: 'libs/shared/product/state/src/lib/+state/products.reducer.ts',
hash: '9168586d19b76b0dd462dafbb5b6998c4da5ba53',
ext: '.ts',
},
{
file:
'libs/shared/product/state/src/lib/+state/products.selectors.spec.ts',
file: 'libs/shared/product/state/src/lib/+state/products.selectors.spec.ts',
hash: '25cd673e1ff8b591f92f734944cd20adf965b612',
ext: '.ts',
},
{
file:
'libs/shared/product/state/src/lib/+state/products.selectors.ts',
file: 'libs/shared/product/state/src/lib/+state/products.selectors.ts',
hash: '74fd5c163037dd51d33316cb2ce1c816728edea1',
ext: '.ts',
},
{
file:
'libs/shared/product/state/src/lib/shared-product-state.module.spec.ts',
file: 'libs/shared/product/state/src/lib/shared-product-state.module.spec.ts',
hash: '713543b7a36b2027985904f9a74124f79406108c',
ext: '.ts',
},
{
file:
'libs/shared/product/state/src/lib/shared-product-state.module.ts',
file: 'libs/shared/product/state/src/lib/shared-product-state.module.ts',
hash: '144207d2b4609204b8ceab1ae81d1079d61b3949',
ext: '.ts',
},
@ -450,38 +437,32 @@ export const nxExamplesGraph: ProjectGraphCache = {
ext: '.ts',
},
{
file:
'libs/products/home-page/src/lib/home-page/home-page.component.html',
file: 'libs/products/home-page/src/lib/home-page/home-page.component.html',
hash: '8bd27770e5974269e766d95762fef74b5bd89841',
ext: '.html',
},
{
file:
'libs/products/home-page/src/lib/home-page/home-page.component.scss',
file: 'libs/products/home-page/src/lib/home-page/home-page.component.scss',
hash: 'ba4f1655a2c0791670384de48367caded0d6e601',
ext: '.scss',
},
{
file:
'libs/products/home-page/src/lib/home-page/home-page.component.spec.ts',
file: 'libs/products/home-page/src/lib/home-page/home-page.component.spec.ts',
hash: '66eb455b3e71b30c0bd16a4769cc34b81133b667',
ext: '.ts',
},
{
file:
'libs/products/home-page/src/lib/home-page/home-page.component.ts',
file: 'libs/products/home-page/src/lib/home-page/home-page.component.ts',
hash: 'bd081eedbf10a2cd04c95609379d131e5e8d60a1',
ext: '.ts',
},
{
file:
'libs/products/home-page/src/lib/products-home-page.module.spec.ts',
file: 'libs/products/home-page/src/lib/products-home-page.module.spec.ts',
hash: '1d9cf1c8c46ebe69275def67ccf6f04c0f967856',
ext: '.ts',
},
{
file:
'libs/products/home-page/src/lib/products-home-page.module.ts',
file: 'libs/products/home-page/src/lib/products-home-page.module.ts',
hash: 'db6a06b6d0063c4a1fff6c7953be09a680592184',
ext: '.ts',
},
@ -563,14 +544,12 @@ export const nxExamplesGraph: ProjectGraphCache = {
ext: '.ts',
},
{
file:
'libs/shared/product/ui/src/lib/product-price/product-price.element.spec.ts',
file: 'libs/shared/product/ui/src/lib/product-price/product-price.element.spec.ts',
hash: '34be17f44c09cfa01a9fd4dc7ada68c7bafded6e',
ext: '.ts',
},
{
file:
'libs/shared/product/ui/src/lib/product-price/product-price.element.ts',
file: 'libs/shared/product/ui/src/lib/product-price/product-price.element.ts',
hash: '8c626d1213b1b47bc2bdf221554fb38bb9f9bfae',
ext: '.ts',
},
@ -672,8 +651,7 @@ export const nxExamplesGraph: ProjectGraphCache = {
ext: '.ts',
},
{
file:
'libs/shared/cart/state/src/lib/+state/cart.selectors.spec.ts',
file: 'libs/shared/cart/state/src/lib/+state/cart.selectors.spec.ts',
hash: 'dc5a869677b1db84446492fc6a1045cd33c0d661',
ext: '.ts',
},
@ -683,8 +661,7 @@ export const nxExamplesGraph: ProjectGraphCache = {
ext: '.ts',
},
{
file:
'libs/shared/cart/state/src/lib/shared-cart-state.module.spec.ts',
file: 'libs/shared/cart/state/src/lib/shared-cart-state.module.spec.ts',
hash: 'caef812f0d76e3f3ca6849d53dc0d011cd2e902a',
ext: '.ts',
},
@ -825,14 +802,12 @@ export const nxExamplesGraph: ProjectGraphCache = {
ext: '.ts',
},
{
file:
'libs/cart/cart-page/src/lib/cart-cart-page/cart-cart-page.spec.tsx',
file: 'libs/cart/cart-page/src/lib/cart-cart-page/cart-cart-page.spec.tsx',
hash: 'ccef1ef28fac14fdaa45c523108862d70d28825b',
ext: '.tsx',
},
{
file:
'libs/cart/cart-page/src/lib/cart-cart-page/cart-cart-page.tsx',
file: 'libs/cart/cart-page/src/lib/cart-cart-page/cart-cart-page.tsx',
hash: '83a824d0bafcc3d4edf94490664351fe99cdef3f',
ext: '.tsx',
},
@ -945,8 +920,7 @@ export const nxExamplesGraph: ProjectGraphCache = {
ext: '.jpg',
},
{
file:
'libs/shared/assets/src/assets/images/a-dance-with-dragons.jpg',
file: 'libs/shared/assets/src/assets/images/a-dance-with-dragons.jpg',
hash: 'ea6706f36b4e3a579bd97b8e506fbc7345ef8635',
ext: '.jpg',
},

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -46,11 +46,10 @@ xdescribe('Nrwl Convert to Nx Workspace', () => {
// update angular-cli.json
const angularCLIJson = readJson('angular.json');
angularCLIJson.projects[
proj
].architect.build.options.scripts = angularCLIJson.projects[
proj
].architect.test.options.scripts = ['src/scripts.ts'];
angularCLIJson.projects[proj].architect.build.options.scripts =
angularCLIJson.projects[proj].architect.test.options.scripts = [
'src/scripts.ts',
];
angularCLIJson.projects[proj].architect.test.options.styles = [
'src/styles.css',
];

View File

@ -178,9 +178,8 @@ describe('Linter', () => {
expect(stdout).not.toContain('Unexpected console statement');
expect(() => checkFilesExist(outputFile)).not.toThrow();
const outputContents = JSON.parse(readFile(outputFile));
const outputForApp: any = Object.values(
outputContents
).filter((result: any) =>
const outputForApp: any = Object.values(outputContents).filter(
(result: any) =>
result.filePath.includes(path.normalize(`${myapp}/src/main.ts`))
)[0];
expect(outputForApp.errorCount).toBe(1);

View File

@ -108,8 +108,7 @@ function createAnchorContent(node) {
'stroke-linecap': 'round',
'stroke-linejoin': 'round',
'stroke-width': '2',
d:
'M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1',
d: 'M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1',
},
children: [],
},

View File

@ -40,9 +40,8 @@ export function DocumentationPage({
isFallback,
}: DocumentationPageProps) {
const router = useRouter();
const { value: storedFlavor, setValue: setStoredFlavor } = useStorage(
'flavor'
);
const { value: storedFlavor, setValue: setStoredFlavor } =
useStorage('flavor');
const { setValue: setStoredVersion } = useStorage('version');
const [dialogOpen, setDialogOpen] = useState(false);
const [navIsOpen, setNavIsOpen] = useState(false);

View File

@ -98,7 +98,7 @@
"@types/jest": "26.0.8",
"@types/marked": "^2.0.0",
"@types/node": "14.14.37",
"@types/prettier": "2.0.0",
"@types/prettier": "2.3.0",
"@types/react": "17.0.3",
"@types/react-dom": "17.0.3",
"@types/react-router-dom": "5.1.7",
@ -122,7 +122,6 @@
"conventional-changelog-cli": "^2.0.23",
"copy-webpack-plugin": "6.0.3",
"core-js": "^3.6.5",
"cosmiconfig": "^4.0.0",
"cypress": "^7.3.0",
"cytoscape": "^3.18.2",
"cytoscape-dagre": "^2.3.2",
@ -187,7 +186,7 @@
"postcss": "8.3.0",
"postcss-import": "14.0.2",
"precise-commits": "1.0.2",
"prettier": "2.2.1",
"prettier": "2.3.1",
"pretty-quick": "^3.1.0",
"protractor": "5.4.3",
"raw-loader": "3.1.0",

View File

@ -15,12 +15,12 @@ describe('DelegateBuild executor', () => {
let delegateTarget: Target;
beforeEach(async () => {
(buildableLibsUtils.calculateProjectDependencies as jest.Mock).mockImplementation(
() => ({
(
buildableLibsUtils.calculateProjectDependencies as jest.Mock
).mockImplementation(() => ({
target: { data: { root: '/root' } },
dependencies: [],
})
);
}));
(buildableLibsUtils.createTmpTsConfig as jest.Mock).mockImplementation(
() => '/my-app/tsconfig.app.generated.json'
);
@ -52,9 +52,9 @@ describe('DelegateBuild executor', () => {
afterEach(() => jest.clearAllMocks());
it('should return unsuccessful result when deps have not been built', async () => {
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
false
);
(
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
).mockReturnValue(false);
const result = await delegateBuildExecutor(options, context).next();
@ -64,9 +64,9 @@ describe('DelegateBuild executor', () => {
});
it('should build the app when deps have been built', async () => {
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
true
);
(
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
).mockReturnValue(true);
(devkit.runExecutor as any).mockImplementation(function* () {
yield { success: true };
});
@ -82,9 +82,9 @@ describe('DelegateBuild executor', () => {
});
it('should return unsuccessful result when build fails', async () => {
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
true
);
(
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
).mockReturnValue(true);
(devkit.runExecutor as any).mockImplementation(function* () {
yield { success: false };
});
@ -100,9 +100,9 @@ describe('DelegateBuild executor', () => {
});
it('should support watch mode builds', async () => {
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
true
);
(
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
).mockReturnValue(true);
(devkit.runExecutor as any).mockImplementation(function* () {
yield { success: true };
yield { success: true };

View File

@ -36,11 +36,8 @@ export const nxCompileNgcTransformFactory = (
// Compile TypeScript sources
const { esm2015, declarations } = entryPoint.data.destinationFiles;
const { moduleResolutionCache } = entryPoint.cache;
const {
basePath,
cssUrl,
styleIncludePaths,
} = entryPoint.data.entryPoint;
const { basePath, cssUrl, styleIncludePaths } =
entryPoint.data.entryPoint;
const stylesheetProcessor = new StylesheetProcessor(
basePath,
cssUrl,

View File

@ -33,12 +33,12 @@ describe('NgPackagrLite executor', () => {
},
};
(ng.readConfiguration as jest.Mock).mockImplementation(() => tsConfig);
(buildableLibsUtils.calculateProjectDependencies as jest.Mock).mockImplementation(
() => ({
(
buildableLibsUtils.calculateProjectDependencies as jest.Mock
).mockImplementation(() => ({
target: {},
dependencies: [],
})
);
}));
ngPackagrBuildMock = jest.fn(() => Promise.resolve());
ngPackagerWatchSubject = new BehaviorSubject<void>(undefined);
ngPackagrWatchMock = jest.fn(() => ngPackagerWatchSubject.asObservable());
@ -64,9 +64,9 @@ describe('NgPackagrLite executor', () => {
afterEach(() => jest.clearAllMocks());
it('should return unsuccessful result when deps have not been built', async () => {
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
false
);
(
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
).mockReturnValue(false);
const result = await ngPackagrLiteExecutor(options, context);
@ -74,9 +74,9 @@ describe('NgPackagrLite executor', () => {
});
it('should build the library when deps have been built', async () => {
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
true
);
(
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
).mockReturnValue(true);
const result = await ngPackagrLiteExecutor(options, context);
@ -85,9 +85,9 @@ describe('NgPackagrLite executor', () => {
});
it('should instantiate NgPackager with the right providers and set to use the right build transformation provider', async () => {
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
true
);
(
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
).mockReturnValue(true);
const result = await ngPackagrLiteExecutor(options, context);
@ -102,9 +102,9 @@ describe('NgPackagrLite executor', () => {
});
it('should process tsConfig for incremental builds when tsConfig options is set', async () => {
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
true
);
(
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
).mockReturnValue(true);
const tsConfigPath = '/root/my-lib/tsconfig.app.json';
const result = await ngPackagrLiteExecutor(
@ -123,9 +123,9 @@ describe('NgPackagrLite executor', () => {
describe('--watch', () => {
it('should emit results everytime there are changes', async () => {
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
true
);
(
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
).mockReturnValue(true);
const results = ngPackagrLiteExecutor(
{ ...options, watch: true },

View File

@ -27,12 +27,12 @@ describe('Package executor', () => {
},
};
(ng.readConfiguration as jest.Mock).mockImplementation(() => tsConfig);
(buildableLibsUtils.calculateProjectDependencies as jest.Mock).mockImplementation(
() => ({
(
buildableLibsUtils.calculateProjectDependencies as jest.Mock
).mockImplementation(() => ({
target: {},
dependencies: [],
})
);
}));
ngPackagrBuildMock = jest.fn(() => Promise.resolve());
ngPackagerWatchSubject = new BehaviorSubject<void>(undefined);
ngPackagrWatchMock = jest.fn(() => ngPackagerWatchSubject.asObservable());
@ -56,9 +56,9 @@ describe('Package executor', () => {
afterEach(() => jest.clearAllMocks());
it('should return unsuccessful result when deps have not been built', async () => {
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
false
);
(
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
).mockReturnValue(false);
const result = await packageExecutor(options, context);
@ -66,9 +66,9 @@ describe('Package executor', () => {
});
it('should build the library when deps have been built', async () => {
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
true
);
(
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
).mockReturnValue(true);
const result = await packageExecutor(options, context);
@ -77,9 +77,9 @@ describe('Package executor', () => {
});
it('should process tsConfig for incremental builds when tsConfig options is set', async () => {
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
true
);
(
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
).mockReturnValue(true);
const tsConfigPath = '/root/my-lib/tsconfig.app.json';
const result = await packageExecutor(
@ -98,9 +98,9 @@ describe('Package executor', () => {
describe('--watch', () => {
it('should emit results everytime there are changes', async () => {
(buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock).mockReturnValue(
true
);
(
buildableLibsUtils.checkDependentProjectsHaveBeenBuilt as jest.Mock
).mockReturnValue(true);
const results = packageExecutor(
{ ...options, watch: true },

View File

@ -22,8 +22,10 @@ export function componentCypressSpecGenerator(
componentName,
} = options;
const e2eProjectName = cypressProject || `${projectName}-e2e`;
const e2eProjectRoot = readProjectConfiguration(tree, e2eProjectName)
.sourceRoot;
const e2eProjectRoot = readProjectConfiguration(
tree,
e2eProjectName
).sourceRoot;
const e2eLibIntegrationFolderPath = joinPathFragments(
e2eProjectRoot,
'integration'

View File

@ -8,12 +8,8 @@ export function componentStoryGenerator(
tree: Tree,
options: ComponentStoryGeneratorOptions
): void {
const {
componentFileName,
componentName,
componentPath,
projectPath,
} = options;
const { componentFileName, componentName, componentPath, projectPath } =
options;
const templatesDir = joinPathFragments(__dirname, 'files');
const destinationDir = joinPathFragments(projectPath, componentPath);

View File

@ -472,9 +472,9 @@ describe('lib', () => {
// ASSERT
const tsconfigJson = readJson(appTree, '/tsconfig.base.json');
expect(
tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']
).toEqual(['libs/my-dir/my-lib/src/index.ts']);
expect(tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']).toEqual(
['libs/my-dir/my-lib/src/index.ts']
);
expect(
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
).toBeUndefined();
@ -505,9 +505,9 @@ describe('lib', () => {
// ASSERT
const tsconfigJson = readJson(appTree, '/tsconfig.base.json');
expect(
tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']
).toEqual(['libs/my-dir/my-lib/src/index.ts']);
expect(tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']).toEqual(
['libs/my-dir/my-lib/src/index.ts']
);
expect(
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
).toBeUndefined();

View File

@ -11,7 +11,8 @@ export function getModuleDeclaredComponents(
projectName: string
): string[] {
const ngModuleDecorator = getNgModuleDecorator(file, moduleFilePath);
const declarationsPropertyAssignment = getNgModuleDeclarationsPropertyAssignment(
const declarationsPropertyAssignment =
getNgModuleDeclarationsPropertyAssignment(
ngModuleDecorator,
moduleFilePath,
projectName

View File

@ -12,26 +12,22 @@ function createAngularCLIPoweredWorkspace() {
describe('Remove ngcc flags from postinstall script', () => {
[
{
test:
'node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points',
test: 'node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points',
expected:
'node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main',
},
{
test:
'node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points && echo "hi"',
test: 'node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points && echo "hi"',
expected:
'node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main && echo "hi"',
},
{
test:
'ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points && node ./decorate-angular-cli.js && echo "hi"',
test: 'ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points && node ./decorate-angular-cli.js && echo "hi"',
expected:
'ngcc --properties es2015 browser module main && node ./decorate-angular-cli.js && echo "hi"',
},
{
test:
'ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points && node ./decorate-angular-cli.js',
test: 'ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points && node ./decorate-angular-cli.js',
expected:
'ngcc --properties es2015 browser module main && node ./decorate-angular-cli.js',
},

View File

@ -111,12 +111,8 @@ function updateTargetsConfigurations(
configurationOptions: any
) {
for (const [configurationName, options] of configurationOptions) {
const {
buildTarget,
tsConfig,
outputPath,
...delegateTargetOptions
} = options;
const { buildTarget, tsConfig, outputPath, ...delegateTargetOptions } =
options;
const configurationBuildTarget = extractConfigurationBuildTarget(
projectName,
@ -153,12 +149,8 @@ function updateTargetsOptions(
buildTargetName: string
) {
if (target.options) {
const {
buildTarget,
tsConfig,
outputPath,
...delegateTargetOptions
} = target.options;
const { buildTarget, tsConfig, outputPath, ...delegateTargetOptions } =
target.options;
// Update build target options by overwriting them
project.targets[buildTargetName].options = {
...project.targets[buildTargetName].options,

View File

@ -29,12 +29,12 @@ function migrateAngularEsLintRules({ overrides, rules }: Linter.Config) {
);
migrateToAccessibilityLabelHasAssociatedControlName(rules);
addEqeqeqIfNeeded(rules);
for (const override of overrides ?? []) {
for (const o of overrides ?? []) {
migrateToAccessibilityLabelHasAssociatedControlSchema(
override.rules?.['@angular-eslint/template/accessibility-label-for']
o.rules?.['@angular-eslint/template/accessibility-label-for']
);
migrateToAccessibilityLabelHasAssociatedControlName(override.rules);
addEqeqeqIfNeeded(override.rules);
migrateToAccessibilityLabelHasAssociatedControlName(o.rules);
addEqeqeqIfNeeded(o.rules);
}
}
@ -45,9 +45,8 @@ function migrateToAccessibilityLabelHasAssociatedControlName(
const accessibilityLabelForRule =
rules['@angular-eslint/template/accessibility-label-for'];
delete rules['@angular-eslint/template/accessibility-label-for'];
rules[
'@angular-eslint/template/accessibility-label-has-associated-control'
] = accessibilityLabelForRule;
rules['@angular-eslint/template/accessibility-label-has-associated-control'] =
accessibilityLabelForRule;
}
function migrateToAccessibilityLabelHasAssociatedControlSchema(

View File

@ -73,11 +73,8 @@ function rewriteBootstrapLogic(options: Schema): Rule {
}
function addEntryComponentsToModule(options: Schema): Rule {
return (host: Tree) => {
const {
modulePath,
moduleSource,
bootstrapComponentClassName,
} = readBootstrapInfo(host, options.project);
const { modulePath, moduleSource, bootstrapComponentClassName } =
readBootstrapInfo(host, options.project);
insert(
host,
modulePath,

View File

@ -144,7 +144,9 @@ function _addSymbolToNgModuleMetadata(
return [];
}
// Get all the children property assignment of object literals.
const matchingProperties: ts.ObjectLiteralElement[] = (node as ts.ObjectLiteralExpression).properties
const matchingProperties: ts.ObjectLiteralElement[] = (
node as ts.ObjectLiteralExpression
).properties
.filter((prop) => prop.kind == ts.SyntaxKind.PropertyAssignment)
// Filter out every fields that's not "metadataField". Also handles string literals
// (but not expressions).
@ -218,7 +220,7 @@ function _addSymbolToNgModuleMetadata(
const isArray = Array.isArray(node);
if (isArray) {
const nodeArray = (node as {}) as Array<ts.Node>;
const nodeArray = node as {} as Array<ts.Node>;
const symbolsArray = nodeArray.map((node) => node.getText());
if (symbolsArray.includes(expression)) {
return [];
@ -435,8 +437,9 @@ function getListOfRoutes(
});
if (routesDeclaration) {
return (routesDeclaration.initializer as ts.ArrayLiteralExpression)
.elements;
return (
routesDeclaration.initializer as ts.ArrayLiteralExpression
).elements;
}
}
}

View File

@ -142,7 +142,9 @@ function _addSymbolToNgModuleMetadata(
return source;
}
// Get all the children property assignment of object literals.
const matchingProperties: ts.ObjectLiteralElement[] = (node as ts.ObjectLiteralExpression).properties
const matchingProperties: ts.ObjectLiteralElement[] = (
node as ts.ObjectLiteralExpression
).properties
.filter((prop) => prop.kind == ts.SyntaxKind.PropertyAssignment)
// Filter out every fields that's not "metadataField". Also handles string literals
// (but not expressions).
@ -212,7 +214,7 @@ function _addSymbolToNgModuleMetadata(
const isArray = Array.isArray(node);
if (isArray) {
const nodeArray = (node as {}) as Array<ts.Node>;
const nodeArray = node as {} as Array<ts.Node>;
const symbolsArray = nodeArray.map((node) => node.getText());
if (symbolsArray.includes(expression)) {
return source;
@ -434,8 +436,9 @@ function getListOfRoutes(
});
if (routesDeclaration) {
return (routesDeclaration.initializer as ts.ArrayLiteralExpression)
.elements;
return (
routesDeclaration.initializer as ts.ArrayLiteralExpression
).elements;
}
}
}

View File

@ -17,8 +17,8 @@ export function initLocal(workspace: Workspace) {
require('@nrwl/workspace/src/utilities/perf-logging');
//nx-ignore-next-line
const supportedNxCommands = require('@nrwl/workspace/src/command-line/supported-nx-commands')
.supportedNxCommands;
const supportedNxCommands =
require('@nrwl/workspace/src/command-line/supported-nx-commands').supportedNxCommands;
const runOpts = runOneOptions(workspace);
const running = runOpts !== false;

View File

@ -551,8 +551,7 @@ async function askAboutNxCloud(parsedArgs: any) {
choices: [
{
name: 'Yes',
hint:
'Faster builds, run details, Github integration. Learn more at https://nx.app',
hint: 'Faster builds, run details, Github integration. Learn more at https://nx.app',
},
{

View File

@ -121,9 +121,8 @@ async function* startDevServer(
{ project, target, configuration },
context
);
const targetSupportsWatchOpt = Object.keys(devServerTargetOpts).includes(
'watch'
);
const targetSupportsWatchOpt =
Object.keys(devServerTargetOpts).includes('watch');
for await (const output of await runExecutor<{
success: boolean;

View File

@ -202,10 +202,12 @@ async function updatePlugins(host: Tree, context: SchematicContext) {
statement.expression.right.parameters.length >= 2
) {
if (isBlock(statement.expression.right.body)) {
const onParamName = statement.expression.right.parameters[0].name.getText(
const onParamName =
statement.expression.right.parameters[0].name.getText(
sourceFile
);
const configParamName = statement.expression.right.parameters[1].name.getText(
const configParamName =
statement.expression.right.parameters[1].name.getText(
sourceFile
);

View File

@ -1,6 +1,10 @@
import { getWebpackConfig, preprocessTypescript } from './preprocessor';
jest.mock('@cypress/webpack-preprocessor', () => {
return jest.fn(() => (...args) => Promise.resolve());
return jest.fn(
() =>
(...args) =>
Promise.resolve()
);
});
jest.mock('tsconfig-paths-webpack-plugin');
import * as wp from '@cypress/webpack-preprocessor';
@ -8,9 +12,9 @@ import TsConfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
describe('getWebpackConfig', () => {
beforeEach(() => {
(<any>(
TsConfigPathsPlugin
)).mockImplementation(function MockPathsPlugin() {});
(<any>TsConfigPathsPlugin).mockImplementation(
function MockPathsPlugin() {}
);
});
it('should load typescript', () => {
const config = getWebpackConfig({

View File

@ -13,7 +13,7 @@ import { sortObjectByKeys } from '@nrwl/tao/src/utils/object-sort';
export async function formatFiles(host: Tree): Promise<void> {
let prettier: typeof Prettier;
try {
prettier = require('prettier');
prettier = await import('prettier');
} catch {}
updateWorkspaceJsonToMatchFormatVersion(host);
@ -29,7 +29,7 @@ export async function formatFiles(host: Tree): Promise<void> {
await Promise.all(
Array.from(files).map(async (file) => {
const systemPath = path.join(host.root, file.path);
let options: any = {
let options: Prettier.Options = {
filepath: systemPath,
};
@ -42,7 +42,7 @@ export async function formatFiles(host: Tree): Promise<void> {
...resolvedOptions,
};
const support = await prettier.getFileInfo(systemPath, options);
const support = await prettier.getFileInfo(systemPath);
if (support.ignored || !support.inferredParser) {
return;
}

View File

@ -112,13 +112,8 @@ export function updateWorkspaceConfiguration(
host: Tree,
workspaceConfig: WorkspaceConfiguration
): void {
const {
version,
cli,
defaultProject,
generators,
...nxJson
} = workspaceConfig;
const { version, cli, defaultProject, generators, ...nxJson } =
workspaceConfig;
const workspace: Omit<Required<WorkspaceJsonConfiguration>, 'projects'> = {
version,
cli,
@ -210,11 +205,8 @@ function setProjectConfiguration(
);
}
const {
tags,
implicitDependencies,
...workspaceConfiguration
} = projectConfiguration;
const { tags, implicitDependencies, ...workspaceConfiguration } =
projectConfiguration;
addProjectToWorkspaceJson(host, projectName, workspaceConfiguration, mode);
addProjectToNxJson(
host,

View File

@ -11,9 +11,11 @@ import type { NxJsonConfiguration } from '@nrwl/tao/src/shared/nx';
* `{ appsDir: 'apps', libsDir: 'libs', npmScope: 'myorg' }`
* @param host - file system tree
*/
export function getWorkspaceLayout(
host: Tree
): { appsDir: string; libsDir: string; npmScope: string } {
export function getWorkspaceLayout(host: Tree): {
appsDir: string;
libsDir: string;
npmScope: string;
} {
const nxJson = readJson<NxJsonConfiguration>(host, 'nx.json');
return {
appsDir: nxJson.workspaceLayout?.appsDir ?? 'apps',

View File

@ -9,9 +9,7 @@
* ```
* @param name
*/
export function names(
name: string
): {
export function names(name: string): {
name: string;
className: string;
propertyName: string;

View File

@ -73,7 +73,8 @@ export function addOrUpdateProperty(
propertyAssignment.initializer.kind ===
ts.SyntaxKind.ArrayLiteralExpression
) {
const arrayLiteral = propertyAssignment.initializer as ts.ArrayLiteralExpression;
const arrayLiteral =
propertyAssignment.initializer as ts.ArrayLiteralExpression;
if (
arrayLiteral.elements.some((element) => {

View File

@ -87,7 +87,8 @@ export function addOrUpdateProperty(
propertyAssignment.initializer.kind ===
ts.SyntaxKind.ArrayLiteralExpression
) {
const arrayLiteral = propertyAssignment.initializer as ts.ArrayLiteralExpression;
const arrayLiteral =
propertyAssignment.initializer as ts.ArrayLiteralExpression;
if (
arrayLiteral.elements.some((element) => {

View File

@ -85,9 +85,9 @@ export default async function run(
throw new Error('Invalid lint configuration. Nothing to lint.');
}
const formatter: CLIEngine.Formatter = (projectESLint.CLIEngine as any).getFormatter(
options.format
);
const formatter: CLIEngine.Formatter = (
projectESLint.CLIEngine as any
).getFormatter(options.format);
const bundledReport: CLIEngine.LintReport = {
errorCount: 0,

View File

@ -526,10 +526,10 @@ export function updateOverridesAndRemoveDuplication(
) {
return;
}
json.overrides = json.overrides.filter((override) => {
json.overrides = json.overrides.filter((o) => {
for (const extendedOverride of configBeingExtended.overrides) {
try {
assert.deepStrictEqual(override, extendedOverride);
assert.deepStrictEqual(o, extendedOverride);
return false;
} catch {}
}

View File

@ -17,15 +17,15 @@ function updateRootESLintConfig(host: Tree) {
* configuration (instead of there being a silent, much slower fallback).
*/
if (json.overrides) {
json.overrides = json.overrides.map((override) => {
if (override.parserOptions && override.parserOptions.project) {
delete override.parserOptions.project;
json.overrides = json.overrides.map((o) => {
if (o.parserOptions && o.parserOptions.project) {
delete o.parserOptions.project;
// If the parserOptions object is now empty as a result, delete it too
if (Object.keys(override.parserOptions).length === 0) {
delete override.parserOptions;
if (Object.keys(o.parserOptions).length === 0) {
delete o.parserOptions;
}
}
return override;
return o;
});
}
return json;
@ -73,8 +73,7 @@ function updateProjectESLintConfigs(host: Tree) {
} else {
if (
!json.overrides.some(
(override) =>
override.parserOptions && override.parserOptions.project
(o) => o.parserOptions && o.parserOptions.project
)
) {
json.overrides.unshift({

View File

@ -19,7 +19,8 @@ function convertTSLintRuleSeverity(
if (tslintSeverity === 'default') {
tslintSeverity = tslintConfig.defaultSeverity || 'error';
}
const narrowedTslintSeverity = tslintSeverity as TSLintRuleSeverityNonDefaultString;
const narrowedTslintSeverity =
tslintSeverity as TSLintRuleSeverityNonDefaultString;
return narrowedTslintSeverity === 'warning' ? 'warn' : narrowedTslintSeverity;
}

View File

@ -144,9 +144,9 @@ export async function convertToESLintConfig(
},
};
const summarizedConfiguration = await (createESLintConfiguration as typeof CreateESLintConfiguration)(
originalConfigurations
);
const summarizedConfiguration = await (
createESLintConfiguration as typeof CreateESLintConfiguration
)(originalConfigurations);
/**
* We are expecting it to not find a converter for nx-enforce-module-boundaries

View File

@ -170,7 +170,8 @@ export class ProjectConverter {
delete convertedRootESLintConfig.parser;
delete convertedRootESLintConfig.parserOptions;
if (convertedRootESLintConfig.plugins) {
convertedRootESLintConfig.plugins = convertedRootESLintConfig.plugins.filter(
convertedRootESLintConfig.plugins =
convertedRootESLintConfig.plugins.filter(
(p) => p !== '@typescript-eslint/tslint'
);
}
@ -188,14 +189,14 @@ export class ProjectConverter {
if (!json.overrides) {
return json;
}
for (const override of json.overrides) {
if (!override.rules) {
for (const o of json.overrides) {
if (!o.rules) {
continue;
}
if (!override.rules[nxRuleName]) {
if (!o.rules[nxRuleName]) {
continue;
}
override.rules[nxRuleName] = nxEnforceModuleBoundariesRule;
o.rules[nxRuleName] = nxEnforceModuleBoundariesRule;
}
return json;
});
@ -273,7 +274,8 @@ export class ProjectConverter {
delete convertedProjectESLintConfig.parser;
delete convertedProjectESLintConfig.parserOptions;
if (convertedProjectESLintConfig.plugins) {
convertedProjectESLintConfig.plugins = convertedProjectESLintConfig.plugins.filter(
convertedProjectESLintConfig.plugins =
convertedProjectESLintConfig.plugins.filter(
(p) => p !== '@typescript-eslint/tslint'
);
}

View File

@ -104,19 +104,17 @@ export function deduplicateOverrides(
overrides: Linter.Config['overrides'] = []
) {
const map = new Map();
for (const override of overrides) {
for (const o of overrides) {
const mapKey: string =
typeof override.files === 'string'
? override.files
: override.files.join(',');
typeof o.files === 'string' ? o.files : o.files.join(',');
const existing: Set<Linter.ConfigOverride> = map.get(mapKey);
if (existing) {
existing.add(override);
existing.add(o);
map.set(mapKey, existing);
continue;
}
const set = new Set();
set.add(override);
set.add(o);
map.set(mapKey, set);
}
@ -129,10 +127,10 @@ export function deduplicateOverrides(
continue;
}
let mergedOverride = {};
for (const override of overridesArr) {
for (const o of overridesArr) {
mergedOverride = {
...mergedOverride,
...(override as any),
...(o as any),
};
}
dedupedOverrides.push(mergedOverride);

View File

@ -56,9 +56,9 @@ export function removeParserOptionsProjectIfNotRequired(
function getAllRulesInConfig(json: Linter.Config): string[] {
let allRules = json.rules ? Object.keys(json.rules) : [];
if (json.overrides?.length > 0) {
for (const override of json.overrides) {
if (override.rules) {
allRules = [...allRules, ...Object.keys(override.rules)];
for (const o of json.overrides) {
if (o.rules) {
allRules = [...allRules, ...Object.keys(o.rules)];
}
}
}

View File

@ -321,9 +321,9 @@ describe('lib', () => {
appTree
);
const tsconfigJson = readJsonInTree(tree, '/tsconfig.base.json');
expect(
tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']
).toEqual(['libs/my-dir/my-lib/src/index.ts']);
expect(tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']).toEqual(
['libs/my-dir/my-lib/src/index.ts']
);
expect(
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
).toBeUndefined();

View File

@ -11,9 +11,8 @@ export function tsNodeRegister(file: string = '', tsConfig?: string) {
// Register paths in tsConfig
const tsconfigPaths = require('tsconfig-paths');
const { absoluteBaseUrl: baseUrl, paths } = tsconfigPaths.loadConfig(
tsConfig
);
const { absoluteBaseUrl: baseUrl, paths } =
tsconfigPaths.loadConfig(tsConfig);
if (baseUrl && paths) {
tsconfigPaths.register({ baseUrl, paths });
}

View File

@ -109,10 +109,8 @@ async function killProcess() {
return;
}
const promisifiedTreeKill: (
pid: number,
signal: string
) => Promise<void> = promisify(treeKill);
const promisifiedTreeKill: (pid: number, signal: string) => Promise<void> =
promisify(treeKill);
try {
await promisifiedTreeKill(subProcess.pid, 'SIGTERM');
} catch (err) {

View File

@ -54,8 +54,7 @@ describe('app', () => {
fileReplacements: [
{
replace: 'apps/my-node-app/src/environments/environment.ts',
with:
'apps/my-node-app/src/environments/environment.prod.ts',
with: 'apps/my-node-app/src/environments/environment.prod.ts',
},
],
},

View File

@ -195,9 +195,9 @@ describe('lib', () => {
it('should update tsconfig.json', async () => {
await libraryGenerator(tree, { name: 'myLib', directory: 'myDir' });
const tsconfigJson = readJson(tree, '/tsconfig.base.json');
expect(
tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']
).toEqual(['libs/my-dir/my-lib/src/index.ts']);
expect(tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']).toEqual(
['libs/my-dir/my-lib/src/index.ts']
);
expect(
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
).toBeUndefined();

View File

@ -21,9 +21,9 @@ describe('getBaseWebpackPartial', () => {
root: '/root',
statsJson: false,
};
(<any>(
TsConfigPathsPlugin
)).mockImplementation(function MockPathsPlugin() {});
(<any>TsConfigPathsPlugin).mockImplementation(
function MockPathsPlugin() {}
);
});
describe('unconditional options', () => {
@ -346,7 +346,8 @@ describe('getBaseWebpackPartial', () => {
showCircularDependencies: true,
});
const circularDependencyPlugin: CircularDependencyPlugin = result.plugins.find(
const circularDependencyPlugin: CircularDependencyPlugin =
result.plugins.find(
(plugin) => plugin instanceof CircularDependencyPlugin
);
expect(circularDependencyPlugin.options.exclude).toEqual(

View File

@ -87,13 +87,13 @@ export function getBaseWebpackPartial(
if (options.extractLicenses) {
extraPlugins.push(
(new LicenseWebpackPlugin({
new LicenseWebpackPlugin({
stats: {
errors: false,
},
perChunkOutput: false,
outputFilename: `3rdpartylicenses.txt`,
}) as unknown) as webpack.Plugin
}) as unknown as webpack.Plugin
);
}

View File

@ -14,9 +14,9 @@ describe('getNodePartial', () => {
fileReplacements: [],
statsJson: false,
};
(<any>(
TsConfigPathsPlugin
)).mockImplementation(function MockPathsPlugin() {});
(<any>TsConfigPathsPlugin).mockImplementation(
function MockPathsPlugin() {}
);
});
describe('unconditionally', () => {

View File

@ -67,10 +67,8 @@ function normalizeOptions(host: Tree, options: Schema): NormalizedSchema {
const { npmScope } = getWorkspaceLayout(host);
const { fileName, className } = names(options.name);
const {
root: projectRoot,
sourceRoot: projectSourceRoot,
} = readProjectConfiguration(host, options.project);
const { root: projectRoot, sourceRoot: projectSourceRoot } =
readProjectConfiguration(host, options.project);
let description: string;
if (options.description) {

View File

@ -23,10 +23,8 @@ function normalizeOptions(host: Tree, options: Schema): NormalizedSchema {
const { npmScope } = getWorkspaceLayout(host);
const { fileName, className } = names(options.name);
const {
root: projectRoot,
sourceRoot: projectSourceRoot,
} = readProjectConfiguration(host, options.project);
const { root: projectRoot, sourceRoot: projectSourceRoot } =
readProjectConfiguration(host, options.project);
const npmPackageName = `@${npmScope}/${options.project}`;

View File

@ -27,10 +27,8 @@ function normalizeOptions(host: Tree, options: Schema): NormalizedSchema {
const description: string = options.description ?? name;
const {
root: projectRoot,
sourceRoot: projectSourceRoot,
} = readProjectConfiguration(host, options.project);
const { root: projectRoot, sourceRoot: projectSourceRoot } =
readProjectConfiguration(host, options.project);
const normalized: NormalizedSchema = {
...options,

View File

@ -232,9 +232,9 @@ describe('lib', () => {
it('should update tsconfig.base.json', async () => {
await libraryGenerator(appTree, { ...defaultSchema, directory: 'myDir' });
const tsconfigJson = readJson(appTree, '/tsconfig.base.json');
expect(
tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']
).toEqual(['libs/my-dir/my-lib/src/index.ts']);
expect(tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']).toEqual(
['libs/my-dir/my-lib/src/index.ts']
);
expect(
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
).toBeUndefined();

View File

@ -315,10 +315,8 @@ function updateAppRoutes(host: Tree, options: NormalizedSchema) {
// addInitialAppRoutes
{
const {
content: componentContent,
source: componentSource,
} = readComponent(host, appComponentPath);
const { content: componentContent, source: componentSource } =
readComponent(host, appComponentPath);
const isComponentRouterPresent = componentContent.match(/react-router-dom/);
if (!isComponentRouterPresent) {
const changes = applyChangesToString(
@ -331,10 +329,8 @@ function updateAppRoutes(host: Tree, options: NormalizedSchema) {
// addNewAppRoute
{
const {
content: componentContent,
source: componentSource,
} = readComponent(host, appComponentPath);
const { content: componentContent, source: componentSource } =
readComponent(host, appComponentPath);
const { npmScope } = getWorkspaceLayout(host);
const changes = applyChangesToString(
componentContent,

View File

@ -498,8 +498,9 @@ export function getComponentPropsInterface(
);
if (propsParam && propsParam.type) {
propsTypeName = ((propsParam.type as ts.TypeReferenceNode)
.typeName as ts.Identifier).text;
propsTypeName = (
(propsParam.type as ts.TypeReferenceNode).typeName as ts.Identifier
).text;
}
} else if (
(cmpDeclaration as ts.VariableDeclaration).initializer &&
@ -513,8 +514,9 @@ export function getComponentPropsInterface(
);
if (propsParam && propsParam.type) {
propsTypeName = ((propsParam.type as ts.TypeReferenceNode)
.typeName as ts.Identifier).text;
propsTypeName = (
(propsParam.type as ts.TypeReferenceNode).typeName as ts.Identifier
).text;
}
} else if (
// do we have a class component extending from React.Component
@ -533,8 +535,9 @@ export function getComponentPropsInterface(
});
if (propsTypeExpression && propsTypeExpression.typeArguments) {
propsTypeName = (propsTypeExpression
.typeArguments[0] as ts.TypeReferenceNode).typeName.getText();
propsTypeName = (
propsTypeExpression.typeArguments[0] as ts.TypeReferenceNode
).typeName.getText();
}
}
} else {

View File

@ -1,8 +1,8 @@
import * as prettier from 'prettier';
import { format } from 'prettier';
import { stripIndents } from '@nrwl/devkit';
export function formatFile(content, ...values) {
return prettier.format(stripIndents(content, values), {
return format(stripIndents(content, values), {
singleQuote: true,
parser: 'typescript',
});

View File

@ -22,8 +22,10 @@ export function getStorybookFrameworkPath(uiFramework) {
}
function isStorybookV62onwards(uiFramework) {
const storybookPackageVersion = require(join(uiFramework, 'package.json'))
.version;
const storybookPackageVersion = require(join(
uiFramework,
'package.json'
)).version;
return gte(storybookPackageVersion, '6.2.0-rc.4');
}

View File

@ -258,13 +258,13 @@ function updateLintConfig(tree: Tree, schema: StorybookConfigureSchema) {
}
const overrides = json.overrides || [];
for (const override of overrides) {
if (typeof override.parserOptions?.project === 'string') {
override.parserOptions.project = [override.parserOptions.project];
for (const o of overrides) {
if (typeof o.parserOptions?.project === 'string') {
o.parserOptions.project = [o.parserOptions.project];
}
if (Array.isArray(override.parserOptions?.project)) {
override.parserOptions.project = dedupe([
...override.parserOptions.project,
if (Array.isArray(o.parserOptions?.project)) {
o.parserOptions.project = dedupe([
...o.parserOptions.project,
join(root, '.storybook/tsconfig.json'),
]);
}

View File

@ -51,9 +51,7 @@ export async function migrateStoriesTo62Generator(tree: Tree) {
await formatFiles(tree);
}
export function findAllAngularProjectsWithStorybookConfiguration(
tree: Tree
): {
export function findAllAngularProjectsWithStorybookConfiguration(tree: Tree): {
name: string;
configFolder: string;
projectRoot: string;

View File

@ -162,11 +162,8 @@ export async function taoNew(cwd: string, args: string[], isVerbose = false) {
return handleErrors(isVerbose, async () => {
const opts = parseGenerateOpts(args, 'new', null);
const {
normalizedGeneratorName,
schema,
implementationFactory,
} = ws.readGenerator(opts.collectionName, opts.generatorName);
const { normalizedGeneratorName, schema, implementationFactory } =
ws.readGenerator(opts.collectionName, opts.generatorName);
const combinedOpts = await combineOptionsForGenerator(
opts.generatorOptions,
@ -223,11 +220,8 @@ export async function generate(
readDefaultCollection(workspaceDefinition)
);
const {
normalizedGeneratorName,
schema,
implementationFactory,
} = ws.readGenerator(opts.collectionName, opts.generatorName);
const { normalizedGeneratorName, schema, implementationFactory } =
ws.readGenerator(opts.collectionName, opts.generatorName);
if (opts.help) {
printGenHelp(opts, schema);

View File

@ -666,12 +666,9 @@ async function runMigrations(
if (m.cli === 'nx') {
await runNxMigration(root, m.package, m.name);
} else {
await (await import('./ngcli-adapter')).runMigration(
root,
m.package,
m.name,
isVerbose
);
await (
await import('./ngcli-adapter')
).runMigration(root, m.package, m.name, isVerbose);
}
logger.info(`Successfully finished ${m.name}`);
logger.info(`---------------------------------------------------------`);

View File

@ -281,9 +281,7 @@ export class NxScopedHost extends virtualFs.ScopedHost<any> {
.toPromise();
}
protected context(
path: string
): Observable<{
protected context(path: string): Observable<{
isWorkspaceConfig: boolean;
actualConfigFileName: any;
isNewFormat: boolean;
@ -516,8 +514,8 @@ export async function runMigration(
schematic: string,
isVerbose: boolean
) {
const NodeModulesEngineHost = require('@angular-devkit/schematics/tools')
.NodeModulesEngineHost;
const NodeModulesEngineHost =
require('@angular-devkit/schematics/tools').NodeModulesEngineHost;
class MigrationEngineHost extends NodeModulesEngineHost {
private nodeInstallLogPrinted = false;

View File

@ -55,11 +55,8 @@ function parseRunOpts(
throwInvalidInvocation();
}
// eslint-disable-next-line prefer-const
let [project, target, configuration]: [
string,
string,
string
] = runOptions._[0].split(':');
let [project, target, configuration]: [string, string, string] =
runOptions._[0].split(':');
if (!project && defaultProjectName) {
logger.debug(
`No project name specified. Using default project : ${chalk.bold(
@ -245,7 +242,9 @@ async function runExecutorInternal<T extends { success: boolean }>(
}
} else {
require('../compat/compat');
const observable = await (await import('./ngcli-adapter')).scheduleTarget(
const observable = await (
await import('./ngcli-adapter')
).scheduleTarget(
root,
{
project,

View File

@ -17,11 +17,13 @@ if (!patched) {
};
try {
require('@angular-devkit/build-angular/src/utils/version').Version.assertCompatibleAngularVersion = () => {};
require('@angular-devkit/build-angular/src/utils/version').Version.assertCompatibleAngularVersion =
() => {};
} catch (e) {}
try {
require('@angular-devkit/build-angular/src/utils/version').assertCompatibleAngularVersion = () => {};
require('@angular-devkit/build-angular/src/utils/version').assertCompatibleAngularVersion =
() => {};
} catch (e) {}
patched = true;

View File

@ -561,7 +561,9 @@ async function promptForValues(opts: Options, schema: Schema) {
}
});
return await (await import('enquirer'))
return await (
await import('enquirer')
)
.prompt(prompts)
.then((values) => ({ ...opts, ...values }))
.catch((e) => {

View File

@ -322,11 +322,8 @@ export class Workspaces {
readGenerator(collectionName: string, generatorName: string) {
try {
const {
generatorsFilePath,
generatorsJson,
normalizedGeneratorName,
} = this.readGeneratorsJson(collectionName, generatorName);
const { generatorsFilePath, generatorsJson, normalizedGeneratorName } =
this.readGeneratorsJson(collectionName, generatorName);
const generatorsDir = path.dirname(generatorsFilePath);
const generatorConfig =
generatorsJson.generators?.[normalizedGeneratorName] ||
@ -338,9 +335,8 @@ export class Workspaces {
}
generatorConfig.implementation =
generatorConfig.implementation || generatorConfig.factory;
const [modulePath, exportName] = generatorConfig.implementation.split(
'#'
);
const [modulePath, exportName] =
generatorConfig.implementation.split('#');
const implementationFactory = () => {
const module = require(path.join(generatorsDir, modulePath));
return module[exportName || 'default'] as Generator;

View File

@ -23,9 +23,9 @@ describe('getBaseWebpackPartial', () => {
sourceRoot: '/root/src',
statsJson: false,
};
(<any>(
TsconfigPathsPlugin
)).mockImplementation(function MockPathsPlugin() {});
(<any>TsconfigPathsPlugin).mockImplementation(
function MockPathsPlugin() {}
);
});
describe('unconditional options', () => {
@ -340,7 +340,8 @@ describe('getBaseWebpackPartial', () => {
showCircularDependencies: true,
});
const circularDependencyPlugin: CircularDependencyPlugin = result.plugins.find(
const circularDependencyPlugin: CircularDependencyPlugin =
result.plugins.find(
(plugin) => plugin instanceof CircularDependencyPlugin
);
expect(circularDependencyPlugin.options.exclude).toEqual(

View File

@ -119,13 +119,13 @@ export function getBaseWebpackPartial(
if (options.extractLicenses) {
extraPlugins.push(
(new LicenseWebpackPlugin({
new LicenseWebpackPlugin({
stats: {
errors: false,
},
perChunkOutput: false,
outputFilename: `3rdpartylicenses.txt`,
}) as unknown) as webpack.Plugin
}) as unknown as webpack.Plugin
);
}

View File

@ -61,9 +61,9 @@ describe('getDevServerConfig', () => {
allowedHosts: null,
};
(<any>(
TsConfigPathsPlugin
)).mockImplementation(function MockPathsPlugin() {});
(<any>TsConfigPathsPlugin).mockImplementation(
function MockPathsPlugin() {}
);
mockCompilerOptions = {
target: 'es2015',

View File

@ -46,10 +46,8 @@ function getDevServerPartial(
): WebpackDevServerConfiguration {
const servePath = buildServePath(buildOptions);
const {
scripts: scriptsOptimization,
styles: stylesOptimization,
} = buildOptions.optimization as OptimizationOptions;
const { scripts: scriptsOptimization, styles: stylesOptimization } =
buildOptions.optimization as OptimizationOptions;
const config: WebpackDevServerConfiguration = {
host: options.host,

View File

@ -23,10 +23,8 @@ export function getBrowserConfig(
const extraPlugins = [];
let isEval = false;
const {
styles: stylesOptimization,
scripts: scriptsOptimization,
} = buildOptions.optimization;
const { styles: stylesOptimization, scripts: scriptsOptimization } =
buildOptions.optimization;
const {
styles: stylesSourceMap,
scripts: scriptsSourceMap,

View File

@ -51,10 +51,8 @@ const g: any = typeof global !== 'undefined' ? global : {};
// tslint:disable-next-line:no-big-function
export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
const { root, projectRoot, buildOptions, tsConfig } = wco;
const {
styles: stylesOptimization,
scripts: scriptsOptimization,
} = buildOptions.optimization;
const { styles: stylesOptimization, scripts: scriptsOptimization } =
buildOptions.optimization;
const {
styles: stylesSourceMap,
scripts: scriptsSourceMap,
@ -88,7 +86,8 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
tsConfig.options.target || ScriptTarget.ES5
);
differentialLoadingNeeded = buildBrowserFeatures.isDifferentialLoadingNeeded();
differentialLoadingNeeded =
buildBrowserFeatures.isDifferentialLoadingNeeded();
if (
(buildOptions.scriptTargetOverride || tsConfig.options.target) ===

View File

@ -18,7 +18,8 @@ export class RemoveHashPlugin {
apply(compiler: Compiler): void {
compiler.hooks.compilation.tap('remove-hash-plugin', (compilation) => {
const mainTemplate = compilation.mainTemplate as compilation.MainTemplate & {
const mainTemplate =
compilation.mainTemplate as compilation.MainTemplate & {
hooks: compilation.CompilationHooks;
};

View File

@ -44,9 +44,9 @@ describe('getWebConfig', () => {
target: 'es2015',
paths: { path: ['mapped/path'] },
};
(<any>(
TsConfigPathsPlugin
)).mockImplementation(function MockPathsPlugin() {});
(<any>TsConfigPathsPlugin).mockImplementation(
function MockPathsPlugin() {}
);
jest.spyOn(ts, 'readConfigFile').mockImplementation(() => ({
config: {

View File

@ -879,6 +879,15 @@
"alwaysAddToPackageJson": false
}
}
},
"12.5.0": {
"version": "12.5.0",
"packages": {
"prettier": {
"version": "^2.3.1",
"alwaysAddToPackageJson": false
}
}
}
}
}

View File

@ -52,14 +52,13 @@
]
},
"peerDependencies": {
"prettier": "^2.0.4"
"prettier": "^2.3.0"
},
"dependencies": {
"@nrwl/cli": "*",
"@nrwl/devkit": "*",
"@nrwl/jest": "*",
"@nrwl/linter": "*",
"cosmiconfig": "^4.0.0",
"fs-extra": "^9.1.0",
"dotenv": "8.2.0",
"glob": "7.1.4",

View File

@ -49,7 +49,9 @@ export async function connectToNxCloudCommand(): Promise<void> {
}
async function connectToNxCloudPrompt() {
return await (await import('enquirer'))
return await (
await import('enquirer')
)
.prompt([
{
name: 'NxCloud',
@ -58,8 +60,7 @@ async function connectToNxCloudPrompt() {
choices: [
{
name: 'Yes',
hint:
'Faster builds, run details, GitHub integration. Learn more at https://nx.app',
hint: 'Faster builds, run details, GitHub integration. Learn more at https://nx.app',
},
{
name: 'No',

View File

@ -65,8 +65,9 @@ function getProjects(
if (includeDeps) {
const s = require(`../core/project-graph`);
const deps = s.onlyWorkspaceProjects(s.withDeps(projectGraph, projects))
.nodes;
const deps = s.onlyWorkspaceProjects(
s.withDeps(projectGraph, projects)
).nodes;
const projectsWithTarget = Object.values(deps).filter((p: any) =>
projectHasTarget(p, target)
);

View File

@ -94,9 +94,10 @@ function gitLsTree(path: string): Map<string, string> {
);
}
function gitStatus(
path: string
): { status: Map<string, string>; deletedFiles: string[] } {
function gitStatus(path: string): {
status: Map<string, string>;
deletedFiles: string[];
} {
const deletedFiles: string[] = [];
const filesToHash: string[] = [];
parseGitStatus(path).forEach((changeType: string, filename: string) => {

View File

@ -178,9 +178,9 @@ function updateAngularCLIJson(host: Tree, options: Schema) {
if (defaultProject.targets.server) {
const serverOptions = defaultProject.targets.server.options;
convertServerOptions(serverOptions);
Object.values(
defaultProject.targets.server.configurations
).forEach((config) => convertServerOptions(config));
Object.values(defaultProject.targets.server.configurations).forEach(
(config) => convertServerOptions(config)
);
}
if (defaultProject.targets.e2e) {

View File

@ -239,9 +239,9 @@ describe('lib', () => {
directory: 'myDir',
});
const tsconfigJson = readJson(tree, '/tsconfig.base.json');
expect(
tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']
).toEqual(['libs/my-dir/my-lib/src/index.ts']);
expect(tsconfigJson.compilerOptions.paths['@proj/my-dir/my-lib']).toEqual(
['libs/my-dir/my-lib/src/index.ts']
);
expect(
tsconfigJson.compilerOptions.paths['my-dir-my-lib/*']
).toBeUndefined();

View File

@ -43,9 +43,9 @@ export function updateEslintrcJson(
updateJson<PartialEsLintRcJson>(tree, eslintRcPath, (eslintRcJson) => {
eslintRcJson.extends = `${offset}.eslintrc.json`;
eslintRcJson.overrides?.forEach((override) => {
if (override.parserOptions?.project) {
override.parserOptions.project = [`${destination}/tsconfig.*?.json`];
eslintRcJson.overrides?.forEach((o) => {
if (o.parserOptions?.project) {
o.parserOptions.project = [`${destination}/tsconfig.*?.json`];
}
});

View File

@ -12,7 +12,7 @@ Object {
"@nrwl/workspace": "*",
"@types/node": "14.14.33",
"dotenv": "8.2.0",
"prettier": "2.2.1",
"prettier": "^2.3.1",
"ts-node": "~9.1.1",
"typescript": "~4.2.4",
},
@ -57,7 +57,7 @@ Object {
"@nrwl/workspace": "*",
"@types/node": "14.14.33",
"dotenv": "8.2.0",
"prettier": "2.2.1",
"prettier": "^2.3.1",
"ts-node": "~9.1.1",
"typescript": "~4.2.4",
},
@ -103,7 +103,7 @@ Object {
"@nrwl/workspace": "*",
"@types/node": "14.14.33",
"dotenv": "8.2.0",
"prettier": "2.2.1",
"prettier": "^2.3.1",
"ts-node": "~9.1.1",
"typescript": "~4.2.4",
},

View File

@ -57,7 +57,8 @@ export function updateJestConfig(
`Could not remove ${projectToRemove} from projects in /jest.config.js. Please remove ${projectToRemove} from your projects.`
);
}
const projectsArray = projectsAssignment.initializer as ArrayLiteralExpression;
const projectsArray =
projectsAssignment.initializer as ArrayLiteralExpression;
const project = projectsArray.elements.find(
(item) =>

View File

@ -103,9 +103,8 @@ export default function (schema: any): Rule {
if (extendedTsconfigPath === normalize('tsconfig.json')) {
return updateExtend(file);
} else if (basename(json.extends) === 'tsconfig.json') {
let extendedTsconfig = originalExtendedTsconfigMap.get(
extendedTsconfigPath
);
let extendedTsconfig =
originalExtendedTsconfigMap.get(extendedTsconfigPath);
if (!extendedTsconfig) {
extendedTsconfig = readJsonInTree(host, extendedTsconfigPath);

View File

@ -13,9 +13,8 @@ export default function (): Rule {
let needsAngularExtension = false;
for (let [, project] of workspace.projects) {
needsAngularExtension = Array.from(
project.targets
).some(([, targetDefinition]) =>
needsAngularExtension = Array.from(project.targets).some(
([, targetDefinition]) =>
targetDefinition.builder.startsWith('@angular-devkit')
);

View File

@ -46,9 +46,8 @@ const addCacheableOperations = updateJsonInTree('nx.json', (nxJson) => {
cacheableOperations.add('test');
cacheableOperations.add('e2e');
nxJson.tasksRunnerOptions.default.options.cacheableOperations = Array.from(
cacheableOperations
);
nxJson.tasksRunnerOptions.default.options.cacheableOperations =
Array.from(cacheableOperations);
return nxJson;
}

View File

@ -104,7 +104,8 @@ describe('createTasksForProjectToRun', () => {
});
it('should create the tasks for multiple projects passed with configuration', () => {
projectGraph.nodes.app1.data.targets.build.configurations = projectGraph.nodes.lib1.data.targets.build.configurations = {
projectGraph.nodes.app1.data.targets.build.configurations =
projectGraph.nodes.lib1.data.targets.build.configurations = {
production: {},
};
const tasks = createTasksForProjectToRun(

View File

@ -365,7 +365,8 @@ describe('TaskGraphCreator', () => {
});
it('should create task graph (builds depend on build of dependencies, builds depend on prebuilds)', () => {
projectGraph.nodes.common1.data.targets = projectGraph.nodes.common2.data.targets = {
projectGraph.nodes.common1.data.targets =
projectGraph.nodes.common2.data.targets = {
prebuild: {},
build: {
dependsOn: [
@ -380,7 +381,8 @@ describe('TaskGraphCreator', () => {
],
},
};
projectGraph.nodes.app1.data.targets = projectGraph.nodes.app2.data.targets = {
projectGraph.nodes.app1.data.targets =
projectGraph.nodes.app2.data.targets = {
build: {
dependsOn: [
{

View File

@ -263,9 +263,8 @@ export class TaskOrchestrator {
}
private storeEndTime(t: Task) {
this.timings[
`${t.target.project}:${t.target.target}`
].end = new Date().getTime();
this.timings[`${t.target.project}:${t.target.target}`].end =
new Date().getTime();
}
private pipeOutputCapture(task: Task) {

View File

@ -325,9 +325,8 @@ export function updateBuildableProjectPackageJsonDependencies(
depVersion = entry.node.data.version;
packageJson[typeOfDependency][
entry.node.data.packageName
] = depVersion;
packageJson[typeOfDependency][entry.node.data.packageName] =
depVersion;
}
updatePackageJson = true;
} catch (e) {

View File

@ -1,31 +1,32 @@
import { resolveConfig, resolveConfigFile } from 'prettier';
import type { Options } from 'prettier';
import * as cosmiconfig from 'cosmiconfig';
import { NormalModuleReplacementPlugin } from 'webpack';
export interface ExistingPrettierConfig {
sourceFilepath: string;
config: Options;
}
export function resolveUserExistingPrettierConfig(): Promise<ExistingPrettierConfig | null> {
const explorer = cosmiconfig('prettier', {
sync: true,
cache: false,
rcExtensions: true,
stopDir: process.cwd(),
transform: (result) => {
if (result && result.config) {
delete result.config.$schema;
}
return result;
},
});
return Promise.resolve(explorer.load(process.cwd())).then((result) => {
if (!result) {
export async function resolveUserExistingPrettierConfig(): Promise<ExistingPrettierConfig | null> {
try {
const filepath = await resolveConfigFile();
if (!filepath) {
return null;
}
return {
sourceFilepath: result.filepath,
config: result.config,
};
const config = await resolveConfig(process.cwd(), {
useCache: false,
config: filepath,
});
if (!config) {
return null;
}
return {
sourceFilepath: filepath,
config: config,
};
} catch {
return null;
}
}

View File

@ -290,9 +290,8 @@ export function updateBuildableProjectPackageJsonDependencies(
depVersion = entry.node.data.version;
packageJson[typeOfDependency][
entry.node.data.packageName
] = depVersion;
packageJson[typeOfDependency][entry.node.data.packageName] =
depVersion;
}
updatePackageJson = true;
} catch (e) {

View File

@ -141,10 +141,8 @@ export function addLintFiles(
* so as well as applying the extension from the root lint config, we also
* adjust the config to make extends come first.
*/
const {
extends: extendsVal,
...localConfigExceptExtends
} = options.localConfig;
const { extends: extendsVal, ...localConfigExceptExtends } =
options.localConfig;
const extendsOption = extendsVal
? Array.isArray(extendsVal)

View File

@ -28,12 +28,12 @@ interface NormalizedRenameDescriptors {
inPackageJson: boolean;
}
const normalizeToDescriptors = (packageJson: any) => ([
packageName,
newPackageNameConfig,
]): NormalizedRenameDescriptors => {
const normalizeToDescriptors =
(packageJson: any) =>
([packageName, newPackageNameConfig]): NormalizedRenameDescriptors => {
const isDevDep =
!!packageJson.devDependencies && packageName in packageJson.devDependencies;
!!packageJson.devDependencies &&
packageName in packageJson.devDependencies;
const inPackageJson =
(packageJson.dependencies && packageName in packageJson.dependencies) ||
isDevDep;

View File

@ -16,8 +16,8 @@ export function setDefaultCollection(collectionName: string): Rule {
((workspace.extensions.cli as JsonObject).defaultCollection as string);
if (!defaultCollection || defaultCollection === '@nrwl/workspace') {
(workspace.extensions
.cli as JsonObject).defaultCollection = collectionName;
(workspace.extensions.cli as JsonObject).defaultCollection =
collectionName;
}
});
}

Some files were not shown because too many files have changed in this diff Show More