From 79cd2f753bbead10f67e3351e51a489aa99d4a0a Mon Sep 17 00:00:00 2001 From: trevorNgo Date: Wed, 3 Jun 2026 15:39:03 -0700 Subject: [PATCH 1/7] fix esm module and update configs to work in pure esm context --- .../eslint-plugin-react-components/.swcrc | 5 +++- .../etc/eslint-plugin-react-components.api.md | 25 +++++++++++++++++++ .../jest.config.js | 5 ++++ .../src/index.ts | 18 ++++++------- .../src/rules/enforce-use-client.ts | 2 +- .../src/rules/prefer-fluentui-v9.ts | 2 +- .../tsconfig.json | 3 ++- .../tsconfig.lib.json | 3 +-- 8 files changed, 48 insertions(+), 15 deletions(-) diff --git a/packages/react-components/eslint-plugin-react-components/.swcrc b/packages/react-components/eslint-plugin-react-components/.swcrc index b4ffa86dee3067..5ffe7f6a3934c1 100644 --- a/packages/react-components/eslint-plugin-react-components/.swcrc +++ b/packages/react-components/eslint-plugin-react-components/.swcrc @@ -23,7 +23,10 @@ "useSpread": true } }, - "target": "es2019" + "target": "es2019", + "experimental": { + "keepImportAttributes": true + } }, "minify": false, "sourceMaps": true diff --git a/packages/react-components/eslint-plugin-react-components/etc/eslint-plugin-react-components.api.md b/packages/react-components/eslint-plugin-react-components/etc/eslint-plugin-react-components.api.md index bc570c9853879c..fc126bf17d3038 100644 --- a/packages/react-components/eslint-plugin-react-components/etc/eslint-plugin-react-components.api.md +++ b/packages/react-components/eslint-plugin-react-components/etc/eslint-plugin-react-components.api.md @@ -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>; diff --git a/packages/react-components/eslint-plugin-react-components/jest.config.js b/packages/react-components/eslint-plugin-react-components/jest.config.js index 8be15f3fdcc6e3..b88c5190ea0ecc 100644 --- a/packages/react-components/eslint-plugin-react-components/jest.config.js +++ b/packages/react-components/eslint-plugin-react-components/jest.config.js @@ -18,8 +18,10 @@ if (swcJestConfig.swcrc === undefined) { // jest needs EsModule Interop to find the default exported setup/teardown functions // swcJestConfig.module.noInterop = false; + /** * @type {import('@jest/types').Config.InitialOptions} + * moduleNameMapper '^(\\.{1,2}/.*)\\.js$': '$1', strip `.js` extension from imports */ module.exports = { displayName: 'eslint-plugin-react-components', @@ -27,6 +29,9 @@ module.exports = { transform: { '^.+\\.tsx?$': ['@swc/jest', swcJestConfig], }, + moduleNameMapper: { + '^(\\.{1,2}/.*)\\.js$': '$1', + }, coverageDirectory: './coverage', setupFilesAfterEnv: ['./config/tests.js'], testEnvironment: 'node', diff --git a/packages/react-components/eslint-plugin-react-components/src/index.ts b/packages/react-components/eslint-plugin-react-components/src/index.ts index b3884c69a70d65..3c173c9abbfa2e 100644 --- a/packages/react-components/eslint-plugin-react-components/src/index.ts +++ b/packages/react-components/eslint-plugin-react-components/src/index.ts @@ -1,12 +1,12 @@ import type { ESLint } from 'eslint'; -import { name, version } 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'; +import pkgJson from '../package.json' with { type: 'json' }; +import { RULE_NAME as enforceUseClientName, rule as enforceUseClient } from './rules/enforce-use-client.js'; +import { RULE_NAME as preferFluentUIV9Name, rule as preferFluentUIV9 } from './rules/prefer-fluentui-v9.js'; export const meta = { - name, - version, + name: pkgJson.name, + version: pkgJson.version, }; export const rules = { [enforceUseClientName]: enforceUseClient, @@ -19,13 +19,13 @@ const recommendedRules = { export const configs = { recommended: { - plugins: [name], + plugins: [pkgJson.name], rules: recommendedRules, }, 'flat/recommended': { // Define plugins as an object to satisfy ESLint v9 flat config format // the actual plugin will be assigned later to avoid circular dependencies - plugins: { [name]: {} as ESLint.Plugin }, + plugins: { [pkgJson.name]: {} as ESLint.Plugin }, rules: recommendedRules, }, }; @@ -38,7 +38,7 @@ const plugin = { // Flat config for eslint v9 configs['flat/recommended'].plugins = { - [name]: plugin as unknown as ESLint.Plugin, + [pkgJson.name]: plugin as unknown as ESLint.Plugin, }; -module.exports = plugin; +export default plugin; diff --git a/packages/react-components/eslint-plugin-react-components/src/rules/enforce-use-client.ts b/packages/react-components/eslint-plugin-react-components/src/rules/enforce-use-client.ts index 41e6a419c4db89..21aeccfc306daf 100644 --- a/packages/react-components/eslint-plugin-react-components/src/rules/enforce-use-client.ts +++ b/packages/react-components/eslint-plugin-react-components/src/rules/enforce-use-client.ts @@ -1,6 +1,6 @@ import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils'; -import { createRule } from './utils/create-rule'; +import { createRule } from './utils/create-rule.js'; // NOTE: The rule will be available in ESLint configs as "@fluentui/react-components/enforce-use-client" export const RULE_NAME = 'enforce-use-client'; diff --git a/packages/react-components/eslint-plugin-react-components/src/rules/prefer-fluentui-v9.ts b/packages/react-components/eslint-plugin-react-components/src/rules/prefer-fluentui-v9.ts index 43284a6bf3beba..ccb3966acb3385 100644 --- a/packages/react-components/eslint-plugin-react-components/src/rules/prefer-fluentui-v9.ts +++ b/packages/react-components/eslint-plugin-react-components/src/rules/prefer-fluentui-v9.ts @@ -1,6 +1,6 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import { createRule } from './utils/create-rule'; +import { createRule } from './utils/create-rule.js'; export const RULE_NAME = 'prefer-fluentui-v9'; diff --git a/packages/react-components/eslint-plugin-react-components/tsconfig.json b/packages/react-components/eslint-plugin-react-components/tsconfig.json index 9060365d2c51de..a72e17bebd920f 100644 --- a/packages/react-components/eslint-plugin-react-components/tsconfig.json +++ b/packages/react-components/eslint-plugin-react-components/tsconfig.json @@ -8,7 +8,8 @@ "jsx": "react", "noUnusedLocals": true, "preserveConstEnums": true, - "resolveJsonModule": true + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true }, "include": [], "files": [], diff --git a/packages/react-components/eslint-plugin-react-components/tsconfig.lib.json b/packages/react-components/eslint-plugin-react-components/tsconfig.lib.json index 3bf0a059bc2c14..96c7fda5a86706 100644 --- a/packages/react-components/eslint-plugin-react-components/tsconfig.lib.json +++ b/packages/react-components/eslint-plugin-react-components/tsconfig.lib.json @@ -7,8 +7,7 @@ "declarationDir": "../../../dist/out-tsc/types", "outDir": "../../../dist/out-tsc", "inlineSources": true, - "types": ["environment", "node"], - "module": "CommonJS" + "types": ["environment", "node"] }, "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx"], "include": ["./src/**/*.ts", "./src/**/*.tsx"] From f7231ac75a392483e2b89596037fa4d241a104c0 Mon Sep 17 00:00:00 2001 From: trevorNgo Date: Wed, 3 Jun 2026 18:39:48 -0700 Subject: [PATCH 2/7] add change file --- ...ct-components-82f2a413-7baa-4a64-9f9c-ed3a43136d25.json | 7 +++++++ .../eslint-plugin-react-components/jest.config.js | 4 +++- .../eslint-plugin-react-components/src/index.ts | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 change/@fluentui-eslint-plugin-react-components-82f2a413-7baa-4a64-9f9c-ed3a43136d25.json diff --git a/change/@fluentui-eslint-plugin-react-components-82f2a413-7baa-4a64-9f9c-ed3a43136d25.json b/change/@fluentui-eslint-plugin-react-components-82f2a413-7baa-4a64-9f9c-ed3a43136d25.json new file mode 100644 index 00000000000000..a803917b4671eb --- /dev/null +++ b/change/@fluentui-eslint-plugin-react-components-82f2a413-7baa-4a64-9f9c-ed3a43136d25.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "Fixing ESM build output, since\u0017 it fails in pure ESM mode.", + "packageName": "@fluentui/eslint-plugin-react-components", + "email": "ngo.trev.95@gmail.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-components/eslint-plugin-react-components/jest.config.js b/packages/react-components/eslint-plugin-react-components/jest.config.js index b88c5190ea0ecc..1e7637a477b5d8 100644 --- a/packages/react-components/eslint-plugin-react-components/jest.config.js +++ b/packages/react-components/eslint-plugin-react-components/jest.config.js @@ -17,11 +17,13 @@ if (swcJestConfig.swcrc === undefined) { // https://nx.dev/packages/jest/documents/overview#global-setup/teardown-with-nx-libraries // jest needs EsModule Interop to find the default exported setup/teardown functions // swcJestConfig.module.noInterop = false; +// Jest is not resolving properly with the .js extension in the imports of the test files, +// we need to strip the .js extension in the imports for Jest to resolve them correctly +// moduleNameMapper '^(\\.{1,2}/.*)\\.js$': '$1' /** * @type {import('@jest/types').Config.InitialOptions} - * moduleNameMapper '^(\\.{1,2}/.*)\\.js$': '$1', strip `.js` extension from imports */ module.exports = { displayName: 'eslint-plugin-react-components', diff --git a/packages/react-components/eslint-plugin-react-components/src/index.ts b/packages/react-components/eslint-plugin-react-components/src/index.ts index 3c173c9abbfa2e..402acf06a0dd48 100644 --- a/packages/react-components/eslint-plugin-react-components/src/index.ts +++ b/packages/react-components/eslint-plugin-react-components/src/index.ts @@ -1,5 +1,5 @@ import type { ESLint } from 'eslint'; - +// import with attribute for esm support, see https://nodejs.org/api/esm.html#json-modules import pkgJson from '../package.json' with { type: 'json' }; import { RULE_NAME as enforceUseClientName, rule as enforceUseClient } from './rules/enforce-use-client.js'; import { RULE_NAME as preferFluentUIV9Name, rule as preferFluentUIV9 } from './rules/prefer-fluentui-v9.js'; From 51b556a146cfbd522e41c0c91f2e91b5312fd188 Mon Sep 17 00:00:00 2001 From: trevorNgo Date: Tue, 9 Jun 2026 07:41:00 -0700 Subject: [PATCH 3/7] run format and add prettier ignore file --- .prettierignore | 3 +++ .../eslint-plugin-react-components/jest.config.js | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.prettierignore b/.prettierignore index 6aecefc0421cd7..3238258d989c72 100644 --- a/.prettierignore +++ b/.prettierignore @@ -40,3 +40,6 @@ CODEOWNERS /.nx/cache /.nx/workspace-data + +# todo: Remove when prettier@^3.1; "prettier": "2.8.8" does not support `with` import attr +packages/react-components/eslint-plugin-react-components/src/index.ts diff --git a/packages/react-components/eslint-plugin-react-components/jest.config.js b/packages/react-components/eslint-plugin-react-components/jest.config.js index 1e7637a477b5d8..e0e9464d78446c 100644 --- a/packages/react-components/eslint-plugin-react-components/jest.config.js +++ b/packages/react-components/eslint-plugin-react-components/jest.config.js @@ -21,7 +21,6 @@ if (swcJestConfig.swcrc === undefined) { // we need to strip the .js extension in the imports for Jest to resolve them correctly // moduleNameMapper '^(\\.{1,2}/.*)\\.js$': '$1' - /** * @type {import('@jest/types').Config.InitialOptions} */ From 190b09f9e3083a8ac467e46fbdfefee31746658a Mon Sep 17 00:00:00 2001 From: trevorNgo Date: Tue, 9 Jun 2026 08:18:12 -0700 Subject: [PATCH 4/7] Revert "run format and add prettier ignore file" This reverts commit 51b556a146cfbd522e41c0c91f2e91b5312fd188. --- .prettierignore | 3 --- .../eslint-plugin-react-components/jest.config.js | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.prettierignore b/.prettierignore index 3238258d989c72..6aecefc0421cd7 100644 --- a/.prettierignore +++ b/.prettierignore @@ -40,6 +40,3 @@ CODEOWNERS /.nx/cache /.nx/workspace-data - -# todo: Remove when prettier@^3.1; "prettier": "2.8.8" does not support `with` import attr -packages/react-components/eslint-plugin-react-components/src/index.ts diff --git a/packages/react-components/eslint-plugin-react-components/jest.config.js b/packages/react-components/eslint-plugin-react-components/jest.config.js index e0e9464d78446c..1e7637a477b5d8 100644 --- a/packages/react-components/eslint-plugin-react-components/jest.config.js +++ b/packages/react-components/eslint-plugin-react-components/jest.config.js @@ -21,6 +21,7 @@ if (swcJestConfig.swcrc === undefined) { // we need to strip the .js extension in the imports for Jest to resolve them correctly // moduleNameMapper '^(\\.{1,2}/.*)\\.js$': '$1' + /** * @type {import('@jest/types').Config.InitialOptions} */ From 120646bb4db605dc1651fd8a7d4cf94d5a20b6d5 Mon Sep 17 00:00:00 2001 From: trevorNgo Date: Tue, 9 Jun 2026 08:24:31 -0700 Subject: [PATCH 5/7] Revert "add change file" This reverts commit f7231ac75a392483e2b89596037fa4d241a104c0. --- ...ct-components-82f2a413-7baa-4a64-9f9c-ed3a43136d25.json | 7 ------- .../eslint-plugin-react-components/jest.config.js | 4 +--- .../eslint-plugin-react-components/src/index.ts | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) delete mode 100644 change/@fluentui-eslint-plugin-react-components-82f2a413-7baa-4a64-9f9c-ed3a43136d25.json diff --git a/change/@fluentui-eslint-plugin-react-components-82f2a413-7baa-4a64-9f9c-ed3a43136d25.json b/change/@fluentui-eslint-plugin-react-components-82f2a413-7baa-4a64-9f9c-ed3a43136d25.json deleted file mode 100644 index a803917b4671eb..00000000000000 --- a/change/@fluentui-eslint-plugin-react-components-82f2a413-7baa-4a64-9f9c-ed3a43136d25.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "minor", - "comment": "Fixing ESM build output, since\u0017 it fails in pure ESM mode.", - "packageName": "@fluentui/eslint-plugin-react-components", - "email": "ngo.trev.95@gmail.com", - "dependentChangeType": "patch" -} diff --git a/packages/react-components/eslint-plugin-react-components/jest.config.js b/packages/react-components/eslint-plugin-react-components/jest.config.js index 1e7637a477b5d8..b88c5190ea0ecc 100644 --- a/packages/react-components/eslint-plugin-react-components/jest.config.js +++ b/packages/react-components/eslint-plugin-react-components/jest.config.js @@ -17,13 +17,11 @@ if (swcJestConfig.swcrc === undefined) { // https://nx.dev/packages/jest/documents/overview#global-setup/teardown-with-nx-libraries // jest needs EsModule Interop to find the default exported setup/teardown functions // swcJestConfig.module.noInterop = false; -// Jest is not resolving properly with the .js extension in the imports of the test files, -// we need to strip the .js extension in the imports for Jest to resolve them correctly -// moduleNameMapper '^(\\.{1,2}/.*)\\.js$': '$1' /** * @type {import('@jest/types').Config.InitialOptions} + * moduleNameMapper '^(\\.{1,2}/.*)\\.js$': '$1', strip `.js` extension from imports */ module.exports = { displayName: 'eslint-plugin-react-components', diff --git a/packages/react-components/eslint-plugin-react-components/src/index.ts b/packages/react-components/eslint-plugin-react-components/src/index.ts index 402acf06a0dd48..3c173c9abbfa2e 100644 --- a/packages/react-components/eslint-plugin-react-components/src/index.ts +++ b/packages/react-components/eslint-plugin-react-components/src/index.ts @@ -1,5 +1,5 @@ import type { ESLint } from 'eslint'; -// import with attribute for esm support, see https://nodejs.org/api/esm.html#json-modules + import pkgJson from '../package.json' with { type: 'json' }; import { RULE_NAME as enforceUseClientName, rule as enforceUseClient } from './rules/enforce-use-client.js'; import { RULE_NAME as preferFluentUIV9Name, rule as preferFluentUIV9 } from './rules/prefer-fluentui-v9.js'; From b5239a343813050e3980b27ff2220c130faec47e Mon Sep 17 00:00:00 2001 From: trevorNgo Date: Tue, 9 Jun 2026 08:24:41 -0700 Subject: [PATCH 6/7] Revert "fix esm module and update configs to work in pure esm context" This reverts commit 79cd2f753bbead10f67e3351e51a489aa99d4a0a. --- .../eslint-plugin-react-components/.swcrc | 5 +--- .../etc/eslint-plugin-react-components.api.md | 25 ------------------- .../jest.config.js | 5 ---- .../src/index.ts | 18 ++++++------- .../src/rules/enforce-use-client.ts | 2 +- .../src/rules/prefer-fluentui-v9.ts | 2 +- .../tsconfig.json | 3 +-- .../tsconfig.lib.json | 3 ++- 8 files changed, 15 insertions(+), 48 deletions(-) diff --git a/packages/react-components/eslint-plugin-react-components/.swcrc b/packages/react-components/eslint-plugin-react-components/.swcrc index 5ffe7f6a3934c1..b4ffa86dee3067 100644 --- a/packages/react-components/eslint-plugin-react-components/.swcrc +++ b/packages/react-components/eslint-plugin-react-components/.swcrc @@ -23,10 +23,7 @@ "useSpread": true } }, - "target": "es2019", - "experimental": { - "keepImportAttributes": true - } + "target": "es2019" }, "minify": false, "sourceMaps": true diff --git a/packages/react-components/eslint-plugin-react-components/etc/eslint-plugin-react-components.api.md b/packages/react-components/eslint-plugin-react-components/etc/eslint-plugin-react-components.api.md index fc126bf17d3038..bc570c9853879c 100644 --- a/packages/react-components/eslint-plugin-react-components/etc/eslint-plugin-react-components.api.md +++ b/packages/react-components/eslint-plugin-react-components/etc/eslint-plugin-react-components.api.md @@ -28,31 +28,6 @@ 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>; diff --git a/packages/react-components/eslint-plugin-react-components/jest.config.js b/packages/react-components/eslint-plugin-react-components/jest.config.js index b88c5190ea0ecc..8be15f3fdcc6e3 100644 --- a/packages/react-components/eslint-plugin-react-components/jest.config.js +++ b/packages/react-components/eslint-plugin-react-components/jest.config.js @@ -18,10 +18,8 @@ if (swcJestConfig.swcrc === undefined) { // jest needs EsModule Interop to find the default exported setup/teardown functions // swcJestConfig.module.noInterop = false; - /** * @type {import('@jest/types').Config.InitialOptions} - * moduleNameMapper '^(\\.{1,2}/.*)\\.js$': '$1', strip `.js` extension from imports */ module.exports = { displayName: 'eslint-plugin-react-components', @@ -29,9 +27,6 @@ module.exports = { transform: { '^.+\\.tsx?$': ['@swc/jest', swcJestConfig], }, - moduleNameMapper: { - '^(\\.{1,2}/.*)\\.js$': '$1', - }, coverageDirectory: './coverage', setupFilesAfterEnv: ['./config/tests.js'], testEnvironment: 'node', diff --git a/packages/react-components/eslint-plugin-react-components/src/index.ts b/packages/react-components/eslint-plugin-react-components/src/index.ts index 3c173c9abbfa2e..b3884c69a70d65 100644 --- a/packages/react-components/eslint-plugin-react-components/src/index.ts +++ b/packages/react-components/eslint-plugin-react-components/src/index.ts @@ -1,12 +1,12 @@ import type { ESLint } from 'eslint'; -import pkgJson from '../package.json' with { type: 'json' }; -import { RULE_NAME as enforceUseClientName, rule as enforceUseClient } from './rules/enforce-use-client.js'; -import { RULE_NAME as preferFluentUIV9Name, rule as preferFluentUIV9 } from './rules/prefer-fluentui-v9.js'; +import { name, version } 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'; export const meta = { - name: pkgJson.name, - version: pkgJson.version, + name, + version, }; export const rules = { [enforceUseClientName]: enforceUseClient, @@ -19,13 +19,13 @@ const recommendedRules = { export const configs = { recommended: { - plugins: [pkgJson.name], + plugins: [name], rules: recommendedRules, }, 'flat/recommended': { // Define plugins as an object to satisfy ESLint v9 flat config format // the actual plugin will be assigned later to avoid circular dependencies - plugins: { [pkgJson.name]: {} as ESLint.Plugin }, + plugins: { [name]: {} as ESLint.Plugin }, rules: recommendedRules, }, }; @@ -38,7 +38,7 @@ const plugin = { // Flat config for eslint v9 configs['flat/recommended'].plugins = { - [pkgJson.name]: plugin as unknown as ESLint.Plugin, + [name]: plugin as unknown as ESLint.Plugin, }; -export default plugin; +module.exports = plugin; diff --git a/packages/react-components/eslint-plugin-react-components/src/rules/enforce-use-client.ts b/packages/react-components/eslint-plugin-react-components/src/rules/enforce-use-client.ts index 21aeccfc306daf..41e6a419c4db89 100644 --- a/packages/react-components/eslint-plugin-react-components/src/rules/enforce-use-client.ts +++ b/packages/react-components/eslint-plugin-react-components/src/rules/enforce-use-client.ts @@ -1,6 +1,6 @@ import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils'; -import { createRule } from './utils/create-rule.js'; +import { createRule } from './utils/create-rule'; // NOTE: The rule will be available in ESLint configs as "@fluentui/react-components/enforce-use-client" export const RULE_NAME = 'enforce-use-client'; diff --git a/packages/react-components/eslint-plugin-react-components/src/rules/prefer-fluentui-v9.ts b/packages/react-components/eslint-plugin-react-components/src/rules/prefer-fluentui-v9.ts index ccb3966acb3385..43284a6bf3beba 100644 --- a/packages/react-components/eslint-plugin-react-components/src/rules/prefer-fluentui-v9.ts +++ b/packages/react-components/eslint-plugin-react-components/src/rules/prefer-fluentui-v9.ts @@ -1,6 +1,6 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import { createRule } from './utils/create-rule.js'; +import { createRule } from './utils/create-rule'; export const RULE_NAME = 'prefer-fluentui-v9'; diff --git a/packages/react-components/eslint-plugin-react-components/tsconfig.json b/packages/react-components/eslint-plugin-react-components/tsconfig.json index a72e17bebd920f..9060365d2c51de 100644 --- a/packages/react-components/eslint-plugin-react-components/tsconfig.json +++ b/packages/react-components/eslint-plugin-react-components/tsconfig.json @@ -8,8 +8,7 @@ "jsx": "react", "noUnusedLocals": true, "preserveConstEnums": true, - "resolveJsonModule": true, - "allowSyntheticDefaultImports": true + "resolveJsonModule": true }, "include": [], "files": [], diff --git a/packages/react-components/eslint-plugin-react-components/tsconfig.lib.json b/packages/react-components/eslint-plugin-react-components/tsconfig.lib.json index 96c7fda5a86706..3bf0a059bc2c14 100644 --- a/packages/react-components/eslint-plugin-react-components/tsconfig.lib.json +++ b/packages/react-components/eslint-plugin-react-components/tsconfig.lib.json @@ -7,7 +7,8 @@ "declarationDir": "../../../dist/out-tsc/types", "outDir": "../../../dist/out-tsc", "inlineSources": true, - "types": ["environment", "node"] + "types": ["environment", "node"], + "module": "CommonJS" }, "exclude": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.test.ts", "**/*.test.tsx"], "include": ["./src/**/*.ts", "./src/**/*.tsx"] From 6c4250e937df29ef799b8d520b4b0bff80fa13e5 Mon Sep 17 00:00:00 2001 From: trevorNgo Date: Tue, 9 Jun 2026 08:27:56 -0700 Subject: [PATCH 7/7] update package json to no longer advertise entrypoint to broken esm build, following decision to only support commonjs mode --- ...ct-components-ebf76256-6575-4b9a-8421-7e5313769a7a.json | 7 +++++++ .../eslint-plugin-react-components/package.json | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 change/@fluentui-eslint-plugin-react-components-ebf76256-6575-4b9a-8421-7e5313769a7a.json diff --git a/change/@fluentui-eslint-plugin-react-components-ebf76256-6575-4b9a-8421-7e5313769a7a.json b/change/@fluentui-eslint-plugin-react-components-ebf76256-6575-4b9a-8421-7e5313769a7a.json new file mode 100644 index 00000000000000..6a0f13945a36a7 --- /dev/null +++ b/change/@fluentui-eslint-plugin-react-components-ebf76256-6575-4b9a-8421-7e5313769a7a.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "Remove the ESM entrypoint in eslint-plugin package.json and change module type to commonjs.", + "packageName": "@fluentui/eslint-plugin-react-components", + "email": "ngo.trev.95@gmail.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-components/eslint-plugin-react-components/package.json b/packages/react-components/eslint-plugin-react-components/package.json index 17b21c6d3819c1..f061d3e9c36257 100644 --- a/packages/react-components/eslint-plugin-react-components/package.json +++ b/packages/react-components/eslint-plugin-react-components/package.json @@ -3,7 +3,7 @@ "version": "0.2.1", "description": "ESLint plugin and custom rules for Fluent UI components v9", "main": "./lib-commonjs/index.js", - "module": "./lib/index.js", + "type": "commonjs", "typings": "./dist/index.d.ts", "repository": { "type": "git", @@ -25,8 +25,8 @@ "exports": { ".": { "types": "./dist/index.d.ts", - "import": "./lib/index.js", - "require": "./lib-commonjs/index.js" + "require": "./lib-commonjs/index.js", + "default": "./lib-commonjs/index.js" }, "./package.json": "./package.json" },