Skip to content
Open
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 @@
{

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵🏾‍♀️ visual changes to review in the Visual Change Report

vr-tests-react-components/CalendarCompat 4 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/CalendarCompat.multiDayView - High Contrast.default.chromium.png 1236 Changed
vr-tests-react-components/CalendarCompat.multiDayView - Dark Mode.default.chromium.png 1107 Changed
vr-tests-react-components/CalendarCompat.multiDayView - RTL.default.chromium.png 495 Changed
vr-tests-react-components/CalendarCompat.multiDayView.default.chromium_1.png 492 Changed
vr-tests-react-components/Menu Converged - submenuIndicator slotted content 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Menu Converged - submenuIndicator slotted content.default.submenus open.chromium.png 413 Changed
vr-tests-react-components/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.chromium.png 618 Changed
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 965 Changed
vr-tests-react-components/ProgressBar converged 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness.default.chromium.png 54 Changed
vr-tests-react-components/Skeleton converged 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Skeleton converged.Opaque Skeleton with square - Dark Mode.default.chromium.png 2 Changed
vr-tests-react-components/TagPicker 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/TagPicker.disabled - Dark Mode.chromium.png 658 Changed
vr-tests-web-components/MenuList 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-web-components/MenuList. - RTL.1st selected.chromium_2.png 39384 Changed
vr-tests-web-components/MenuList. - RTL.2nd selected.chromium_3.png 38816 Changed
vr-tests-web-components/MenuList. - RTL.normal.chromium_1.png 39083 Changed
vr-tests-web-components/TextInput 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-web-components/TextInput. - Dark Mode.normal.chromium_1.png 288 Changed
vr-tests/Callout 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests/Callout.Top left edge.default.chromium.png 2212 Changed
vr-tests/Callout.No callout width specified.default.chromium.png 2143 Changed
vr-tests/Callout.Right bottom edge.default.chromium.png 3095 Changed
vr-tests/react-charting-AreaChart 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests/react-charting-AreaChart.Custom Accessibility.default.chromium.png 11 Changed
vr-tests/react-charting-GaugeChart 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests/react-charting-GaugeChart.Basic.default.chromium.png 2 Changed
vr-tests/react-charting-MultiStackBarChart 4 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests/react-charting-MultiStackBarChart.Basic_Absolute - RTL.default.chromium.png 343 Changed
vr-tests/react-charting-MultiStackBarChart.Basic_PartToWhole - RTL.default.chromium.png 343 Changed
vr-tests/react-charting-MultiStackBarChart.Basic_Absolute.default.chromium.png 359 Changed
vr-tests/react-charting-MultiStackBarChart.Basic_PartToWhole - Dark Mode.default.chromium.png 363 Changed
vr-tests/react-charting-SankeyChart 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests/react-charting-SankeyChart.PlaceHolder - Dark Mode.default.chromium.png 78 Changed

There were 5 duplicate changes discarded. Check the build logs for more information.

"type": "patch",
"comment": "fix: support ESM plugin imports",
"packageName": "@fluentui/eslint-plugin-react-components",
"email": "kirtiar15502@gmail.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"decorators": false,
"dynamicImport": false
},
"baseUrl": ".",
"externalHelpers": true,
"transform": {
"react": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,31 @@ export const meta: {
version: string;
};

// @public (undocumented)
const plugin: {
meta: {
name: string;
version: string;
};
configs: {
recommended: {
plugins: string[];
rules: {};
};
'flat/recommended': {
plugins: {
[x: string]: ESLint.Plugin;
};
rules: {};
};
};
rules: {
"enforce-use-client": RuleModule<"missingUseClient" | "unnecessaryUseClient", [(RuleOptions | undefined)?], unknown, RuleListener>;
"prefer-fluentui-v9": RuleModule<"replaceFluent8With9" | "replaceIconWithJsx" | "replaceStackWithFlex" | "replaceFocusZoneWithTabster", {}[], unknown, RuleListener>;
};
};
export default plugin;

// @public (undocumented)
export const rules: {
"enforce-use-client": RuleModule<"missingUseClient" | "unnecessaryUseClient", [(RuleOptions | undefined)?], unknown, RuleListener>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type { ESLint } from 'eslint';

import { name, version } from '../package.json';
import packageJson from '../package.json';
import { RULE_NAME as enforceUseClientName, rule as enforceUseClient } from './rules/enforce-use-client';
import { RULE_NAME as preferFluentUIV9Name, rule as preferFluentUIV9 } from './rules/prefer-fluentui-v9';

const { name, version } = packageJson;

export const meta = {
name,
version,
Expand Down Expand Up @@ -35,10 +37,13 @@ const plugin = {
configs,
rules,
};
export default plugin;

// Flat config for eslint v9
configs['flat/recommended'].plugins = {
[name]: plugin as unknown as ESLint.Plugin,
};

module.exports = plugin;
if (typeof module !== 'undefined') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even with this "hack" we don't ship ESM.

we follow TS Eslint pattern so what needs to be done is to set explicitly type in package.json https://app.unpkg.com/@typescript-eslint/eslint-plugin@8.61.0/files/package.json#L15

module.exports = plugin;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"outDir": "../../../dist/out-tsc",
"inlineSources": true,
"types": ["environment", "node"],
"module": "CommonJS"
"module": "CommonJS",
"allowSyntheticDefaultImports": true
},
"exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx"],
"include": ["./src/**/*.ts", "./src/**/*.tsx"]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "proj"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import packageJson from './package-info.json';

export const packageName = packageJson.name;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"compilerOptions": {
"outDir": "./dist/out-tsc",
"declaration": true,
"types": []
"types": [],
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true
},
"include": ["src/*.ts"],
"exclude": ["src/*.spec.ts"]
Expand Down
24 changes: 17 additions & 7 deletions tools/workspace-plugin/src/executors/build/executor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ describe('Build Executor', () => {
expect(stripIndents`${clearLogs}`).toEqual(stripIndents`
Cleaning outputs:

- ${workspaceRoot}/libs/proj/lib-commonjs
- ${workspaceRoot}/libs/proj/lib
- ${workspaceRoot}/libs/proj/dist/assets/spec.md
- ${join(workspaceRoot, 'libs/proj/lib-commonjs')}
- ${join(workspaceRoot, 'libs/proj/lib')}
- ${join(workspaceRoot, 'libs/proj/dist/assets/spec.md')}
`);

expect(restOfLogs).toEqual([
Expand All @@ -116,22 +116,22 @@ describe('Build Executor', () => {

expect(loggerVerboseSpy.mock.calls.flat()).toEqual([
`Applying transforms: 0`,
`babel: transformed ${workspaceRoot}/libs/proj/lib/greeter.styles.js`,
`babel: transformed ${join(workspaceRoot, 'libs/proj/lib/greeter.styles.js')}`,
`Applying transforms: 0`,
]);

expect(rmMock.mock.calls.flat()).toEqual([
`${workspaceRoot}/libs/proj/lib-commonjs`,
join(workspaceRoot, 'libs/proj/lib-commonjs'),
{
force: true,
recursive: true,
},
`${workspaceRoot}/libs/proj/lib`,
join(workspaceRoot, 'libs/proj/lib'),
{
force: true,
recursive: true,
},
`${workspaceRoot}/libs/proj/dist/assets/spec.md`,
join(workspaceRoot, 'libs/proj/dist/assets/spec.md'),
{
force: true,
recursive: true,
Expand All @@ -154,6 +154,8 @@ describe('Build Executor', () => {
'greeter.styles.js.map',
'index.js',
'index.js.map',
'package-info.js',
'package-info.js.map',
]);
expect(readdirSync(join(workspaceRoot, 'libs/proj/lib-commonjs'))).toEqual([
'greeter.js',
Expand All @@ -162,6 +164,8 @@ describe('Build Executor', () => {
'greeter.styles.js.map',
'index.js',
'index.js.map',
'package-info.js',
'package-info.js.map',
]);

// ====================================
Expand Down Expand Up @@ -231,6 +235,12 @@ describe('Build Executor', () => {
}
"
`);
expect(readFileSync(join(workspaceRoot, 'libs/proj/lib/package-info.js'), 'utf-8')).toContain(
`from './package-info.json' with { type: 'json' };`,
);
expect(readFileSync(join(workspaceRoot, 'libs/proj/lib-commonjs/package-info.js'), 'utf-8')).toContain(
`require("./package-info.json")`,
);

// =====================
// assert griffel AOT
Expand Down
10 changes: 9 additions & 1 deletion tools/workspace-plugin/src/executors/build/lib/swc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,14 @@ export async function compileSwc(
});

// Strip @jsx comments, see https://github.com/microsoft/fluentui/issues/29126
const resultCode = result.code
let resultCode = result.code
.replace('/** @jsxRuntime automatic */', '')
.replace('/** @jsxImportSource @fluentui/react-jsx-runtime */', '');

if (module === 'es6') {
resultCode = addJsonImportAttributes(resultCode);
}

const jsFileName = fileName.replace(tsFileExtensionRegex, '.js');
const compiledFilePath = join(absoluteOutputPath, jsFileName);

Expand Down Expand Up @@ -85,3 +89,7 @@ async function applyTransforms(filePath: string, transforms?: Array<Transform>):
await transform(filePath);
}
}

function addJsonImportAttributes(code: string): string {
return code.replace(/from\s+(['"][^'"]+\.json['"])\s*;/g, "from $1 with { type: 'json' };");
}
Loading