Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
Comment thread
Hotell marked this conversation as resolved.
"type": "minor",
"comment": "feat(eslint-plugin): turn off fluentui/max-lenght rule for v9",
"packageName": "@fluentui/eslint-plugin",
"email": "martinhochel@microsoft.com",
"dependentChangeType": "patch"
}
1 change: 1 addition & 0 deletions packages/eslint-plugin/src/configs/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
* @see https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin
*/
...getNamingConventionRule(),
'@fluentui/max-len': 'off',
Comment thread
Hotell marked this conversation as resolved.
},
overrides: [
{
Expand Down
37 changes: 28 additions & 9 deletions scripts/generators/create-component/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Plop script for templating out a converged React component
//#region Imports
import { NodePlopAPI, AddManyActionConfig } from 'plop';
import { Actions } from 'node-plop';
import * as fs from 'fs-extra';
import { execSync } from 'child_process';
import * as os from 'os';
import * as path from 'path';
import { execSync } from 'child_process';
import chalk from 'chalk';
import { names, WorkspaceJsonConfiguration } from '@nrwl/devkit';

import { findGitRoot, getAllPackageInfo, isConvergedPackage } from '@fluentui/scripts-monorepo';
import { WorkspaceJsonConfiguration, names } from '@nrwl/devkit';
import chalk from 'chalk';
import * as fs from 'fs-extra';
import { Actions } from 'node-plop';
import { AddManyActionConfig, NodePlopAPI } from 'plop';

//#endregion

Expand Down Expand Up @@ -117,6 +117,11 @@ module.exports = (plop: NodePlopAPI) => {
stdio: 'inherit',
});

execSync(`yarn workspace ${data.packageNpmName} lint --fix`, {
Comment thread
Hotell marked this conversation as resolved.
cwd: root,
stdio: 'inherit',
});

return 'Component ready!';
},
];
Expand All @@ -139,18 +144,32 @@ const checkIfComponentAlreadyExists = (data: Data): string => {
const appendToPackageIndex = (data: Data): string => {
const { componentName, packageName, packagePath } = data;

// get the package index file path
const indexPath = path.join(packagePath, 'src/index.ts');
const indexContent = cleanCreatePackageTemplate(indexPath);
Comment thread
Hotell marked this conversation as resolved.

const appendLine = `export * from './${componentName}';`;

// read contents and see if line is exists
const contents = fs.readFileSync(indexPath, { encoding: 'utf8' });
if (!contents.includes(appendLine)) {
if (!indexContent.includes(appendLine)) {
// doesn't exist so append
fs.writeFileSync(indexPath, `${appendLine}${os.EOL}`, { flag: 'a' });
return `Updated package ${packageName} index.ts to include ${componentName}`;
}

return `Package ${packageName} index.ts already contains reference to ${componentName}`;

function cleanCreatePackageTemplate(filePath: string) {
const content = fs.readFileSync(filePath, { encoding: 'utf8' });
const templateContent = 'export {}';

if (content.indexOf(templateContent) !== -1) {
fs.writeFileSync(filePath, '');
return '';
}
return content;
}
};

//#endregion

function getProjectMetadata(options: { root: string; name: string }) {
Expand Down
2 changes: 1 addition & 1 deletion tools/generators/migrate-converged-pkg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ function updatePackageJson(tree: Tree, options: NormalizedSchemaWithTsConfigs) {
return json;

function normalizePackageEntryPointPaths(entryPath: string) {
return './' + path.normalize(entryPath);
return './' + path.posix.normalize(entryPath);
Comment thread
Hotell marked this conversation as resolved.
}
}
}
Expand Down