diff --git a/apps/pr-deploy-site/.eslintrc.json b/apps/pr-deploy-site/.eslintrc.json deleted file mode 100644 index 75b0d9e79f26dc..00000000000000 --- a/apps/pr-deploy-site/.eslintrc.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": ["plugin:@fluentui/eslint-plugin/node"], - "root": true, - "overrides": [ - { - // pr-deploy-site.js is run without transpiling in all browsers, which means it must use - // IE 11-compatible syntax as long as we still support IE 11. - "files": ["pr-deploy-site.js"], - "plugins": ["es"], - "extends": ["plugin:es/restrict-to-es2015", "plugin:@microsoft/eslint-plugin-sdl/required"], - "rules": { - // turn off conflicting or unwanted rules from normal set - "curly": "off", - "no-var": "off", - "vars-on-top": "off", - "prefer-arrow-callback": "off", - "no-restricted-globals": "off" - } - } - ] -} diff --git a/apps/pr-deploy-site/eslint.config.js b/apps/pr-deploy-site/eslint.config.js new file mode 100644 index 00000000000000..b5f3fe55818431 --- /dev/null +++ b/apps/pr-deploy-site/eslint.config.js @@ -0,0 +1,29 @@ +const js = require('@eslint/js'); +const sdl = require('@microsoft/eslint-plugin-sdl'); +const es = require('eslint-plugin-es'); +const { FlatCompat } = require('@eslint/eslintrc'); + +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, +}); + +module.exports = [ + ...compat.extends('plugin:@fluentui/eslint-plugin/node'), + ...sdl.configs.recommended, + { + files: ['**/pr-deploy-site.js'], + plugins: { + es, + }, + + rules: { + curly: 'off', + 'no-var': 'off', + 'vars-on-top': 'off', + 'prefer-arrow-callback': 'off', + 'no-restricted-globals': 'off', + }, + }, +]; diff --git a/apps/pr-deploy-site/package.json b/apps/pr-deploy-site/package.json index a0f42e46d06d64..d694f119735d55 100644 --- a/apps/pr-deploy-site/package.json +++ b/apps/pr-deploy-site/package.json @@ -7,7 +7,7 @@ "scripts": { "clean": "just-scripts clean", "generate:site": "just-scripts generate:site", - "lint": "eslint --ext .js,.ts --cache .", + "lint": "eslint --cache .", "type-check": "tsc -p . --noEmit" }, "license": "MIT", diff --git a/apps/public-docsite-resources/package.json b/apps/public-docsite-resources/package.json index ffc2bf404467e5..6c9919b056caa3 100644 --- a/apps/public-docsite-resources/package.json +++ b/apps/public-docsite-resources/package.json @@ -20,7 +20,7 @@ "build": "just-scripts build", "prebundle": "yarn build", "bundle": "just-scripts bundle", - "lint": "eslint --ext .js,.ts,.tsx ./src", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx ./src", "just": "just-scripts", "clean": "just-scripts clean", "code-style": "just-scripts code-style", diff --git a/apps/public-docsite-v9/src/Concepts/Positioning/PositioningAutoSize.stories.tsx b/apps/public-docsite-v9/src/Concepts/Positioning/PositioningAutoSize.stories.tsx index cfb1dfb54304fe..76c506b425a971 100644 --- a/apps/public-docsite-v9/src/Concepts/Positioning/PositioningAutoSize.stories.tsx +++ b/apps/public-docsite-v9/src/Concepts/Positioning/PositioningAutoSize.stories.tsx @@ -68,7 +68,7 @@ export const AutoSizeForSmallViewport = () => { {Array.from({ length: menuItemCount }, (_, i) => ( - Item {i} + Item {i} ))} diff --git a/apps/public-docsite-v9/src/Concepts/Positioning/PositioningShiftToCoverTarget.stories.tsx b/apps/public-docsite-v9/src/Concepts/Positioning/PositioningShiftToCoverTarget.stories.tsx index b6dfb48cadfc0b..4ce61533f73e40 100644 --- a/apps/public-docsite-v9/src/Concepts/Positioning/PositioningShiftToCoverTarget.stories.tsx +++ b/apps/public-docsite-v9/src/Concepts/Positioning/PositioningShiftToCoverTarget.stories.tsx @@ -112,7 +112,7 @@ export const CoverTargetForSmallViewport = () => { {Array.from({ length: menuItemCount }, (_, i) => ( - Item {i} + Item {i} ))} diff --git a/apps/public-docsite/src/pages/Styles/FabricIconsPage/FabricIconsPage.tsx b/apps/public-docsite/src/pages/Styles/FabricIconsPage/FabricIconsPage.tsx index 8ce1e823b4a0d9..7d8c3225e569f0 100644 --- a/apps/public-docsite/src/pages/Styles/FabricIconsPage/FabricIconsPage.tsx +++ b/apps/public-docsite/src/pages/Styles/FabricIconsPage/FabricIconsPage.tsx @@ -26,6 +26,7 @@ export const FabricIconsPage: React.FunctionComponent = props }; function _otherSections(platform: Platforms): IPageSectionProps[] { + // eslint-disable-next-line react-hooks/rules-of-hooks const [selectedItem, setSelectedItem] = React.useState('react-font'); switch (platform) { case 'web': diff --git a/apps/react-18-tests-v8/package.json b/apps/react-18-tests-v8/package.json index 6f7f7c57eab3da..587c48d6a65a48 100644 --- a/apps/react-18-tests-v8/package.json +++ b/apps/react-18-tests-v8/package.json @@ -9,7 +9,7 @@ "format:check": "yarn format -c", "e2e": "cypress run --component", "e2e:local": "cypress open --component", - "lint": "eslint --ext .js,.ts,.tsx ./src", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx ./src", "test": "jest --passWithNoTests", "start": "webpack-dev-server --mode=development" }, diff --git a/apps/react-18-tests-v9/package.json b/apps/react-18-tests-v9/package.json index 383be2a7745503..28d02b414e5473 100644 --- a/apps/react-18-tests-v9/package.json +++ b/apps/react-18-tests-v9/package.json @@ -5,7 +5,7 @@ "private": true, "scripts": { "type-check": "just-scripts type-check", - "lint": "eslint --ext .js,.ts,.tsx ./src", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx ./src", "test": "jest --passWithNoTests", "format": "prettier -w . --ignore-path ../.prettierignore", "format:check": "yarn format -c", diff --git a/apps/vr-tests-web-components/package.json b/apps/vr-tests-web-components/package.json index 23a2539a9c8744..5ffaafd573bcdd 100644 --- a/apps/vr-tests-web-components/package.json +++ b/apps/vr-tests-web-components/package.json @@ -7,7 +7,7 @@ "scripts": { "build-storybook": "storybook build -o dist/storybook", "format": "prettier . -w --ignore-path ../../.prettierignore", - "lint": "eslint src --ext .ts,.tsx", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint src --ext .ts,.tsx", "start": "storybook dev", "type-check": "tsc -p . --baseUrl . --noEmit", "test-vr": "storywright --browsers chromium --url dist/storybook --destpath dist/screenshots --waitTimeScreenshot 500 --concurrency 4 --headless true" diff --git a/change/@fluentui-chart-web-components-81d570f8-8583-4135-bfbe-9dfe7f1a4283.json b/change/@fluentui-chart-web-components-81d570f8-8583-4135-bfbe-9dfe7f1a4283.json new file mode 100644 index 00000000000000..807dd1e027e909 --- /dev/null +++ b/change/@fluentui-chart-web-components-81d570f8-8583-4135-bfbe-9dfe7f1a4283.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: add ESLINT_USE_FLAT_CONFIG env variable", + "packageName": "@fluentui/chart-web-components", + "email": "vgenaev@gmail.com", + "dependentChangeType": "none" +} diff --git a/change/@fluentui-cra-template-2cac1a83-c032-470a-bbf3-d03598da449f.json b/change/@fluentui-cra-template-2cac1a83-c032-470a-bbf3-d03598da449f.json new file mode 100644 index 00000000000000..9c37e2172a5407 --- /dev/null +++ b/change/@fluentui-cra-template-2cac1a83-c032-470a-bbf3-d03598da449f.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: add ESLINT_USE_FLAT_CONFIG env variable", + "packageName": "@fluentui/cra-template", + "email": "vgenaev@gmail.com", + "dependentChangeType": "none" +} diff --git a/change/@fluentui-eslint-plugin-57088d0d-b50a-4eb6-aa29-cb2df3307e7c.json b/change/@fluentui-eslint-plugin-57088d0d-b50a-4eb6-aa29-cb2df3307e7c.json new file mode 100644 index 00000000000000..6a3bcdcc4452f1 --- /dev/null +++ b/change/@fluentui-eslint-plugin-57088d0d-b50a-4eb6-aa29-cb2df3307e7c.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: add ESLINT_USE_FLAT_CONFIG env variable", + "packageName": "@fluentui/eslint-plugin", + "email": "vgenaev@gmail.com", + "dependentChangeType": "none" +} diff --git a/change/@fluentui-eslint-plugin-react-components-3d65680a-3813-42f6-8a15-30eb35934667.json b/change/@fluentui-eslint-plugin-react-components-3d65680a-3813-42f6-8a15-30eb35934667.json new file mode 100644 index 00000000000000..be8d740ba89e60 --- /dev/null +++ b/change/@fluentui-eslint-plugin-react-components-3d65680a-3813-42f6-8a15-30eb35934667.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: add ESLINT_USE_FLAT_CONFIG env variable", + "packageName": "@fluentui/eslint-plugin-react-components", + "email": "vgenaev@gmail.com", + "dependentChangeType": "none" +} diff --git a/change/@fluentui-public-docsite-setup-0bd59889-cbe1-4d6e-9dae-0cab4c94d26d.json b/change/@fluentui-public-docsite-setup-0bd59889-cbe1-4d6e-9dae-0cab4c94d26d.json new file mode 100644 index 00000000000000..47c2fb3240c132 --- /dev/null +++ b/change/@fluentui-public-docsite-setup-0bd59889-cbe1-4d6e-9dae-0cab4c94d26d.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: add ESLINT_USE_FLAT_CONFIG env variable", + "packageName": "@fluentui/public-docsite-setup", + "email": "vgenaev@gmail.com", + "dependentChangeType": "none" +} diff --git a/change/@fluentui-react-7ec173f5-1468-4477-823c-359cf0b9aa92.json b/change/@fluentui-react-7ec173f5-1468-4477-823c-359cf0b9aa92.json new file mode 100644 index 00000000000000..c8b544caa5d27e --- /dev/null +++ b/change/@fluentui-react-7ec173f5-1468-4477-823c-359cf0b9aa92.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: add ESLINT_USE_FLAT_CONFIG env variable", + "packageName": "@fluentui/react", + "email": "vgenaev@gmail.com", + "dependentChangeType": "none" +} diff --git a/change/@fluentui-react-calendar-compat-ccf2a24a-179b-4136-a83f-f1f21e8fc724.json b/change/@fluentui-react-calendar-compat-ccf2a24a-179b-4136-a83f-f1f21e8fc724.json new file mode 100644 index 00000000000000..acbb2751069f14 --- /dev/null +++ b/change/@fluentui-react-calendar-compat-ccf2a24a-179b-4136-a83f-f1f21e8fc724.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: add ESLINT_USE_FLAT_CONFIG env variable", + "packageName": "@fluentui/react-calendar-compat", + "email": "vgenaev@gmail.com", + "dependentChangeType": "none" +} diff --git a/change/@fluentui-react-experiments-7f00af0a-2557-4239-8221-34b219eac7ce.json b/change/@fluentui-react-experiments-7f00af0a-2557-4239-8221-34b219eac7ce.json new file mode 100644 index 00000000000000..f43e119d56ec7f --- /dev/null +++ b/change/@fluentui-react-experiments-7f00af0a-2557-4239-8221-34b219eac7ce.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: add ESLINT_USE_FLAT_CONFIG env variable", + "packageName": "@fluentui/react-experiments", + "email": "vgenaev@gmail.com", + "dependentChangeType": "none" +} diff --git a/change/@fluentui-react-monaco-editor-7469351c-5d8d-4b36-8743-552ecd8680c0.json b/change/@fluentui-react-monaco-editor-7469351c-5d8d-4b36-8743-552ecd8680c0.json new file mode 100644 index 00000000000000..2cb2f1125aac4c --- /dev/null +++ b/change/@fluentui-react-monaco-editor-7469351c-5d8d-4b36-8743-552ecd8680c0.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: add ESLINT_USE_FLAT_CONFIG env variable", + "packageName": "@fluentui/react-monaco-editor", + "email": "vgenaev@gmail.com", + "dependentChangeType": "none" +} diff --git a/change/@fluentui-react-motion-0dad750c-4aae-452c-b5c4-6ba73bb8a00f.json b/change/@fluentui-react-motion-0dad750c-4aae-452c-b5c4-6ba73bb8a00f.json new file mode 100644 index 00000000000000..7fdb7749508986 --- /dev/null +++ b/change/@fluentui-react-motion-0dad750c-4aae-452c-b5c4-6ba73bb8a00f.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: add ESLINT_USE_FLAT_CONFIG env variable", + "packageName": "@fluentui/react-motion", + "email": "vgenaev@gmail.com", + "dependentChangeType": "none" +} diff --git a/change/@fluentui-utilities-469a9e41-6f23-4a62-b6aa-8db5a5e802b0.json b/change/@fluentui-utilities-469a9e41-6f23-4a62-b6aa-8db5a5e802b0.json new file mode 100644 index 00000000000000..36506184d36831 --- /dev/null +++ b/change/@fluentui-utilities-469a9e41-6f23-4a62-b6aa-8db5a5e802b0.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: add ESLINT_USE_FLAT_CONFIG env variable", + "packageName": "@fluentui/utilities", + "email": "vgenaev@gmail.com", + "dependentChangeType": "none" +} diff --git a/change/@fluentui-web-components-1fccbb04-a080-4c08-a1db-860f8257b53b.json b/change/@fluentui-web-components-1fccbb04-a080-4c08-a1db-860f8257b53b.json new file mode 100644 index 00000000000000..e09e50bbe4d476 --- /dev/null +++ b/change/@fluentui-web-components-1fccbb04-a080-4c08-a1db-860f8257b53b.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: add ESLINT_USE_FLAT_CONFIG env variable", + "packageName": "@fluentui/web-components", + "email": "vgenaev@gmail.com", + "dependentChangeType": "none" +} diff --git a/nx.json b/nx.json index 77cb282ed1252d..59a825568de253 100644 --- a/nx.json +++ b/nx.json @@ -73,7 +73,7 @@ "{workspaceRoot}/eslint.config.js" ], "options": { - "command": "eslint src" + "command": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint src" } }, "format": { diff --git a/package.json b/package.json index 1a55c1f33c4fe8..becc9306d7bb1c 100644 --- a/package.json +++ b/package.json @@ -59,10 +59,12 @@ "@dnd-kit/core": "^6.0.8", "@dnd-kit/sortable": "^7.0.2", "@dnd-kit/utilities": "^3.2.1", + "@eslint/compat": "1.1.1", + "@eslint/js": "9.17.0", "@floating-ui/dom": "1.6.12", "@fluentui/react-icons": "^2.0.245", "@griffel/babel-preset": "1.5.8", - "@griffel/eslint-plugin": "^1.6.4", + "@griffel/eslint-plugin": "^2.0.0", "@griffel/jest-serializer": "1.1.24", "@griffel/react": "^1.5.22", "@griffel/shadow-dom": "0.2.2", @@ -71,7 +73,7 @@ "@mdx-js/loader": "2.3.0", "@microsoft/api-extractor": "7.49.1", "@microsoft/api-extractor-model": "7.30.2", - "@microsoft/eslint-plugin-sdl": "0.1.9", + "@microsoft/eslint-plugin-sdl": "1.0.1", "@microsoft/load-themed-styles": "1.10.26", "@microsoft/loader-load-themed-styles": "2.0.17", "@microsoft/tsdoc": "0.15.1", @@ -88,7 +90,7 @@ "@phenomnomnominal/tsquery": "6.1.3", "@playwright/test": "1.49.1", "@react-native/babel-preset": "0.73.21", - "@rnx-kit/eslint-plugin": "0.8.2", + "@rnx-kit/eslint-plugin": "0.8.4", "@rollup/plugin-node-resolve": "13.3.0", "@storybook/addon-a11y": "7.6.20", "@storybook/addon-actions": "7.6.20", @@ -134,7 +136,7 @@ "@types/doctrine": "0.0.5", "@types/ejs": "3.1.5", "@types/enzyme": "3.10.7", - "@types/eslint": "8.56.10", + "@types/eslint": "9.6.1", "@types/express": "4.17.21", "@types/fs-extra": "8.0.1", "@types/glob": "7.1.1", @@ -174,10 +176,7 @@ "@types/webpack-hot-middleware": "2.25.9", "@types/yargs": "13.0.11", "@types/yargs-unparser": "2.0.1", - "@typescript-eslint/eslint-plugin": "8.8.1", - "@typescript-eslint/parser": "8.8.1", - "@typescript-eslint/rule-tester": "8.8.1", - "@typescript-eslint/utils": "8.8.1", + "@typescript-eslint/rule-tester": "8.19.1", "@wojtekmaj/enzyme-adapter-react-17": "0.6.7", "ajv": "8.4.0", "autoprefixer": "10.2.1", @@ -227,20 +226,20 @@ "enzyme-to-json": "3.6.2", "esbuild": "0.25.0", "esbuild-loader": "4.1.0", - "eslint": "8.57.0", + "eslint": "9.17.0", "eslint-config-airbnb": "18.2.1", - "eslint-config-prettier": "8.3.0", - "eslint-import-resolver-typescript": "3.6.1", + "eslint-config-prettier": "9.1.0", + "eslint-import-resolver-typescript": "3.7.0", "eslint-plugin-compat": "6.0.2", "eslint-plugin-es": "4.1.0", - "eslint-plugin-import": "2.29.1", - "eslint-plugin-jest": "28.8.0", - "eslint-plugin-jsdoc": "48.7.0", - "eslint-plugin-jsx-a11y": "6.9.0", - "eslint-plugin-playwright": "0.15.3", - "eslint-plugin-react": "7.26.0", + "eslint-plugin-import": "2.31.0", + "eslint-plugin-jest": "28.10.0", + "eslint-plugin-jsdoc": "50.6.1", + "eslint-plugin-jsx-a11y": "6.10.2", + "eslint-plugin-playwright": "2.1.0", + "eslint-plugin-react": "7.37.3", "eslint-plugin-react-compiler": "0.0.0-experimental-a97cca1-20240529", - "eslint-plugin-react-hooks": "4.6.2", + "eslint-plugin-react-hooks": "5.1.0", "express": "4.20.0", "extract-comments": "1.1.0", "file-loader": "6.2.0", @@ -342,6 +341,7 @@ "tsconfig-paths-webpack-plugin": "4.1.0", "tslib": "2.6.3", "typescript": "5.3.3", + "typescript-eslint": "8.19.1", "vinyl": "2.2.0", "vite": "6.0.9", "webpack": "5.94.0", @@ -378,7 +378,6 @@ "resolutions": { "@types/jest-axe/axe-core": "4.7.2", "esbuild": "0.25.0", - "eslint": "8.57.0", "@microsoft/api-extractor/typescript": "5.3.3", "swc-loader": "^0.2.6", "prettier": "2.8.8", diff --git a/packages/charts/chart-web-components/package.json b/packages/charts/chart-web-components/package.json index e975b6e54ea3b8..892c46cdff1076 100644 --- a/packages/charts/chart-web-components/package.json +++ b/packages/charts/chart-web-components/package.json @@ -77,7 +77,7 @@ "clean": "node ./scripts/clean dist", "generate-api": "api-extractor run --local", "build": "yarn compile && yarn rollup -c && yarn generate-api", - "lint": "eslint . --ext .ts", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint . --ext .ts", "lint:fix": "eslint . --ext .ts --fix", "format": "prettier -w src/**/*.{ts,html} --ignore-path ../../.prettierignore", "format:check": "yarn format -c", diff --git a/packages/charts/react-charts/stories/package.json b/packages/charts/react-charts/stories/package.json index b230c4eeee87bb..b0aff653b0cd98 100644 --- a/packages/charts/react-charts/stories/package.json +++ b/packages/charts/react-charts/stories/package.json @@ -6,7 +6,7 @@ "start": "yarn storybook", "storybook": "storybook dev", "type-check": "just-scripts type-check", - "lint": "eslint src/", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint src/", "format": "just-scripts prettier", "test-ssr": "test-ssr \"./src/**/*.stories.ssr.tsx\"" }, diff --git a/packages/cra-template/package.json b/packages/cra-template/package.json index 978018ba841a24..cfb15fea74efcb 100644 --- a/packages/cra-template/package.json +++ b/packages/cra-template/package.json @@ -8,7 +8,7 @@ "directory": "packages/cra-template" }, "scripts": { - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "test-integration": "node -r @fluentui/scripts-babel/register scripts/test.ts", "type-check": "tsc -p ." }, diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 33b3c163065d8b..1dbf3ab574ba50 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -9,23 +9,22 @@ }, "license": "MIT", "dependencies": { - "@griffel/eslint-plugin": "^1.6.4", - "@rnx-kit/eslint-plugin": "^0.8.2", - "@typescript-eslint/eslint-plugin": "^8.8.1", - "@typescript-eslint/utils": "^8.8.1", - "@typescript-eslint/rule-tester": "8.8.1", - "@typescript-eslint/parser": "^8.8.1", - "@typescript-eslint/type-utils": "^8.8.1", - "eslint-config-airbnb": "^18.2.1", - "eslint-config-prettier": "^8.3.0", - "eslint-import-resolver-typescript": "^3.6.1", + "@griffel/eslint-plugin": "^2.0.0", + "@rnx-kit/eslint-plugin": "^0.8.4", + "typescript-eslint": "8.19.1", + "@typescript-eslint/utils": "^8.19.1", + "@typescript-eslint/rule-tester": "8.19.1", + "@typescript-eslint/type-utils": "^8.19.1", "eslint-plugin-compat": "^6.0.2", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-jest": "^28.6.0", - "eslint-plugin-jsdoc": "^48.7.0", - "eslint-plugin-jsx-a11y": "^6.9.0", - "eslint-plugin-react": "^7.24.0", - "eslint-plugin-react-hooks": "^4.6.2", + "eslint-config-airbnb": "^18.2.1", + "eslint-config-prettier": "^9.1.0", + "eslint-import-resolver-typescript": "^3.7.0", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-jest": "^28.10.0", + "eslint-plugin-jsdoc": "^50.6.1", + "eslint-plugin-jsx-a11y": "^6.10.2", + "eslint-plugin-react": "^7.37.3", + "eslint-plugin-react-hooks": "^5.1.0", "fs-extra": "^8.1.0", "minimatch": "^3.1.2", "jju": "^1.4.0" diff --git a/packages/eslint-plugin/src/internal.js b/packages/eslint-plugin/src/internal.js index bd784694e175ae..92936a544eb4ea 100644 --- a/packages/eslint-plugin/src/internal.js +++ b/packages/eslint-plugin/src/internal.js @@ -4,7 +4,7 @@ function shouldRegisterInternal() { try { const hasNxEslintPlugin = require.resolve('@nx/eslint-plugin'); return Boolean(hasNxEslintPlugin); - } catch (err) { + } catch { return false; } } diff --git a/packages/fluentui/accessibility/package.json b/packages/fluentui/accessibility/package.json index dc895197cfc924..2c17b15bce3360 100644 --- a/packages/fluentui/accessibility/package.json +++ b/packages/fluentui/accessibility/package.json @@ -29,7 +29,7 @@ "scripts": { "build": "gulp bundle:package:no-umd", "clean": "gulp bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix", "test": "gulp test", "test:watch": "gulp test:watch" diff --git a/packages/fluentui/code-sandbox/package.json b/packages/fluentui/code-sandbox/package.json index 084f2df81e7878..f91d7ff5919fd1 100644 --- a/packages/fluentui/code-sandbox/package.json +++ b/packages/fluentui/code-sandbox/package.json @@ -34,7 +34,7 @@ "scripts": { "build": "gulp bundle:package:no-umd", "clean": "gulp bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix" }, "sideEffects": false, diff --git a/packages/fluentui/docs-components/package.json b/packages/fluentui/docs-components/package.json index e3c2cf8fa18753..d02346bfdee142 100644 --- a/packages/fluentui/docs-components/package.json +++ b/packages/fluentui/docs-components/package.json @@ -40,7 +40,7 @@ "scripts": { "build": "gulp bundle:package:no-umd", "clean": "gulp bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix" }, "sideEffects": false, diff --git a/packages/fluentui/docs/package.json b/packages/fluentui/docs/package.json index 60c597f7afd4a7..c6f3896b48002d 100644 --- a/packages/fluentui/docs/package.json +++ b/packages/fluentui/docs/package.json @@ -70,7 +70,7 @@ "prepare-storybook": "nx run-many -t build:info -p react-northstar react-component-ref react-bindings --nxBail", "prebuild-storybook": "yarn run prepare-storybook --verbose", "build-storybook": "storybook build -o dist/storybook", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix", "start": "gulp docs", "start:profile": "cross-env NODE_ENV=production PERF=true gulp docs", diff --git a/packages/fluentui/e2e/package.json b/packages/fluentui/e2e/package.json index 867d38a3a67c43..e9430293ccc091 100644 --- a/packages/fluentui/e2e/package.json +++ b/packages/fluentui/e2e/package.json @@ -25,7 +25,7 @@ "serve": "gulp test:e2e:serve", "e2e": "gulp test:e2e", "e2e:local": "cypress open --config baseUrl=http://localhost:8082", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix" } } diff --git a/packages/fluentui/perf/package.json b/packages/fluentui/perf/package.json index 61178f8a892e81..81dcbe8a4c2821 100644 --- a/packages/fluentui/perf/package.json +++ b/packages/fluentui/perf/package.json @@ -22,7 +22,7 @@ "scripts": { "test-perf": "cross-env PERF=true gulp perf --times=100", "test-perf:debug": "cross-env PERF=true gulp perf:debug --debug", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix", "type-check": "tsc -p . --noEmit --baseUrl ." } diff --git a/packages/fluentui/projects-test/package.json b/packages/fluentui/projects-test/package.json index 702bce797b126a..d2eaa59607b6d5 100644 --- a/packages/fluentui/projects-test/package.json +++ b/packages/fluentui/projects-test/package.json @@ -16,7 +16,7 @@ }, "scripts": { "build": "gulp bundle:package:no-umd", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix", "test-integration": "node -r @fluentui/scripts-babel/register src/index.ts" } diff --git a/packages/fluentui/react-bindings/package.json b/packages/fluentui/react-bindings/package.json index 602065b1d43db7..b4291b4d20b455 100644 --- a/packages/fluentui/react-bindings/package.json +++ b/packages/fluentui/react-bindings/package.json @@ -50,7 +50,7 @@ "build": "gulp bundle:package:no-umd && yarn build:info", "build:info": "gulp build:component-info", "clean": "gulp clean:component-info bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix", "test": "gulp test", "test:watch": "gulp test:watch" diff --git a/packages/fluentui/react-builder/package.json b/packages/fluentui/react-builder/package.json index 05989ae4e42333..cafe4d62174d72 100644 --- a/packages/fluentui/react-builder/package.json +++ b/packages/fluentui/react-builder/package.json @@ -48,7 +48,7 @@ "scripts": { "build": "gulp bundle:package:no-umd", "clean": "gulp bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix", "test": "gulp test", "test:watch": "gulp test:watch" diff --git a/packages/fluentui/react-component-event-listener/package.json b/packages/fluentui/react-component-event-listener/package.json index d7bb60435e49cb..6b9e83364d4055 100644 --- a/packages/fluentui/react-component-event-listener/package.json +++ b/packages/fluentui/react-component-event-listener/package.json @@ -34,7 +34,7 @@ "scripts": { "build": "gulp bundle:package:no-umd", "clean": "gulp bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix", "test": "gulp test", "test:watch": "gulp test:watch" diff --git a/packages/fluentui/react-component-nesting-registry/package.json b/packages/fluentui/react-component-nesting-registry/package.json index b650e59274997e..c9310b412e7d02 100644 --- a/packages/fluentui/react-component-nesting-registry/package.json +++ b/packages/fluentui/react-component-nesting-registry/package.json @@ -33,7 +33,7 @@ "scripts": { "build": "gulp bundle:package:no-umd", "clean": "gulp bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix", "test": "gulp test", "test:watch": "gulp test:watch" diff --git a/packages/fluentui/react-component-ref/package.json b/packages/fluentui/react-component-ref/package.json index dc467b4c59f6c3..b5eac79e998293 100644 --- a/packages/fluentui/react-component-ref/package.json +++ b/packages/fluentui/react-component-ref/package.json @@ -37,7 +37,7 @@ "build": "gulp bundle:package:no-umd && yarn build:info", "build:info": "gulp build:component-info", "clean": "gulp clean:component-info bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix", "test": "gulp test", "test:watch": "gulp test:watch" diff --git a/packages/fluentui/react-icons-northstar/package.json b/packages/fluentui/react-icons-northstar/package.json index 9698ceec1235b7..b248390cb9cdef 100644 --- a/packages/fluentui/react-icons-northstar/package.json +++ b/packages/fluentui/react-icons-northstar/package.json @@ -36,7 +36,7 @@ "scripts": { "build": "gulp bundle:package:no-umd", "clean": "gulp bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix", "test": "gulp test", "test:watch": "gulp test:watch" diff --git a/packages/fluentui/react-northstar-emotion-renderer/package.json b/packages/fluentui/react-northstar-emotion-renderer/package.json index c8b45be951f74b..72b1e0960f4bb9 100644 --- a/packages/fluentui/react-northstar-emotion-renderer/package.json +++ b/packages/fluentui/react-northstar-emotion-renderer/package.json @@ -40,7 +40,7 @@ "scripts": { "build": "gulp bundle:package:no-umd", "clean": "gulp bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix", "test": "gulp test", "test:watch": "gulp test:watch" diff --git a/packages/fluentui/react-northstar-fela-renderer/package.json b/packages/fluentui/react-northstar-fela-renderer/package.json index 42a87a5c8aa56f..e93d2bb3a0c825 100644 --- a/packages/fluentui/react-northstar-fela-renderer/package.json +++ b/packages/fluentui/react-northstar-fela-renderer/package.json @@ -46,7 +46,7 @@ "scripts": { "build": "gulp bundle:package:no-umd", "clean": "gulp bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix", "test": "gulp test", "test:watch": "gulp test:watch" diff --git a/packages/fluentui/react-northstar-prototypes/package.json b/packages/fluentui/react-northstar-prototypes/package.json index 791ffc7477e5df..6879d1aa358d0e 100644 --- a/packages/fluentui/react-northstar-prototypes/package.json +++ b/packages/fluentui/react-northstar-prototypes/package.json @@ -54,7 +54,7 @@ "scripts": { "build": "gulp bundle:package:no-umd", "clean": "gulp bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix" }, "sideEffects": false, diff --git a/packages/fluentui/react-northstar-styles-renderer/package.json b/packages/fluentui/react-northstar-styles-renderer/package.json index 1875207a90afab..ff9ef7cb237ebf 100644 --- a/packages/fluentui/react-northstar-styles-renderer/package.json +++ b/packages/fluentui/react-northstar-styles-renderer/package.json @@ -30,7 +30,7 @@ "scripts": { "build": "gulp bundle:package:no-umd", "clean": "gulp bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix" }, "sideEffects": false, diff --git a/packages/fluentui/react-northstar/package.json b/packages/fluentui/react-northstar/package.json index 299e9331735364..4bb4d69257af93 100644 --- a/packages/fluentui/react-northstar/package.json +++ b/packages/fluentui/react-northstar/package.json @@ -68,7 +68,7 @@ "build:info": "gulp build:component-info", "bundle-size": "monosize measure", "clean": "gulp clean:component-info bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix", "test": "gulp test", "test:watch": "gulp test:watch" diff --git a/packages/fluentui/react-proptypes/package.json b/packages/fluentui/react-proptypes/package.json index f9be98cc242170..081083d72ac37a 100644 --- a/packages/fluentui/react-proptypes/package.json +++ b/packages/fluentui/react-proptypes/package.json @@ -30,7 +30,7 @@ "scripts": { "build": "gulp bundle:package:no-umd", "clean": "gulp bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix", "test": "gulp test", "test:watch": "gulp test:watch" diff --git a/packages/fluentui/react-telemetry/package.json b/packages/fluentui/react-telemetry/package.json index b7a24fad1c34fa..29eb99655e814d 100644 --- a/packages/fluentui/react-telemetry/package.json +++ b/packages/fluentui/react-telemetry/package.json @@ -36,7 +36,7 @@ "scripts": { "build": "gulp bundle:package:no-umd", "clean": "gulp bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix" }, "sideEffects": false, diff --git a/packages/fluentui/state/package.json b/packages/fluentui/state/package.json index 3267d4dcf845b6..8a0fb6df654306 100644 --- a/packages/fluentui/state/package.json +++ b/packages/fluentui/state/package.json @@ -27,7 +27,7 @@ "scripts": { "build": "gulp bundle:package:no-umd", "clean": "gulp bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix", "test:watch": "gulp test:watch" }, diff --git a/packages/fluentui/styles/package.json b/packages/fluentui/styles/package.json index 25376897155390..9c5c443ff8302a 100644 --- a/packages/fluentui/styles/package.json +++ b/packages/fluentui/styles/package.json @@ -30,7 +30,7 @@ "scripts": { "build": "gulp bundle:package:no-umd", "clean": "gulp bundle:package:clean", - "lint": "eslint --ext .js,.ts,.tsx .", + "lint": "ESLINT_USE_FLAT_CONFIG=false eslint --ext .js,.ts,.tsx .", "lint:fix": "yarn lint --fix", "test": "gulp test", "test:watch": "gulp test:watch" diff --git a/packages/public-docsite-setup/.eslintrc.json b/packages/public-docsite-setup/.eslintrc.json deleted file mode 100644 index 5c439a68697ac7..00000000000000 --- a/packages/public-docsite-setup/.eslintrc.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": ["plugin:@fluentui/eslint-plugin/react--legacy"], - "root": true, - "overrides": [ - { - "files": ["bin/*.js", "src/loadSite.ts"], - "rules": { - "no-console": "off", - "no-restricted-globals": "off" - } - }, - { - "files": ["bin/*.js", "scripts/*.js"], - "plugins": ["es"], - // These files need to work with Node 8 (for 5.0 and 6.0 branches) - "extends": ["plugin:es/restrict-to-es2017"] - } - ] -} diff --git a/packages/public-docsite-setup/eslint.config.js b/packages/public-docsite-setup/eslint.config.js new file mode 100644 index 00000000000000..60040a9f6a5436 --- /dev/null +++ b/packages/public-docsite-setup/eslint.config.js @@ -0,0 +1,27 @@ +const js = require('@eslint/js'); +const { fixupConfigRules } = require('@eslint/compat'); + +const { FlatCompat } = require('@eslint/eslintrc'); + +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all, +}); + +module.exports = [ + ...compat.extends('plugin:@fluentui/eslint-plugin/react--legacy'), + { + files: ['bin/*.js', 'scripts/*.js'], + rules: { + ...fixupConfigRules(compat.extends('plugin:es/restrict-to-es2017')).rules, + }, + }, + { + files: ['bin/*.js', 'src/loadSite.ts'], + rules: { + 'no-console': 'off', + 'no-restricted-globals': 'off', + }, + }, +]; diff --git a/packages/public-docsite-setup/scripts/getLoadSiteConfig.js b/packages/public-docsite-setup/scripts/getLoadSiteConfig.js index 1694cb362009cf..c8fe5fc1dd90ba 100644 --- a/packages/public-docsite-setup/scripts/getLoadSiteConfig.js +++ b/packages/public-docsite-setup/scripts/getLoadSiteConfig.js @@ -26,7 +26,7 @@ function getLoadSiteConfig(options) { let copyPlugin; try { copyPlugin = new CopyWebpackPlugin({ patterns: copyPatterns }); - } catch (err) { + } catch { // copy-webpack-plugin >= 6 requires Node 10+ and takes an object containing patterns. // Fabric 5 and 6 still support Node 8, so they need to use copy-webpack-plugin@5 which // takes the patterns themselves as the first parameter. diff --git a/packages/react-cards/.eslintrc.json b/packages/react-cards/.eslintrc.json index 4c0d4b83a6d43a..e6e5b39ec8f88d 100644 --- a/packages/react-cards/.eslintrc.json +++ b/packages/react-cards/.eslintrc.json @@ -8,7 +8,6 @@ { "files": "**/*.{ts,tsx}", "rules": { - // The components in this package are all deprecated "@typescript-eslint/no-deprecated": "off" } } diff --git a/packages/react-components/eslint-plugin-react-components/package.json b/packages/react-components/eslint-plugin-react-components/package.json index b67ca20a4c7985..5d85a2db94799a 100644 --- a/packages/react-components/eslint-plugin-react-components/package.json +++ b/packages/react-components/eslint-plugin-react-components/package.json @@ -11,15 +11,15 @@ }, "license": "MIT", "devDependencies": { - "@typescript-eslint/rule-tester": "8.8.1", - "eslint-plugin-eslint-plugin": "6.3.1" + "@typescript-eslint/rule-tester": "8.19.1", + "eslint-plugin-eslint-plugin": "6.4.0" }, "dependencies": { - "@typescript-eslint/utils": "^8.8.1", + "@typescript-eslint/utils": "^8.19.1", "@swc/helpers": "^0.5.1" }, "peerDependencies": { - "@typescript-eslint/parser": "^8.8.1", + "typescript-eslint": "^8.19.1", "eslint": "^8.0.0", "typescript": "^5.0.0" }, diff --git a/packages/react-components/react-calendar-compat/library/src/components/CalendarYear/CalendarYear.tsx b/packages/react-components/react-calendar-compat/library/src/components/CalendarYear/CalendarYear.tsx index a7faa6315088ba..5e6f7be20d1f55 100644 --- a/packages/react-components/react-calendar-compat/library/src/components/CalendarYear/CalendarYear.tsx +++ b/packages/react-components/react-calendar-compat/library/src/components/CalendarYear/CalendarYear.tsx @@ -13,6 +13,8 @@ import type { const CELL_COUNT = 12; const CELLS_PER_ROW = 4; +/* eslint-disable react-compiler/react-compiler */ + const DefaultCalendarYearStrings: CalendarYearStrings = { prevRangeAriaLabel: undefined, nextRangeAriaLabel: undefined, @@ -112,9 +114,12 @@ const CalendarYearGrid: React.FunctionComponent = props = componentRef, } = props; + // eslint-disable-next-line react-hooks/rules-of-hooks const selectedCellRef = React.useRef(null); + // eslint-disable-next-line react-hooks/rules-of-hooks const currentCellRef = React.useRef(null); + // eslint-disable-next-line react-hooks/rules-of-hooks React.useImperativeHandle( componentRef, () => ({ @@ -145,6 +150,7 @@ const CalendarYearGrid: React.FunctionComponent = props = ); }; + // eslint-disable-next-line react-hooks/rules-of-hooks const classNames = useCalendarYearStyles_unstable({ className, animateBackwards, diff --git a/packages/react-components/react-motion/library/src/components/PresenceGroup.tsx b/packages/react-components/react-motion/library/src/components/PresenceGroup.tsx index d0354eb5f5d682..040003bf3de55c 100644 --- a/packages/react-components/react-motion/library/src/components/PresenceGroup.tsx +++ b/packages/react-components/react-motion/library/src/components/PresenceGroup.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; - import { getNextChildMapping } from '../utils/groups/getNextChildMapping'; import { getChildMapping } from '../utils/groups/getChildMapping'; import type { PresenceGroupChildMapping } from '../utils/groups/types'; @@ -34,6 +33,7 @@ export class PresenceGroup extends React.Component { it('should work as inertTrapFocus when set to false', () => { mount( + // eslint-disable-next-line @typescript-eslint/no-deprecated diff --git a/packages/react-components/react-tree/library/src/components/Tree/Tree.cy.tsx b/packages/react-components/react-tree/library/src/components/Tree/Tree.cy.tsx index 4b8c1cdd78e048..8b17e093887dc0 100644 --- a/packages/react-components/react-tree/library/src/components/Tree/Tree.cy.tsx +++ b/packages/react-components/react-tree/library/src/components/Tree/Tree.cy.tsx @@ -316,7 +316,7 @@ describe('Tree', () => { defaultOpenItems={['item1', 'item2', 'item2__item1']} > {Array.from({ length: 200 }, (_, index) => ( - + level 0, item {index + 1} ))} diff --git a/packages/react-examples/.eslintrc.json b/packages/react-examples/.eslintrc.json index 4a59b1205ddc66..58d9c4f0a5f6ac 100644 --- a/packages/react-examples/.eslintrc.json +++ b/packages/react-examples/.eslintrc.json @@ -5,6 +5,7 @@ "import/no-webpack-loader-syntax": "off", "@typescript-eslint/no-explicit-any": "off", "no-alert": "off", - "no-restricted-globals": "off" + "no-restricted-globals": "off", + "@typescript-eslint/no-deprecated": "warn" } } diff --git a/packages/react-examples/src/react/PeoplePicker/PeoplePicker.Controlled.Example.tsx b/packages/react-examples/src/react/PeoplePicker/PeoplePicker.Controlled.Example.tsx index a7e30c6b21f88a..d28205a61c6b81 100644 --- a/packages/react-examples/src/react/PeoplePicker/PeoplePicker.Controlled.Example.tsx +++ b/packages/react-examples/src/react/PeoplePicker/PeoplePicker.Controlled.Example.tsx @@ -5,6 +5,8 @@ import { IPersonaProps, Persona } from '@fluentui/react/lib/Persona'; import { IBasePickerSuggestionsProps, NormalPeoplePicker } from '@fluentui/react/lib/Pickers'; import { people } from '@fluentui/example-data'; +/* eslint-disable react-hooks/rules-of-hooks */ + const suggestionProps: IBasePickerSuggestionsProps = { suggestionsHeaderText: 'Suggested People', mostRecentlyUsedHeaderText: 'Suggested Contacts', diff --git a/packages/react-experiments/.eslintrc.json b/packages/react-experiments/.eslintrc.json index 94cce37333d4c9..acd61a5fc6af8d 100644 --- a/packages/react-experiments/.eslintrc.json +++ b/packages/react-experiments/.eslintrc.json @@ -3,6 +3,7 @@ "root": true, "rules": { "@typescript-eslint/no-explicit-any": "off", - "no-restricted-globals": "off" + "no-restricted-globals": "off", + "@typescript-eslint/no-deprecated": "warn" } } diff --git a/packages/react-experiments/src/components/SelectedItemsList/SelectedItemsList.tsx b/packages/react-experiments/src/components/SelectedItemsList/SelectedItemsList.tsx index 88f9036fa6060a..e9e3cb6b750a2a 100644 --- a/packages/react-experiments/src/components/SelectedItemsList/SelectedItemsList.tsx +++ b/packages/react-experiments/src/components/SelectedItemsList/SelectedItemsList.tsx @@ -1,6 +1,8 @@ import * as React from 'react'; import type { ISelectedItemsList, ISelectedItemsListProps, BaseSelectedItem } from './SelectedItemsList.types'; +/* eslint-disable react-hooks/rules-of-hooks */ + const _SelectedItemsList = ( props: ISelectedItemsListProps, ref: React.Ref>, diff --git a/packages/react-monaco-editor/.eslintrc.json b/packages/react-monaco-editor/.eslintrc.json index 2743cb1a1673d4..81b8fb1dad460b 100644 --- a/packages/react-monaco-editor/.eslintrc.json +++ b/packages/react-monaco-editor/.eslintrc.json @@ -3,6 +3,7 @@ "root": true, "rules": { "import/no-webpack-loader-syntax": "off", // ok in this project - "no-restricted-globals": "off" + "no-restricted-globals": "off", + "react-hooks/rules-of-hooks": "warn" } } diff --git a/packages/react-monaco-editor/src/components/EditorError.tsx b/packages/react-monaco-editor/src/components/EditorError.tsx index 72ad867f16a806..537d8d9c839795 100644 --- a/packages/react-monaco-editor/src/components/EditorError.tsx +++ b/packages/react-monaco-editor/src/components/EditorError.tsx @@ -20,6 +20,7 @@ export const EditorError: React.FunctionComponent = props => const errorArr = !error ? [] : Array.isArray(error) ? error : error.split('\n'); return errorArr.length ? ( + // eslint-disable-next-line @typescript-eslint/no-deprecated There {errorArr.length === 1 ? 'is an error' : 'are errors'} preventing the code from being rendered: {errorArr!.map(err => { diff --git a/packages/react/src/components/Autofill/Autofill.test.tsx b/packages/react/src/components/Autofill/Autofill.test.tsx index 63c0e51178c41c..36eb5af1c5f5a7 100644 --- a/packages/react/src/components/Autofill/Autofill.test.tsx +++ b/packages/react/src/components/Autofill/Autofill.test.tsx @@ -123,6 +123,7 @@ describe('Autofill', () => { , ); @@ -159,6 +160,7 @@ describe('Autofill', () => { it('handles composition events when multiple compositionEnd events are dispatched without a compositionStart', () => { const onInputChange = jest.fn((a: string, b: boolean) => a); + // eslint-disable-next-line @typescript-eslint/no-deprecated component = mount(); autofill.inputElement!.value = 'hel'; @@ -229,6 +231,7 @@ describe('Autofill', () => { it('will call onInputChange w/ composition events', () => { const onInputChange = jest.fn((a: string, b: boolean) => a); + // eslint-disable-next-line @typescript-eslint/no-deprecated component = mount(); autofill.inputElement!.value = 'he'; diff --git a/packages/react/src/components/Button/Button.test.tsx b/packages/react/src/components/Button/Button.test.tsx index 76191904f950ca..cce6fd05c6c07c 100644 --- a/packages/react/src/components/Button/Button.test.tsx +++ b/packages/react/src/components/Button/Button.test.tsx @@ -99,6 +99,7 @@ describe('Button', () => { it('can handle elementRef', () => { const ref = React.createRef(); + // eslint-disable-next-line @typescript-eslint/no-deprecated render(Content); expect(ref.current).toBeTruthy(); }); @@ -769,6 +770,7 @@ describe('Button', () => { text="Create account" split={true} onClick={setTrue} + // eslint-disable-next-line @typescript-eslint/no-deprecated onKeyPress={setTrue} onKeyUp={setTrue} onKeyDown={setTrue} @@ -804,6 +806,7 @@ describe('Button', () => { text="Create account" split={false} onClick={setTrue} + // eslint-disable-next-line @typescript-eslint/no-deprecated onKeyPress={setTrue} onKeyUp={setTrue} onKeyDown={setTrue} @@ -825,6 +828,7 @@ describe('Button', () => { text="Create account" split={false} onClick={setTrue} + // eslint-disable-next-line @typescript-eslint/no-deprecated onKeyPress={setTrue} onKeyUp={setTrue} onKeyDown={setTrue} @@ -846,6 +850,7 @@ describe('Button', () => { text="Create account" split={false} onClick={setTrue} + // eslint-disable-next-line @typescript-eslint/no-deprecated onKeyPress={setTrue} onKeyUp={setTrue} onKeyDown={setTrue} diff --git a/packages/react/src/components/Calendar/CalendarYear/CalendarYear.base.tsx b/packages/react/src/components/Calendar/CalendarYear/CalendarYear.base.tsx index fc919642228fb7..5fd0dc4f59f0b4 100644 --- a/packages/react/src/components/Calendar/CalendarYear/CalendarYear.base.tsx +++ b/packages/react/src/components/Calendar/CalendarYear/CalendarYear.base.tsx @@ -127,9 +127,12 @@ const CalendarYearGrid: React.FunctionComponent = props componentRef, } = props; + // eslint-disable-next-line react-hooks/rules-of-hooks const selectedCellRef = React.useRef(null); + // eslint-disable-next-line react-hooks/rules-of-hooks const currentCellRef = React.useRef(null); + // eslint-disable-next-line react-hooks/rules-of-hooks React.useImperativeHandle( componentRef, () => ({ diff --git a/packages/react/src/components/Callout/CalloutContent.base.tsx b/packages/react/src/components/Callout/CalloutContent.base.tsx index 89550932965a2f..4eba936dce8cf8 100644 --- a/packages/react/src/components/Callout/CalloutContent.base.tsx +++ b/packages/react/src/components/Callout/CalloutContent.base.tsx @@ -599,6 +599,7 @@ export const CalloutContentBase: React.FunctionComponent = React. onMouseUp={mouseUpOnPopup} onRestoreFocus={props.onRestoreFocus} onScroll={onScroll} + // eslint-disable-next-line @typescript-eslint/no-deprecated shouldRestoreFocus={shouldRestoreFocus} style={overflowStyle} {...popupProps} diff --git a/packages/react/src/components/ComboBox/ComboBox.tsx b/packages/react/src/components/ComboBox/ComboBox.tsx index 9b6823d72a6d7d..365348544529e3 100644 --- a/packages/react/src/components/ComboBox/ComboBox.tsx +++ b/packages/react/src/components/ComboBox/ComboBox.tsx @@ -26,6 +26,7 @@ import { getCaretDownButtonStyles, getOptionStyles, getStyles } from './ComboBox import { getClassNames, getComboBoxOptionClassNames } from './ComboBox.classNames'; import { Label } from '../../Label'; import { SelectableOptionMenuItemType, getAllSelectedOptions } from '../../SelectableOption'; +// eslint-disable-next-line @typescript-eslint/no-deprecated import { BaseButton, Button, CommandButton, IconButton } from '../../Button'; import { useMergedRefs } from '@fluentui/react-hooks'; import type { IAutofill } from '../../Autofill'; @@ -686,6 +687,7 @@ class ComboBoxInternal extends React.Component