diff --git a/change/@fluentui-eslint-plugin-9c309582-f6de-425d-bc96-c927db2786da.json b/change/@fluentui-eslint-plugin-9c309582-f6de-425d-bc96-c927db2786da.json new file mode 100644 index 0000000000000..34c0a3ff31846 --- /dev/null +++ b/change/@fluentui-eslint-plugin-9c309582-f6de-425d-bc96-c927db2786da.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "feat(eslint-plugin): turn off fluentui/max-lenght rule for v9", + "packageName": "@fluentui/eslint-plugin", + "email": "martinhochel@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/eslint-plugin/src/configs/base.js b/packages/eslint-plugin/src/configs/base.js index d5de005e17200..5956169dcabe7 100644 --- a/packages/eslint-plugin/src/configs/base.js +++ b/packages/eslint-plugin/src/configs/base.js @@ -13,6 +13,7 @@ module.exports = { * @see https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin */ ...getNamingConventionRule(), + '@fluentui/max-len': 'off', }, overrides: [ { diff --git a/scripts/generators/create-component/index.ts b/scripts/generators/create-component/index.ts index 2ca117bef71d0..aecadc770d852 100644 --- a/scripts/generators/create-component/index.ts +++ b/scripts/generators/create-component/index.ts @@ -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 @@ -117,6 +117,11 @@ module.exports = (plop: NodePlopAPI) => { stdio: 'inherit', }); + execSync(`yarn workspace ${data.packageNpmName} lint --fix`, { + cwd: root, + stdio: 'inherit', + }); + return 'Component ready!'; }, ]; @@ -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); + 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 }) { diff --git a/tools/generators/migrate-converged-pkg/index.ts b/tools/generators/migrate-converged-pkg/index.ts index c189ec5079359..427de28bd3441 100644 --- a/tools/generators/migrate-converged-pkg/index.ts +++ b/tools/generators/migrate-converged-pkg/index.ts @@ -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); } } }