From fea2e86af0d808cf4d2398d3ee9dc523d52c7ae5 Mon Sep 17 00:00:00 2001 From: Oleksandr Fediashov Date: Tue, 25 Apr 2023 14:56:58 +0200 Subject: [PATCH] chore: bump @griffel/eslint-plugin & enable @griffel/hook-naming --- .../Slider/Sliderv9Examples.stories.tsx | 4 +- ...-5fd26f6f-a0b9-458f-80e0-86e99da9672a.json | 7 ++ package.json | 2 +- packages/eslint-plugin/package.json | 1 + .../eslint-plugin/src/configs/react-config.js | 1 + .../components/{{componentName}}/index.ts.hbs | 2 +- ... use{{componentName}}Styles.styles.ts.hbs} | 0 .../{{componentName}}.tsx.hbs | 2 +- yarn.lock | 118 ++++++++++-------- 9 files changed, 77 insertions(+), 60 deletions(-) create mode 100644 change/@fluentui-eslint-plugin-5fd26f6f-a0b9-458f-80e0-86e99da9672a.json rename scripts/generators/create-component/plop-templates/src/components/{{componentName}}/{use{{componentName}}Styles.ts.hbs => use{{componentName}}Styles.styles.ts.hbs} (100%) diff --git a/apps/public-docsite-v9/src/Concepts/Migration/FromV8/Components/Slider/Sliderv9Examples.stories.tsx b/apps/public-docsite-v9/src/Concepts/Migration/FromV8/Components/Slider/Sliderv9Examples.stories.tsx index bcf94140fb3f68..75c26dff94bf3e 100644 --- a/apps/public-docsite-v9/src/Concepts/Migration/FromV8/Components/Slider/Sliderv9Examples.stories.tsx +++ b/apps/public-docsite-v9/src/Concepts/Migration/FromV8/Components/Slider/Sliderv9Examples.stories.tsx @@ -33,7 +33,7 @@ export const V9ControlledExample = () => { ); }; -const getFormattedExampleStyles = makeStyles({ +const useGetFormattedExampleStyles = makeStyles({ wrapper: { display: 'grid', alignItems: 'center', @@ -43,7 +43,7 @@ const getFormattedExampleStyles = makeStyles({ }); export const V9FormattedValueExample = () => { - const styles = getFormattedExampleStyles(); + const styles = useGetFormattedExampleStyles(); const [sliderValue, setSliderValue] = React.useState(0); const sliderOnChange: SliderProps['onChange'] = (ev, data) => setSliderValue(data.value); const formattedId = useId(); diff --git a/change/@fluentui-eslint-plugin-5fd26f6f-a0b9-458f-80e0-86e99da9672a.json b/change/@fluentui-eslint-plugin-5fd26f6f-a0b9-458f-80e0-86e99da9672a.json new file mode 100644 index 00000000000000..f99e254f762e86 --- /dev/null +++ b/change/@fluentui-eslint-plugin-5fd26f6f-a0b9-458f-80e0-86e99da9672a.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "feat: enable @griffel/hook-naming rule", + "packageName": "@fluentui/eslint-plugin", + "email": "olfedias@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/package.json b/package.json index 12d49f6b292c6f..e9621807e777e3 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "@cypress/webpack-dev-server": "1.8.3", "@fluentui/react-icons": "^2.0.196", "@griffel/babel-preset": "1.4.8", - "@griffel/eslint-plugin": "1.0.0", + "@griffel/eslint-plugin": "^1.2.0", "@griffel/jest-serializer": "1.1.4", "@griffel/react": "^1.5.2", "@griffel/webpack-extraction-plugin": "0.3.3", diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 333859b9a1e342..01a723281b5777 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -13,6 +13,7 @@ "test": "yarn jest --passWithNoTests" }, "dependencies": { + "@griffel/eslint-plugin": "^1.2.0", "@rnx-kit/eslint-plugin": "^0.2.5", "@typescript-eslint/eslint-plugin": "^4.22.0", "@typescript-eslint/experimental-utils": "^4.22.0", diff --git a/packages/eslint-plugin/src/configs/react-config.js b/packages/eslint-plugin/src/configs/react-config.js index e3a86533ddc77c..a65c56b48539b3 100644 --- a/packages/eslint-plugin/src/configs/react-config.js +++ b/packages/eslint-plugin/src/configs/react-config.js @@ -25,6 +25,7 @@ module.exports = { * griffel eslint rules * @see https://github.com/microsoft/griffel/tree/main/packages/eslint-plugin */ + '@griffel/hook-naming': 'error', '@griffel/no-shorthands': 'error', /** * react eslint rules diff --git a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/index.ts.hbs b/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/index.ts.hbs index 23b6962a78c39f..6153344477e031 100644 --- a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/index.ts.hbs +++ b/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/index.ts.hbs @@ -2,4 +2,4 @@ export * from './{{componentName}}'; export * from './{{componentName}}.types'; export * from './render{{componentName}}'; export * from './use{{componentName}}'; -export * from './use{{componentName}}Styles'; +export * from './use{{componentName}}Styles.styles'; diff --git a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/use{{componentName}}Styles.ts.hbs b/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/use{{componentName}}Styles.styles.ts.hbs similarity index 100% rename from scripts/generators/create-component/plop-templates/src/components/{{componentName}}/use{{componentName}}Styles.ts.hbs rename to scripts/generators/create-component/plop-templates/src/components/{{componentName}}/use{{componentName}}Styles.styles.ts.hbs diff --git a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/{{componentName}}.tsx.hbs b/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/{{componentName}}.tsx.hbs index 992ff7dd15ea8d..0e16ce7edec0e2 100644 --- a/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/{{componentName}}.tsx.hbs +++ b/scripts/generators/create-component/plop-templates/src/components/{{componentName}}/{{componentName}}.tsx.hbs @@ -1,7 +1,7 @@ import * as React from 'react'; import { use{{componentName}}_unstable } from './use{{componentName}}'; import { render{{componentName}}_unstable } from './render{{componentName}}'; -import { use{{componentName}}Styles_unstable } from './use{{componentName}}Styles'; +import { use{{componentName}}Styles_unstable } from './use{{componentName}}Styles.styles'; import type { {{componentName}}Props } from './{{componentName}}.types'; import type { ForwardRefComponent } from '@fluentui/react-utilities'; diff --git a/yarn.lock b/yarn.lock index 577175f92bf6f7..2ce3a8d3ab13fd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1603,6 +1603,13 @@ esquery "^1.4.0" jsdoc-type-pratt-parser "1.1.1" +"@eslint-community/eslint-utils@^4.2.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + dependencies: + eslint-visitor-keys "^3.3.0" + "@eslint/eslintrc@^0.4.0": version "0.4.3" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" @@ -1678,13 +1685,14 @@ stylis "^4.0.13" tslib "^2.1.0" -"@griffel/eslint-plugin@1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@griffel/eslint-plugin/-/eslint-plugin-1.0.0.tgz#cba251b7a140399c6686b72a72e9fa2ee481f532" - integrity sha512-I8oQcyTdcPmOqX4Ti7FVP8fTJRneQBhzNf6eh8ce7avvVF7YOkiIg+Qu9dVvXSR/BxkY/Ncs8CGtUV++kTBx0g== +"@griffel/eslint-plugin@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@griffel/eslint-plugin/-/eslint-plugin-1.2.0.tgz#a4e211c16b4d3f0cdb90b47c5af1dce191b10bd4" + integrity sha512-ThqQR1UIeM+WZH1z8RUrKHCDuSXrFEwRIL4nX0UmBZznV/36DiGzODOQl6ZoZ9eCGoGYxTnl6riwy/1cB/0yGA== dependencies: - "@typescript-eslint/utils" "^5.20.0" - csstype "^3.0.10" + "@typescript-eslint/utils" "^5.47.0" + csstype "^3.1.2" + tslib "^2.1.0" "@griffel/jest-serializer@1.1.4": version "1.1.4" @@ -5995,6 +6003,11 @@ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-6.2.3.tgz#5798ecf1bec94eaa64db39ee52808ec0693315aa" integrity sha512-KQf+QAMWKMrtBMsB8/24w53tEsxllMj6TuA80TT/5igJalLI/zm0L3oXRbIAl4Ohfc85gyHX/jhMwsVkmhLU4A== +"@types/semver@^7.3.12": + version "7.3.13" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.13.tgz#da4bfd73f49bd541d28920ab0e2bf0ee80f71c91" + integrity sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw== + "@types/serve-index@^1.9.1": version "1.9.1" resolved "https://registry.yarnpkg.com/@types/serve-index/-/serve-index-1.9.1.tgz#1b5e85370a192c01ec6cec4735cf2917337a6278" @@ -6279,23 +6292,23 @@ "@typescript-eslint/types" "4.22.0" "@typescript-eslint/visitor-keys" "4.22.0" -"@typescript-eslint/scope-manager@5.23.0": - version "5.23.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.23.0.tgz#4305e61c2c8e3cfa3787d30f54e79430cc17ce1b" - integrity sha512-EhjaFELQHCRb5wTwlGsNMvzK9b8Oco4aYNleeDlNuL6qXWDF47ch4EhVNPh8Rdhf9tmqbN4sWDk/8g+Z/J8JVw== +"@typescript-eslint/scope-manager@5.59.1": + version "5.59.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.1.tgz#8a20222719cebc5198618a5d44113705b51fd7fe" + integrity sha512-mau0waO5frJctPuAzcxiNWqJR5Z8V0190FTSqRw1Q4Euop6+zTwHAf8YIXNwDOT29tyUDrQ65jSg9aTU/H0omA== dependencies: - "@typescript-eslint/types" "5.23.0" - "@typescript-eslint/visitor-keys" "5.23.0" + "@typescript-eslint/types" "5.59.1" + "@typescript-eslint/visitor-keys" "5.59.1" "@typescript-eslint/types@4.22.0": version "4.22.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.22.0.tgz#0ca6fde5b68daf6dba133f30959cc0688c8dd0b6" integrity sha512-sW/BiXmmyMqDPO2kpOhSy2Py5w6KvRRsKZnV0c4+0nr4GIcedJwXAq+RHNK4lLVEZAJYFltnnk1tJSlbeS9lYA== -"@typescript-eslint/types@5.23.0": - version "5.23.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.23.0.tgz#8733de0f58ae0ed318dbdd8f09868cdbf9f9ad09" - integrity sha512-NfBsV/h4dir/8mJwdZz7JFibaKC3E/QdeMEDJhiAE3/eMkoniZ7MjbEMCGXw6MZnZDMN3G9S0mH/6WUIj91dmw== +"@typescript-eslint/types@5.59.1": + version "5.59.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.1.tgz#03f3fedd1c044cb336ebc34cc7855f121991f41d" + integrity sha512-dg0ICB+RZwHlysIy/Dh1SP+gnXNzwd/KS0JprD3Lmgmdq+dJAJnUPe1gNG34p0U19HvRlGX733d/KqscrGC1Pg== "@typescript-eslint/typescript-estree@4.22.0": version "4.22.0" @@ -6310,30 +6323,32 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/typescript-estree@5.23.0": - version "5.23.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.23.0.tgz#dca5f10a0a85226db0796e8ad86addc9aee52065" - integrity sha512-xE9e0lrHhI647SlGMl+m+3E3CKPF1wzvvOEWnuE3CCjjT7UiRnDGJxmAcVKJIlFgK6DY9RB98eLr1OPigPEOGg== +"@typescript-eslint/typescript-estree@5.59.1": + version "5.59.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.1.tgz#4aa546d27fd0d477c618f0ca00b483f0ec84c43c" + integrity sha512-lYLBBOCsFltFy7XVqzX0Ju+Lh3WPIAWxYpmH/Q7ZoqzbscLiCW00LeYCdsUnnfnj29/s1WovXKh2gwCoinHNGA== dependencies: - "@typescript-eslint/types" "5.23.0" - "@typescript-eslint/visitor-keys" "5.23.0" - debug "^4.3.2" - globby "^11.0.4" + "@typescript-eslint/types" "5.59.1" + "@typescript-eslint/visitor-keys" "5.59.1" + debug "^4.3.4" + globby "^11.1.0" is-glob "^4.0.3" - semver "^7.3.5" + semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/utils@^5.20.0": - version "5.23.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.23.0.tgz#4691c3d1b414da2c53d8943310df36ab1c50648a" - integrity sha512-dbgaKN21drqpkbbedGMNPCtRPZo1IOUr5EI9Jrrh99r5UW5Q0dz46RKXeSBoPV+56R6dFKpbrdhgUNSJsDDRZA== +"@typescript-eslint/utils@^5.47.0": + version "5.59.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.1.tgz#d89fc758ad23d2157cfae53f0b429bdf15db9473" + integrity sha512-MkTe7FE+K1/GxZkP5gRj3rCztg45bEhsd8HYjczBuYm+qFHP5vtZmjx3B0yUCDotceQ4sHgTyz60Ycl225njmA== dependencies: + "@eslint-community/eslint-utils" "^4.2.0" "@types/json-schema" "^7.0.9" - "@typescript-eslint/scope-manager" "5.23.0" - "@typescript-eslint/types" "5.23.0" - "@typescript-eslint/typescript-estree" "5.23.0" + "@types/semver" "^7.3.12" + "@typescript-eslint/scope-manager" "5.59.1" + "@typescript-eslint/types" "5.59.1" + "@typescript-eslint/typescript-estree" "5.59.1" eslint-scope "^5.1.1" - eslint-utils "^3.0.0" + semver "^7.3.7" "@typescript-eslint/visitor-keys@4.22.0": version "4.22.0" @@ -6343,13 +6358,13 @@ "@typescript-eslint/types" "4.22.0" eslint-visitor-keys "^2.0.0" -"@typescript-eslint/visitor-keys@5.23.0": - version "5.23.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.23.0.tgz#057c60a7ca64667a39f991473059377a8067c87b" - integrity sha512-Vd4mFNchU62sJB8pX19ZSPog05B0Y0CE2UxAZPT5k4iqhRYjPnqyY3woMxCd0++t9OTqkgjST+1ydLBi7e2Fvg== +"@typescript-eslint/visitor-keys@5.59.1": + version "5.59.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.1.tgz#0d96c36efb6560d7fb8eb85de10442c10d8f6058" + integrity sha512-6waEYwBTCWryx0VJmP7JaM4FpipLsFl9CvYf2foAE8Qh/Y0s+bxWysciwOs0LTBED4JCaNxTZ5rGadB14M6dwA== dependencies: - "@typescript-eslint/types" "5.23.0" - eslint-visitor-keys "^3.0.0" + "@typescript-eslint/types" "5.59.1" + eslint-visitor-keys "^3.3.0" "@uifabric/set-version@^7.0.23": version "7.0.23" @@ -10332,10 +10347,10 @@ csstype@^2.5.5, csstype@^2.5.7, csstype@^2.6.7: resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.19.tgz#feeb5aae89020bb389e1f63669a5ed490e391caa" integrity sha512-ZVxXaNy28/k3kJg0Fou5MiYpp88j7H9hLZp8PDC3jV0WFjfH5E9xHb56L0W59cPbKbcHXeP4qyT8PrHp8t6LcQ== -csstype@^3.0.10, csstype@^3.0.2: - version "3.0.11" - resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.11.tgz#d66700c5eacfac1940deb4e3ee5642792d85cd33" - integrity sha512-sa6P2wJ+CAbgyy4KFssIb/JNMLxFvKF1pCYCSXS8ZMuqZnMsrxqI2E5sPyoTpxoPU/gVZMzr2zjOfg8GIZOMsw== +csstype@^3.0.10, csstype@^3.0.2, csstype@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.2.tgz#1d4bf9d572f11c14031f0436e1c10bc1f571f50b" + integrity sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ== csv-stringify@^6.2.0: version "6.2.0" @@ -12296,13 +12311,6 @@ eslint-utils@^2.0.0, eslint-utils@^2.1.0: dependencies: eslint-visitor-keys "^1.1.0" -eslint-utils@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" - integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== - dependencies: - eslint-visitor-keys "^2.0.0" - eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" @@ -12313,10 +12321,10 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== -eslint-visitor-keys@^3.0.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" - integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== +eslint-visitor-keys@^3.3.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz#c7f0f956124ce677047ddbc192a68f999454dedc" + integrity sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ== eslint@7.25.0: version "7.25.0" @@ -14149,7 +14157,7 @@ globalthis@^1.0.0: function-bind "^1.1.1" object-keys "^1.0.12" -globby@*, globby@^11.0.0, globby@^11.0.1, globby@^11.0.2, globby@^11.0.3, globby@^11.0.4: +globby@*, globby@^11.0.0, globby@^11.0.1, globby@^11.0.2, globby@^11.0.3, globby@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==