From 767c8667639509eec8ac4f1dc60010ace467d3f9 Mon Sep 17 00:00:00 2001 From: Dmytro Kirpa Date: Thu, 20 Nov 2025 11:33:14 +0100 Subject: [PATCH 1/2] fix(vr-tests): add extra snapshots for narrow overflow menu states (#35507) --- apps/vr-tests/src/stories/PivotOverflow.stories.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/vr-tests/src/stories/PivotOverflow.stories.tsx b/apps/vr-tests/src/stories/PivotOverflow.stories.tsx index 948a91cb3a032..49f6a8de98f64 100644 --- a/apps/vr-tests/src/stories/PivotOverflow.stories.tsx +++ b/apps/vr-tests/src/stories/PivotOverflow.stories.tsx @@ -28,8 +28,10 @@ export default { .executeScript('document.querySelector(".testWrapper").style.width = "750px"') .snapshot('Wide', { cropTo: '.testWrapper' }) .executeScript('document.querySelector(".testWrapper").style.width = "250px"') + .snapshot('Narrow', { cropTo: '.testWrapper' }) .click('.ms-Pivot-overflowMenuButton') .wait(2500) + .snapshot('Narrow - Overflow menu open', { cropTo: '.testWrapper' }) .click('.ms-Pivot-linkInMenu[data-last-tab]') .snapshot('Narrow - Last tab selected', { cropTo: '.testWrapper' }) .click('.ms-Pivot-overflowMenuButton') From b85c6aae5ad2f411a63ce268296e4629d1c8263f Mon Sep 17 00:00:00 2001 From: Victor Genaev Date: Thu, 20 Nov 2025 15:47:46 +0100 Subject: [PATCH 2/2] =?UTF-8?q?chore(workspace-plugin):=20update=20generat?= =?UTF-8?q?ors=20to=20generate=20eslint=20flat=20co=E2=80=A6=20(#35510)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../files/.eslintrc.json__tmpl__ | 4 -- .../files/eslint.config.js__tmpl__ | 5 +++ .../generators/react-library/index.spec.ts | 42 +++++++++---------- .../split-library-in-two/generator.spec.ts | 34 +++++++-------- .../split-library-in-two/generator.ts | 23 ++++++---- 5 files changed, 59 insertions(+), 49 deletions(-) delete mode 100644 tools/workspace-plugin/src/generators/react-library/files/.eslintrc.json__tmpl__ create mode 100644 tools/workspace-plugin/src/generators/react-library/files/eslint.config.js__tmpl__ diff --git a/tools/workspace-plugin/src/generators/react-library/files/.eslintrc.json__tmpl__ b/tools/workspace-plugin/src/generators/react-library/files/.eslintrc.json__tmpl__ deleted file mode 100644 index ceea884c70dcc..0000000000000 --- a/tools/workspace-plugin/src/generators/react-library/files/.eslintrc.json__tmpl__ +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": ["plugin:@fluentui/eslint-plugin/react"], - "root": true -} diff --git a/tools/workspace-plugin/src/generators/react-library/files/eslint.config.js__tmpl__ b/tools/workspace-plugin/src/generators/react-library/files/eslint.config.js__tmpl__ new file mode 100644 index 0000000000000..ec2e7cb1fc479 --- /dev/null +++ b/tools/workspace-plugin/src/generators/react-library/files/eslint.config.js__tmpl__ @@ -0,0 +1,5 @@ +// @ts-check + +const fluentPlugin = require('@fluentui/eslint-plugin'); + +module.exports = [...fluentPlugin.configs['flat/react']]; diff --git a/tools/workspace-plugin/src/generators/react-library/index.spec.ts b/tools/workspace-plugin/src/generators/react-library/index.spec.ts index ef7d1b5d1b2b6..0bc3f897812ec 100644 --- a/tools/workspace-plugin/src/generators/react-library/index.spec.ts +++ b/tools/workspace-plugin/src/generators/react-library/index.spec.ts @@ -54,12 +54,12 @@ describe('react-library generator', () => { Array [ "project.json", ".babelrc.json", - ".eslintrc.json", ".swcrc", "LICENSE", "README.md", "config", "docs", + "eslint.config.js", "etc", "jest.config.js", "package.json", @@ -172,7 +172,7 @@ describe('react-library generator', () => { "src", ".storybook", "README.md", - ".eslintrc.json", + "eslint.config.js", "tsconfig.json", "tsconfig.lib.json", "package.json", @@ -213,24 +213,24 @@ describe('react-library generator', () => { " `); - expect(readJson(tree, `${stories.root}/.eslintrc.json`)).toMatchInlineSnapshot(` - Object { - "extends": Array [ - "plugin:@fluentui/eslint-plugin/react", - ], - "root": true, - "rules": Object { - "import/no-extraneous-dependencies": Array [ - "error", - Object { - "packageDir": Array [ - ".", - "../../../../", - ], - }, - ], + const eslintConfig = tree.read(`${stories.root}/eslint.config.js`, 'utf-8'); + expect(eslintConfig).toMatchInlineSnapshot(` + "// @ts-check + + const fluentPlugin = require('@fluentui/eslint-plugin'); + + module.exports = [ + ...fluentPlugin.configs['flat/react'], + { + rules: { + 'import/no-extraneous-dependencies': [ + 'error', + { packageDir: ['.', '../../../../'] }, + ], + }, }, - } + ]; + " `); // global updates @@ -264,12 +264,12 @@ describe('react-library generator', () => { Array [ "project.json", ".babelrc.json", - ".eslintrc.json", ".swcrc", "LICENSE", "README.md", "config", "docs", + "eslint.config.js", "etc", "jest.config.js", "package.json", @@ -294,7 +294,7 @@ describe('react-library generator', () => { "src", ".storybook", "README.md", - ".eslintrc.json", + "eslint.config.js", "tsconfig.json", "tsconfig.lib.json", "package.json", diff --git a/tools/workspace-plugin/src/generators/split-library-in-two/generator.spec.ts b/tools/workspace-plugin/src/generators/split-library-in-two/generator.spec.ts index 303bd9b42eaec..3b1ecf8b4eb22 100644 --- a/tools/workspace-plugin/src/generators/split-library-in-two/generator.spec.ts +++ b/tools/workspace-plugin/src/generators/split-library-in-two/generator.spec.ts @@ -233,25 +233,25 @@ describe('split-library-in-two generator', () => { ], } `); - expect(readJson(tree, `${storiesConfig.root}/.eslintrc.json`)).toMatchInlineSnapshot(` - Object { - "extends": Array [ - "plugin:@fluentui/eslint-plugin/react", - ], - "root": true, - "rules": Object { - "import/no-extraneous-dependencies": Array [ - "error", - Object { - "packageDir": Array [ - ".", - "../../../../", - ], - }, - ], + expect(tree.read(`${storiesConfig.root}/eslint.config.js`, 'utf-8')).toMatchInlineSnapshot(` + "// @ts-check + + const fluentPlugin = require('@fluentui/eslint-plugin'); + + module.exports = [ + ...fluentPlugin.configs['flat/react'], + { + rules: { + 'import/no-extraneous-dependencies': [ + 'error', + { packageDir: ['.', '../../../../'] }, + ], + }, }, - } + ]; + " `); + expect(tree.read(`${storiesConfig.root}/README.md`, 'utf-8')).toMatchInlineSnapshot(` "# @proj/react-hello-stories diff --git a/tools/workspace-plugin/src/generators/split-library-in-two/generator.ts b/tools/workspace-plugin/src/generators/split-library-in-two/generator.ts index d012b68ac4d65..f1b9f92d1e148 100644 --- a/tools/workspace-plugin/src/generators/split-library-in-two/generator.ts +++ b/tools/workspace-plugin/src/generators/split-library-in-two/generator.ts @@ -324,13 +324,22 @@ function makeStoriesLibrary(tree: Tree, options: Options, logger: CLIOutput) { }, }, publicApi: stripIndents`export {}`, - eslintrc: { - extends: ['plugin:@fluentui/eslint-plugin/react'], - root: true, - rules: { - 'import/no-extraneous-dependencies': ['error', { packageDir: ['.', options.projectOffsetFromRoot.updated] }], - }, + eslintConfig: `// @ts-check + +const fluentPlugin = require('@fluentui/eslint-plugin'); + +module.exports = [ + ...fluentPlugin.configs['flat/react'], + { + rules: { + 'import/no-extraneous-dependencies': [ + 'error', + { packageDir: ['.', '${options.projectOffsetFromRoot.updated}'] }, + ], }, + }, +]; +`, tsconfig: { root: { ...options.oldContent.tsConfig, @@ -361,7 +370,7 @@ function makeStoriesLibrary(tree: Tree, options: Options, logger: CLIOutput) { tree.write(joinPathFragments(newProjectRoot, 'README.md'), templates.readme); tree.write(joinPathFragments(newProjectSourceRoot, 'index.ts'), templates.publicApi); - writeJson(tree, joinPathFragments(newProjectRoot, '.eslintrc.json'), templates.eslintrc); + tree.write(joinPathFragments(newProjectRoot, 'eslint.config.js'), templates.eslintConfig); writeJson(tree, joinPathFragments(newProjectRoot, 'tsconfig.json'), templates.tsconfig.root); writeJson(tree, joinPathFragments(newProjectRoot, 'tsconfig.lib.json'), templates.tsconfig.lib); writeJson(tree, joinPathFragments(newProjectRoot, 'package.json'), templates.packageJson);