From 338d2647d98dfdef53ee33912d951f3f7a85b851 Mon Sep 17 00:00:00 2001 From: ZeeshanTamboli Date: Mon, 9 Dec 2024 13:05:08 +0530 Subject: [PATCH 1/4] override jsx-a11y/control-has-associated-label config --- .eslintrc.js | 13 +++++++ package.json | 2 +- pnpm-lock.yaml | 100 +++++++++++++++++++++++++++++-------------------- 3 files changed, 73 insertions(+), 42 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index c716674a2f2128..eb382ea217a8f9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -5,6 +5,11 @@ */ const path = require('path'); +const a11yBase = require('eslint-config-airbnb/rules/react-a11y'); + +const controlHasAssociatedLabelConfig = a11yBase.rules['jsx-a11y/control-has-associated-label']; + +const controlHasAssociatedLabelOptions = typeof controlHasAssociatedLabelConfig[1] === 'object' ? controlHasAssociatedLabelConfig[1] : {}; const OneLevelImportMessage = [ 'Prefer one level nested imports to avoid bundling everything in dev mode or breaking CJS/ESM split.', @@ -158,6 +163,14 @@ module.exports = /** @type {Config} */ ({ ], // We are a library, we need to support it too 'jsx-a11y/no-autofocus': 'off', + // Remove when https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/959 gets fixed + 'jsx-a11y/control-has-associated-label': [ + 'error', + { + ...controlHasAssociatedLabelOptions, + ignoreElements: [...(controlHasAssociatedLabelOptions.ignoreElements || []), 'th', 'td'], + }, + ], 'material-ui/docgen-ignore-before-comment': 'error', 'material-ui/rules-of-use-theme-variants': 'error', diff --git a/package.json b/package.json index d62d49c7451ad8..cd20a38699da37 100644 --- a/package.json +++ b/package.json @@ -159,7 +159,7 @@ "eslint-plugin-babel": "^5.3.1", "eslint-plugin-filenames": "^1.3.2", "eslint-plugin-import": "^2.31.0", - "eslint-plugin-jsx-a11y": "6.7.1", + "eslint-plugin-jsx-a11y": "^6.10.2", "eslint-plugin-material-ui": "workspace:^", "eslint-plugin-mocha": "^10.5.0", "eslint-plugin-react": "^7.37.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index da2936362c3336..f3d35ed2e09f6d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -187,7 +187,7 @@ importers: version: 8.57.1 eslint-config-airbnb: specifier: ^19.0.4 - version: 19.0.4(eslint-plugin-import@2.31.0)(eslint-plugin-jsx-a11y@6.7.1(eslint@8.57.1))(eslint-plugin-react-hooks@5.0.0(eslint@8.57.1))(eslint-plugin-react@7.37.2(eslint@8.57.1))(eslint@8.57.1) + version: 19.0.4(eslint-plugin-import@2.31.0)(eslint-plugin-jsx-a11y@6.10.2(eslint@8.57.1))(eslint-plugin-react-hooks@5.0.0(eslint@8.57.1))(eslint-plugin-react@7.37.2(eslint@8.57.1))(eslint@8.57.1) eslint-config-airbnb-typescript: specifier: ^18.0.0 version: 18.0.0(@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.7.2))(eslint@8.57.1)(typescript@5.7.2))(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.7.2))(eslint-plugin-import@2.31.0)(eslint@8.57.1) @@ -207,8 +207,8 @@ importers: specifier: ^2.31.0 version: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.7.2))(eslint-import-resolver-webpack@0.13.9)(eslint@8.57.1) eslint-plugin-jsx-a11y: - specifier: 6.7.1 - version: 6.7.1(eslint@8.57.1) + specifier: ^6.10.2 + version: 6.10.2(eslint@8.57.1) eslint-plugin-material-ui: specifier: workspace:^ version: link:packages/eslint-plugin-material-ui @@ -6136,6 +6136,10 @@ packages: aria-query@5.3.0: resolution: {integrity: sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==} + aria-query@5.3.2: + resolution: {integrity: sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==} + engines: {node: '>= 0.4'} + array-buffer-byte-length@1.0.1: resolution: {integrity: sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==} engines: {node: '>= 0.4'} @@ -6223,8 +6227,8 @@ packages: resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} engines: {node: '>=12'} - ast-types-flow@0.0.7: - resolution: {integrity: sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag==} + ast-types-flow@0.0.8: + resolution: {integrity: sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ==} ast-types@0.14.2: resolution: {integrity: sha512-O0yuUDnZeQDL+ncNGlJ78BiO4jnYI3bvMsD5prT0/nsgijG/LpNBIr63gTjVTNsiGkgQhiyCShTgxt8oXOrklA==} @@ -6279,15 +6283,16 @@ packages: resolution: {integrity: sha512-x511uiJ/57FIsbgUe5csJ13k3uzu25uWQE+XqfBis/sB0SFoiElJWXRkgEAUh0U6n40eT3ay5Ue4oPkRMu1LYw==} engines: {node: '>= 10.0.0'} - axe-core@4.7.2: - resolution: {integrity: sha512-zIURGIS1E1Q4pcrMjp+nnEh+16G56eG/MUllJH8yEvw7asDo7Ac9uhC9KIH5jzpITueEZolfYglnCGIuSBz39g==} + axe-core@4.10.2: + resolution: {integrity: sha512-RE3mdQ7P3FRSe7eqCWoeQ/Z9QXrtniSjp1wUjt5nRC3WIpz5rSCve6o3fsZ2aCpJtrZjSZgjwXAoTO5k4tEI0w==} engines: {node: '>=4'} axios@1.7.7: resolution: {integrity: sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==} - axobject-query@3.2.1: - resolution: {integrity: sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==} + axobject-query@4.1.0: + resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==} + engines: {node: '>= 0.4'} babel-core@7.0.0-bridge.0: resolution: {integrity: sha512-poPX9mZH/5CSanm50Q+1toVci6pv5KSRv/5TWCwtzQS5XEwn40BcCrgIeMFWP9CKKIniKXNxoIOnOq4VVlGXhg==} @@ -7784,11 +7789,11 @@ packages: '@typescript-eslint/parser': optional: true - eslint-plugin-jsx-a11y@6.7.1: - resolution: {integrity: sha512-63Bog4iIethyo8smBklORknVjB0T2dwB8Mr/hIC+fBS0uyHdYYpzM/Ed+YC8VxTjlXHEWFOdmgwcDn1U2L9VCA==} + eslint-plugin-jsx-a11y@6.10.2: + resolution: {integrity: sha512-scB3nz4WmG75pV8+3eRUQOHZlNSUhFNq37xnpgRkCCELU3XMvXAxLk1eqWWyE22Ki4Q01Fnsw9BA3cJHDPgn2Q==} engines: {node: '>=4.0'} peerDependencies: - eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 + eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9 eslint-plugin-mocha@10.5.0: resolution: {integrity: sha512-F2ALmQVPT1GoP27O1JTZGrV9Pqg8k79OeIuvw63UxMtQKREZtmkK1NFgkZQ2TW7L2JSSFKHFPTtHu5z8R9QNRw==} @@ -8480,10 +8485,6 @@ packages: has-unicode@2.0.1: resolution: {integrity: sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==} - has@1.0.3: - resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==} - engines: {node: '>= 0.4.0'} - hash-base@3.0.4: resolution: {integrity: sha512-EeeoJKjTyt868liAlVmcv2ZsUfGHlE3Q+BICOXcZiwN3osr5Q/zFGYmTJpoIzuaSTAwndFy+GqhEwlU4L3j4Ow==} engines: {node: '>=4'} @@ -9298,6 +9299,10 @@ packages: resolution: {integrity: sha512-fYQHZTZ8jSfmWZ0iyzfwiU4WDX4HpHbMCZ3gPlWYiCl3BoeOTsqKBqnTVfH2rYT7eP5c3sVbeSPHnnJOaTrWiw==} engines: {node: '>=4.0'} + jsx-ast-utils@3.3.5: + resolution: {integrity: sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==} + engines: {node: '>=4.0'} + jszip@3.10.1: resolution: {integrity: sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==} @@ -9380,8 +9385,9 @@ packages: language-subtag-registry@0.3.22: resolution: {integrity: sha512-tN0MCzyWnoz/4nHS6uxdlFWoUZT7ABptwKPQ52Ea7URk6vll88bWBVhodtnlfEuCcKWNGoc+uGbw1cwa9IKh/w==} - language-tags@1.0.5: - resolution: {integrity: sha512-qJhlO9cGXi6hBGKoxEG/sKZDAHD5Hnu9Hs4WbOY3pCWXDhw0N8x1NenNzm2EnNLkLkk7J2SdxAkDSbb6ftT+UQ==} + language-tags@1.0.9: + resolution: {integrity: sha512-MbjN408fEndfiQXbFQ1vnd+1NoLDsnQW41410oQBXiyXDMYH5z505juWa4KUE1LqxRC7DgOgZDbKLxHIwm27hA==} + engines: {node: '>=0.10'} lazystream@1.0.1: resolution: {integrity: sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==} @@ -12024,6 +12030,10 @@ packages: resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} engines: {node: '>=12'} + string.prototype.includes@2.0.1: + resolution: {integrity: sha512-o7+c9bW6zpAdJHTtujeePODAhkuicdAryFsfVKwA+wGw89wJ4GTY484WTucM9hLtDEOpOvI+aHnzqnC5lHp4Rg==} + engines: {node: '>= 0.4'} + string.prototype.matchall@4.0.11: resolution: {integrity: sha512-NUdh0aDavY2og7IbBPenWqR9exH+E26Sv8e0/eTe1tltDGZL+GtBkDAnnyBtmekfK6/Dq3MkcGtzXFEd1LQrtg==} engines: {node: '>= 0.4'} @@ -17743,6 +17753,8 @@ snapshots: dependencies: dequal: 2.0.3 + aria-query@5.3.2: {} + array-buffer-byte-length@1.0.1: dependencies: call-bind: 1.0.7 @@ -17856,7 +17868,7 @@ snapshots: assertion-error@2.0.1: {} - ast-types-flow@0.0.7: {} + ast-types-flow@0.0.8: {} ast-types@0.14.2: dependencies: @@ -17919,7 +17931,7 @@ snapshots: uuid: 8.0.0 xml2js: 0.6.2 - axe-core@4.7.2: {} + axe-core@4.10.2: {} axios@1.7.7(debug@4.3.7): dependencies: @@ -17929,9 +17941,7 @@ snapshots: transitivePeerDependencies: - debug - axobject-query@3.2.1: - dependencies: - dequal: 2.0.3 + axobject-query@4.1.0: {} babel-core@7.0.0-bridge.0(@babel/core@7.26.0): dependencies: @@ -19654,12 +19664,12 @@ snapshots: transitivePeerDependencies: - eslint-plugin-import - eslint-config-airbnb@19.0.4(eslint-plugin-import@2.31.0)(eslint-plugin-jsx-a11y@6.7.1(eslint@8.57.1))(eslint-plugin-react-hooks@5.0.0(eslint@8.57.1))(eslint-plugin-react@7.37.2(eslint@8.57.1))(eslint@8.57.1): + eslint-config-airbnb@19.0.4(eslint-plugin-import@2.31.0)(eslint-plugin-jsx-a11y@6.10.2(eslint@8.57.1))(eslint-plugin-react-hooks@5.0.0(eslint@8.57.1))(eslint-plugin-react@7.37.2(eslint@8.57.1))(eslint@8.57.1): dependencies: eslint: 8.57.1 eslint-config-airbnb-base: 15.0.0(eslint-plugin-import@2.31.0)(eslint@8.57.1) eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.7.2))(eslint-import-resolver-webpack@0.13.9)(eslint@8.57.1) - eslint-plugin-jsx-a11y: 6.7.1(eslint@8.57.1) + eslint-plugin-jsx-a11y: 6.10.2(eslint@8.57.1) eslint-plugin-react: 7.37.2(eslint@8.57.1) eslint-plugin-react-hooks: 5.0.0(eslint@8.57.1) object.assign: 4.1.5 @@ -19747,25 +19757,24 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-plugin-jsx-a11y@6.7.1(eslint@8.57.1): + eslint-plugin-jsx-a11y@6.10.2(eslint@8.57.1): dependencies: - '@babel/runtime': 7.26.0 - aria-query: 5.3.0 + aria-query: 5.3.2 array-includes: 3.1.8 array.prototype.flatmap: 1.3.2 - ast-types-flow: 0.0.7 - axe-core: 4.7.2 - axobject-query: 3.2.1 + ast-types-flow: 0.0.8 + axe-core: 4.10.2 + axobject-query: 4.1.0 damerau-levenshtein: 1.0.8 emoji-regex: 9.2.2 eslint: 8.57.1 - has: 1.0.3 - jsx-ast-utils: 3.3.3 - language-tags: 1.0.5 + hasown: 2.0.2 + jsx-ast-utils: 3.3.5 + language-tags: 1.0.9 minimatch: 3.1.2 - object.entries: 1.1.8 object.fromentries: 2.0.8 - semver: 6.3.1 + safe-regex-test: 1.0.3 + string.prototype.includes: 2.0.1 eslint-plugin-mocha@10.5.0(eslint@8.57.1): dependencies: @@ -20698,10 +20707,6 @@ snapshots: has-unicode@2.0.1: {} - has@1.0.3: - dependencies: - function-bind: 1.1.2 - hash-base@3.0.4: dependencies: inherits: 2.0.4 @@ -21639,6 +21644,13 @@ snapshots: array-includes: 3.1.8 object.assign: 4.1.5 + jsx-ast-utils@3.3.5: + dependencies: + array-includes: 3.1.8 + array.prototype.flat: 1.3.2 + object.assign: 4.1.5 + object.values: 1.2.0 + jszip@3.10.1: dependencies: lie: 3.3.0 @@ -21767,7 +21779,7 @@ snapshots: language-subtag-registry@0.3.22: {} - language-tags@1.0.5: + language-tags@1.0.9: dependencies: language-subtag-registry: 0.3.22 @@ -25068,6 +25080,12 @@ snapshots: emoji-regex: 9.2.2 strip-ansi: 7.0.1 + string.prototype.includes@2.0.1: + dependencies: + call-bind: 1.0.7 + define-properties: 1.2.1 + es-abstract: 1.23.3 + string.prototype.matchall@4.0.11: dependencies: call-bind: 1.0.7 From 5112ce55ab2b9b802e60ad39a82eb7005267e4c1 Mon Sep 17 00:00:00 2001 From: ZeeshanTamboli Date: Mon, 9 Dec 2024 13:05:22 +0530 Subject: [PATCH 2/4] prettier --- .eslintrc.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index eb382ea217a8f9..e1bb16f5323d75 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -9,7 +9,8 @@ const a11yBase = require('eslint-config-airbnb/rules/react-a11y'); const controlHasAssociatedLabelConfig = a11yBase.rules['jsx-a11y/control-has-associated-label']; -const controlHasAssociatedLabelOptions = typeof controlHasAssociatedLabelConfig[1] === 'object' ? controlHasAssociatedLabelConfig[1] : {}; +const controlHasAssociatedLabelOptions = + typeof controlHasAssociatedLabelConfig[1] === 'object' ? controlHasAssociatedLabelConfig[1] : {}; const OneLevelImportMessage = [ 'Prefer one level nested imports to avoid bundling everything in dev mode or breaking CJS/ESM split.', From bff7664fa733256652f0ddec387cce786025127b Mon Sep 17 00:00:00 2001 From: ZeeshanTamboli Date: Mon, 9 Dec 2024 13:17:46 +0530 Subject: [PATCH 3/4] pnpm dedupe --- pnpm-lock.yaml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f3d35ed2e09f6d..05ec1b26247c3c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9295,10 +9295,6 @@ packages: jss@10.10.0: resolution: {integrity: sha512-cqsOTS7jqPsPMjtKYDUpdFC0AbhYFLTcuGRqymgmdJIeQ8cH7+AgX7YSgQy79wXloZq2VvATYxUOUQEvS1V/Zw==} - jsx-ast-utils@3.3.3: - resolution: {integrity: sha512-fYQHZTZ8jSfmWZ0iyzfwiU4WDX4HpHbMCZ3gPlWYiCl3BoeOTsqKBqnTVfH2rYT7eP5c3sVbeSPHnnJOaTrWiw==} - engines: {node: '>=4.0'} - jsx-ast-utils@3.3.5: resolution: {integrity: sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==} engines: {node: '>=4.0'} @@ -19810,7 +19806,7 @@ snapshots: eslint: 8.57.1 estraverse: 5.3.0 hasown: 2.0.2 - jsx-ast-utils: 3.3.3 + jsx-ast-utils: 3.3.5 minimatch: 3.1.2 object.entries: 1.1.8 object.fromentries: 2.0.8 @@ -21639,11 +21635,6 @@ snapshots: is-in-browser: 1.1.3 tiny-warning: 1.0.3 - jsx-ast-utils@3.3.3: - dependencies: - array-includes: 3.1.8 - object.assign: 4.1.5 - jsx-ast-utils@3.3.5: dependencies: array-includes: 3.1.8 From ba36f180efadba8cf57c8f14cb34528d292e1674 Mon Sep 17 00:00:00 2001 From: Zeeshan Tamboli Date: Mon, 16 Dec 2024 14:26:08 +0530 Subject: [PATCH 4/4] Update .eslintrc.js Co-authored-by: Jose C Quintas Jr Signed-off-by: Zeeshan Tamboli --- .eslintrc.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index e1bb16f5323d75..9b799bd1650641 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -164,7 +164,9 @@ module.exports = /** @type {Config} */ ({ ], // We are a library, we need to support it too 'jsx-a11y/no-autofocus': 'off', - // Remove when https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/959 gets fixed + // Remove when issues are fixed + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/959 + // https://github.com/airbnb/javascript/issues/3069 'jsx-a11y/control-has-associated-label': [ 'error', {