eslint-plugin-primer-react 4.1.3-rc.8ad8f6b → 4.2.0-rc.18cd52a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # eslint-plugin-primer-react
2
2
 
3
- ## 4.1.3
3
+ ## 4.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#156](https://github.com/primer/eslint-plugin-primer-react/pull/156) [`15cfbb4`](https://github.com/primer/eslint-plugin-primer-react/commit/15cfbb4a261c44418404249cc33e279bce25b2b7) Thanks [@broccolinisoup](https://github.com/broccolinisoup)! - Add no-deprecated-props rule
4
8
 
5
9
  ### Patch Changes
6
10
 
package/README.md CHANGED
@@ -37,3 +37,4 @@ ESLint rules for Primer React
37
37
  - [a11y-tooltip-interactive-trigger](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-tooltip-interactive-trigger.md)
38
38
  - [a11y-explicit-heading](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-explicit-heading.md)
39
39
  - [new-css-color-vars](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/new-css-color-vars.md)
40
+ - [no-deprecated-props](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/no-deprecated-props.md)
@@ -0,0 +1,48 @@
1
+ ## Rule Details
2
+
3
+ This rule enforces to use the recommended API (`ActionList.GroupHeading`) component over the deprecated prop (`title` prop on `ActionList.Group`) for ActionList component.
4
+
5
+ 👎 Examples of **incorrect** code for this rule:
6
+
7
+ ```jsx
8
+ /* eslint primer-react/no-deprecated-props: "error" */
9
+ import {ActionList} from '@primer/react'
10
+
11
+ const App = () => (
12
+ <ActionList>
13
+ <ActionList.Group title="Group heading">
14
+ <ActionList.Item>Item 1</ActionList.Item>
15
+ </ActionList.Group>
16
+ </ActionList>
17
+ )
18
+ ```
19
+
20
+ 👍 Examples of **correct** code for this rule:
21
+
22
+ ```jsx
23
+ /* eslint primer-react/no-deprecated-props: "error" */
24
+ import {ActionList} from '@primer/react'
25
+
26
+ const App = () => (
27
+ <ActionList>
28
+ <ActionList.Group>
29
+ <ActionList.GroupHeading as="h2">Group heading</ActionList.GroupHeading>
30
+ <ActionList.Item>Item 1</ActionList.Item>
31
+ </ActionList.Group>
32
+ </ActionList>
33
+ )
34
+ ```
35
+
36
+ ```jsx
37
+ /* eslint primer-react/no-deprecated-props: "error" */
38
+ import {ActionList} from '@primer/react'
39
+
40
+ const App = () => (
41
+ <ActionList role="lisbox">
42
+ <ActionList.Group>
43
+ <ActionList.GroupHeading>Group heading</ActionList.GroupHeading>
44
+ <ActionList.Item>Item 1</ActionList.Item>
45
+ </ActionList.Group>
46
+ </ActionList>
47
+ )
48
+ ```
package/package-lock.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "eslint-plugin-github": "^4.10.1",
26
26
  "eslint-plugin-prettier": "^5.0.1",
27
27
  "jest": "^29.7.0",
28
- "markdownlint-cli2": "^0.12.1",
28
+ "markdownlint-cli2": "^0.13.0",
29
29
  "markdownlint-cli2-formatter-pretty": "^0.0.5"
30
30
  },
31
31
  "peerDependencies": {
@@ -1900,9 +1900,9 @@
1900
1900
  }
1901
1901
  },
1902
1902
  "node_modules/@primer/primitives": {
1903
- "version": "7.15.9",
1904
- "resolved": "https://registry.npmjs.org/@primer/primitives/-/primitives-7.15.9.tgz",
1905
- "integrity": "sha512-1dDNxokYV8sP2QDHMaAaEnRTxhYNBznf4QDTe4Gx9VzOXLexRvqrhvRitDbefbyfvO0yPr5TKI2nGCoz5T5zrQ==",
1903
+ "version": "7.15.15",
1904
+ "resolved": "https://registry.npmjs.org/@primer/primitives/-/primitives-7.15.15.tgz",
1905
+ "integrity": "sha512-K9fPgKVBtdmBMl+lHKUK4ctsRf+DUUKdJYEHnFhkua71m9FORK16ycJ4gHDpc4g/0xgNvEwQ9/ArsV1i8w3ZmQ==",
1906
1906
  "dev": true
1907
1907
  },
1908
1908
  "node_modules/@sinclair/typebox": {
@@ -1912,9 +1912,9 @@
1912
1912
  "dev": true
1913
1913
  },
1914
1914
  "node_modules/@sindresorhus/merge-streams": {
1915
- "version": "1.0.0",
1916
- "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-1.0.0.tgz",
1917
- "integrity": "sha512-rUV5WyJrJLoloD4NDN1V1+LDMDWOa4OTsT4yYJwQNpTU6FWxkxHpL7eu4w+DmiH8x/EAM1otkPE1+LaspIbplw==",
1915
+ "version": "2.3.0",
1916
+ "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz",
1917
+ "integrity": "sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==",
1918
1918
  "dev": true,
1919
1919
  "engines": {
1920
1920
  "node": ">=18"
@@ -5983,9 +5983,9 @@
5983
5983
  }
5984
5984
  },
5985
5985
  "node_modules/jsonc-parser": {
5986
- "version": "3.2.0",
5987
- "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz",
5988
- "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==",
5986
+ "version": "3.2.1",
5987
+ "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz",
5988
+ "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==",
5989
5989
  "dev": true
5990
5990
  },
5991
5991
  "node_modules/jsonfile": {
@@ -6209,9 +6209,9 @@
6209
6209
  }
6210
6210
  },
6211
6211
  "node_modules/markdown-it": {
6212
- "version": "14.0.0",
6213
- "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.0.0.tgz",
6214
- "integrity": "sha512-seFjF0FIcPt4P9U39Bq1JYblX0KZCjDLFFQPHpL5AzHpqPEKtosxmdq/LTVZnjfH7tjt9BxStm+wXcDBNuYmzw==",
6212
+ "version": "14.1.0",
6213
+ "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz",
6214
+ "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==",
6215
6215
  "dev": true,
6216
6216
  "dependencies": {
6217
6217
  "argparse": "^2.0.1",
@@ -6219,7 +6219,7 @@
6219
6219
  "linkify-it": "^5.0.0",
6220
6220
  "mdurl": "^2.0.0",
6221
6221
  "punycode.js": "^2.3.1",
6222
- "uc.micro": "^2.0.0"
6222
+ "uc.micro": "^2.1.0"
6223
6223
  },
6224
6224
  "bin": {
6225
6225
  "markdown-it": "bin/markdown-it.mjs"
@@ -6232,13 +6232,13 @@
6232
6232
  "dev": true
6233
6233
  },
6234
6234
  "node_modules/markdownlint": {
6235
- "version": "0.33.0",
6236
- "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.33.0.tgz",
6237
- "integrity": "sha512-4lbtT14A3m0LPX1WS/3d1m7Blg+ZwiLq36WvjQqFGsX3Gik99NV+VXp/PW3n+Q62xyPdbvGOCfjPqjW+/SKMig==",
6235
+ "version": "0.34.0",
6236
+ "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.34.0.tgz",
6237
+ "integrity": "sha512-qwGyuyKwjkEMOJ10XN6OTKNOVYvOIi35RNvDLNxTof5s8UmyGHlCdpngRHoRGNvQVGuxO3BJ7uNSgdeX166WXw==",
6238
6238
  "dev": true,
6239
6239
  "dependencies": {
6240
- "markdown-it": "14.0.0",
6241
- "markdownlint-micromark": "0.1.8"
6240
+ "markdown-it": "14.1.0",
6241
+ "markdownlint-micromark": "0.1.9"
6242
6242
  },
6243
6243
  "engines": {
6244
6244
  "node": ">=18"
@@ -6248,17 +6248,17 @@
6248
6248
  }
6249
6249
  },
6250
6250
  "node_modules/markdownlint-cli2": {
6251
- "version": "0.12.1",
6252
- "resolved": "https://registry.npmjs.org/markdownlint-cli2/-/markdownlint-cli2-0.12.1.tgz",
6253
- "integrity": "sha512-RcK+l5FjJEyrU3REhrThiEUXNK89dLYNJCYbvOUKypxqIGfkcgpz8g08EKqhrmUbYfYoLC5nEYQy53NhJSEtfQ==",
6251
+ "version": "0.13.0",
6252
+ "resolved": "https://registry.npmjs.org/markdownlint-cli2/-/markdownlint-cli2-0.13.0.tgz",
6253
+ "integrity": "sha512-Pg4nF7HlopU97ZXtrcVISWp3bdsuc5M0zXyLp2/sJv2zEMlInrau0ZKK482fQURzVezJzWBpNmu4u6vGAhij+g==",
6254
6254
  "dev": true,
6255
6255
  "dependencies": {
6256
- "globby": "14.0.0",
6257
- "jsonc-parser": "3.2.0",
6258
- "markdownlint": "0.33.0",
6256
+ "globby": "14.0.1",
6257
+ "js-yaml": "4.1.0",
6258
+ "jsonc-parser": "3.2.1",
6259
+ "markdownlint": "0.34.0",
6259
6260
  "markdownlint-cli2-formatter-default": "0.0.4",
6260
- "micromatch": "4.0.5",
6261
- "yaml": "2.3.4"
6261
+ "micromatch": "4.0.5"
6262
6262
  },
6263
6263
  "bin": {
6264
6264
  "markdownlint-cli2": "markdownlint-cli2.js"
@@ -6350,13 +6350,19 @@
6350
6350
  "url": "https://github.com/sponsors/sindresorhus"
6351
6351
  }
6352
6352
  },
6353
+ "node_modules/markdownlint-cli2/node_modules/argparse": {
6354
+ "version": "2.0.1",
6355
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
6356
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
6357
+ "dev": true
6358
+ },
6353
6359
  "node_modules/markdownlint-cli2/node_modules/globby": {
6354
- "version": "14.0.0",
6355
- "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.0.tgz",
6356
- "integrity": "sha512-/1WM/LNHRAOH9lZta77uGbq0dAEQM+XjNesWwhlERDVenqothRbnzTrL3/LrIoEPPjeUHC3vrS6TwoyxeHs7MQ==",
6360
+ "version": "14.0.1",
6361
+ "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.1.tgz",
6362
+ "integrity": "sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==",
6357
6363
  "dev": true,
6358
6364
  "dependencies": {
6359
- "@sindresorhus/merge-streams": "^1.0.0",
6365
+ "@sindresorhus/merge-streams": "^2.1.0",
6360
6366
  "fast-glob": "^3.3.2",
6361
6367
  "ignore": "^5.2.4",
6362
6368
  "path-type": "^5.0.0",
@@ -6370,6 +6376,18 @@
6370
6376
  "url": "https://github.com/sponsors/sindresorhus"
6371
6377
  }
6372
6378
  },
6379
+ "node_modules/markdownlint-cli2/node_modules/js-yaml": {
6380
+ "version": "4.1.0",
6381
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
6382
+ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
6383
+ "dev": true,
6384
+ "dependencies": {
6385
+ "argparse": "^2.0.1"
6386
+ },
6387
+ "bin": {
6388
+ "js-yaml": "bin/js-yaml.js"
6389
+ }
6390
+ },
6373
6391
  "node_modules/markdownlint-cli2/node_modules/path-type": {
6374
6392
  "version": "5.0.0",
6375
6393
  "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz",
@@ -6395,12 +6413,12 @@
6395
6413
  }
6396
6414
  },
6397
6415
  "node_modules/markdownlint-micromark": {
6398
- "version": "0.1.8",
6399
- "resolved": "https://registry.npmjs.org/markdownlint-micromark/-/markdownlint-micromark-0.1.8.tgz",
6400
- "integrity": "sha512-1ouYkMRo9/6gou9gObuMDnvZM8jC/ly3QCFQyoSPCS2XV1ZClU0xpKbL1Ar3bWWRT1RnBZkWUEiNKrI2CwiBQA==",
6416
+ "version": "0.1.9",
6417
+ "resolved": "https://registry.npmjs.org/markdownlint-micromark/-/markdownlint-micromark-0.1.9.tgz",
6418
+ "integrity": "sha512-5hVs/DzAFa8XqYosbEAEg6ok6MF2smDj89ztn9pKkCtdKHVdPQuGMH7frFfYL9mLkvfFe4pTyAMffLbjf3/EyA==",
6401
6419
  "dev": true,
6402
6420
  "engines": {
6403
- "node": ">=16"
6421
+ "node": ">=18"
6404
6422
  },
6405
6423
  "funding": {
6406
6424
  "url": "https://github.com/sponsors/DavidAnson"
@@ -8204,9 +8222,9 @@
8204
8222
  }
8205
8223
  },
8206
8224
  "node_modules/uc.micro": {
8207
- "version": "2.0.0",
8208
- "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.0.0.tgz",
8209
- "integrity": "sha512-DffL94LsNOccVn4hyfRe5rdKa273swqeA5DJpMOeFmEn1wCDc7nAbbB0gXlgBCL7TNzeTv6G7XVWzan7iJtfig==",
8225
+ "version": "2.1.0",
8226
+ "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz",
8227
+ "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==",
8210
8228
  "dev": true
8211
8229
  },
8212
8230
  "node_modules/unbox-primitive": {
@@ -8501,15 +8519,6 @@
8501
8519
  "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
8502
8520
  "dev": true
8503
8521
  },
8504
- "node_modules/yaml": {
8505
- "version": "2.3.4",
8506
- "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz",
8507
- "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==",
8508
- "dev": true,
8509
- "engines": {
8510
- "node": ">= 14"
8511
- }
8512
- },
8513
8522
  "node_modules/yargs": {
8514
8523
  "version": "17.7.2",
8515
8524
  "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
@@ -10051,9 +10060,9 @@
10051
10060
  "dev": true
10052
10061
  },
10053
10062
  "@primer/primitives": {
10054
- "version": "7.15.9",
10055
- "resolved": "https://registry.npmjs.org/@primer/primitives/-/primitives-7.15.9.tgz",
10056
- "integrity": "sha512-1dDNxokYV8sP2QDHMaAaEnRTxhYNBznf4QDTe4Gx9VzOXLexRvqrhvRitDbefbyfvO0yPr5TKI2nGCoz5T5zrQ==",
10063
+ "version": "7.15.15",
10064
+ "resolved": "https://registry.npmjs.org/@primer/primitives/-/primitives-7.15.15.tgz",
10065
+ "integrity": "sha512-K9fPgKVBtdmBMl+lHKUK4ctsRf+DUUKdJYEHnFhkua71m9FORK16ycJ4gHDpc4g/0xgNvEwQ9/ArsV1i8w3ZmQ==",
10057
10066
  "dev": true
10058
10067
  },
10059
10068
  "@sinclair/typebox": {
@@ -10063,9 +10072,9 @@
10063
10072
  "dev": true
10064
10073
  },
10065
10074
  "@sindresorhus/merge-streams": {
10066
- "version": "1.0.0",
10067
- "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-1.0.0.tgz",
10068
- "integrity": "sha512-rUV5WyJrJLoloD4NDN1V1+LDMDWOa4OTsT4yYJwQNpTU6FWxkxHpL7eu4w+DmiH8x/EAM1otkPE1+LaspIbplw==",
10075
+ "version": "2.3.0",
10076
+ "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz",
10077
+ "integrity": "sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==",
10069
10078
  "dev": true
10070
10079
  },
10071
10080
  "@sinonjs/commons": {
@@ -13065,9 +13074,9 @@
13065
13074
  "dev": true
13066
13075
  },
13067
13076
  "jsonc-parser": {
13068
- "version": "3.2.0",
13069
- "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz",
13070
- "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==",
13077
+ "version": "3.2.1",
13078
+ "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz",
13079
+ "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==",
13071
13080
  "dev": true
13072
13081
  },
13073
13082
  "jsonfile": {
@@ -13250,9 +13259,9 @@
13250
13259
  "dev": true
13251
13260
  },
13252
13261
  "markdown-it": {
13253
- "version": "14.0.0",
13254
- "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.0.0.tgz",
13255
- "integrity": "sha512-seFjF0FIcPt4P9U39Bq1JYblX0KZCjDLFFQPHpL5AzHpqPEKtosxmdq/LTVZnjfH7tjt9BxStm+wXcDBNuYmzw==",
13262
+ "version": "14.1.0",
13263
+ "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz",
13264
+ "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==",
13256
13265
  "dev": true,
13257
13266
  "requires": {
13258
13267
  "argparse": "^2.0.1",
@@ -13260,7 +13269,7 @@
13260
13269
  "linkify-it": "^5.0.0",
13261
13270
  "mdurl": "^2.0.0",
13262
13271
  "punycode.js": "^2.3.1",
13263
- "uc.micro": "^2.0.0"
13272
+ "uc.micro": "^2.1.0"
13264
13273
  },
13265
13274
  "dependencies": {
13266
13275
  "argparse": {
@@ -13272,36 +13281,42 @@
13272
13281
  }
13273
13282
  },
13274
13283
  "markdownlint": {
13275
- "version": "0.33.0",
13276
- "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.33.0.tgz",
13277
- "integrity": "sha512-4lbtT14A3m0LPX1WS/3d1m7Blg+ZwiLq36WvjQqFGsX3Gik99NV+VXp/PW3n+Q62xyPdbvGOCfjPqjW+/SKMig==",
13284
+ "version": "0.34.0",
13285
+ "resolved": "https://registry.npmjs.org/markdownlint/-/markdownlint-0.34.0.tgz",
13286
+ "integrity": "sha512-qwGyuyKwjkEMOJ10XN6OTKNOVYvOIi35RNvDLNxTof5s8UmyGHlCdpngRHoRGNvQVGuxO3BJ7uNSgdeX166WXw==",
13278
13287
  "dev": true,
13279
13288
  "requires": {
13280
- "markdown-it": "14.0.0",
13281
- "markdownlint-micromark": "0.1.8"
13289
+ "markdown-it": "14.1.0",
13290
+ "markdownlint-micromark": "0.1.9"
13282
13291
  }
13283
13292
  },
13284
13293
  "markdownlint-cli2": {
13285
- "version": "0.12.1",
13286
- "resolved": "https://registry.npmjs.org/markdownlint-cli2/-/markdownlint-cli2-0.12.1.tgz",
13287
- "integrity": "sha512-RcK+l5FjJEyrU3REhrThiEUXNK89dLYNJCYbvOUKypxqIGfkcgpz8g08EKqhrmUbYfYoLC5nEYQy53NhJSEtfQ==",
13294
+ "version": "0.13.0",
13295
+ "resolved": "https://registry.npmjs.org/markdownlint-cli2/-/markdownlint-cli2-0.13.0.tgz",
13296
+ "integrity": "sha512-Pg4nF7HlopU97ZXtrcVISWp3bdsuc5M0zXyLp2/sJv2zEMlInrau0ZKK482fQURzVezJzWBpNmu4u6vGAhij+g==",
13288
13297
  "dev": true,
13289
13298
  "requires": {
13290
- "globby": "14.0.0",
13291
- "jsonc-parser": "3.2.0",
13292
- "markdownlint": "0.33.0",
13299
+ "globby": "14.0.1",
13300
+ "js-yaml": "4.1.0",
13301
+ "jsonc-parser": "3.2.1",
13302
+ "markdownlint": "0.34.0",
13293
13303
  "markdownlint-cli2-formatter-default": "0.0.4",
13294
- "micromatch": "4.0.5",
13295
- "yaml": "2.3.4"
13304
+ "micromatch": "4.0.5"
13296
13305
  },
13297
13306
  "dependencies": {
13307
+ "argparse": {
13308
+ "version": "2.0.1",
13309
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
13310
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
13311
+ "dev": true
13312
+ },
13298
13313
  "globby": {
13299
- "version": "14.0.0",
13300
- "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.0.tgz",
13301
- "integrity": "sha512-/1WM/LNHRAOH9lZta77uGbq0dAEQM+XjNesWwhlERDVenqothRbnzTrL3/LrIoEPPjeUHC3vrS6TwoyxeHs7MQ==",
13314
+ "version": "14.0.1",
13315
+ "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.1.tgz",
13316
+ "integrity": "sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==",
13302
13317
  "dev": true,
13303
13318
  "requires": {
13304
- "@sindresorhus/merge-streams": "^1.0.0",
13319
+ "@sindresorhus/merge-streams": "^2.1.0",
13305
13320
  "fast-glob": "^3.3.2",
13306
13321
  "ignore": "^5.2.4",
13307
13322
  "path-type": "^5.0.0",
@@ -13309,6 +13324,15 @@
13309
13324
  "unicorn-magic": "^0.1.0"
13310
13325
  }
13311
13326
  },
13327
+ "js-yaml": {
13328
+ "version": "4.1.0",
13329
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
13330
+ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
13331
+ "dev": true,
13332
+ "requires": {
13333
+ "argparse": "^2.0.1"
13334
+ }
13335
+ },
13312
13336
  "path-type": {
13313
13337
  "version": "5.0.0",
13314
13338
  "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz",
@@ -13374,9 +13398,9 @@
13374
13398
  }
13375
13399
  },
13376
13400
  "markdownlint-micromark": {
13377
- "version": "0.1.8",
13378
- "resolved": "https://registry.npmjs.org/markdownlint-micromark/-/markdownlint-micromark-0.1.8.tgz",
13379
- "integrity": "sha512-1ouYkMRo9/6gou9gObuMDnvZM8jC/ly3QCFQyoSPCS2XV1ZClU0xpKbL1Ar3bWWRT1RnBZkWUEiNKrI2CwiBQA==",
13401
+ "version": "0.1.9",
13402
+ "resolved": "https://registry.npmjs.org/markdownlint-micromark/-/markdownlint-micromark-0.1.9.tgz",
13403
+ "integrity": "sha512-5hVs/DzAFa8XqYosbEAEg6ok6MF2smDj89ztn9pKkCtdKHVdPQuGMH7frFfYL9mLkvfFe4pTyAMffLbjf3/EyA==",
13380
13404
  "dev": true
13381
13405
  },
13382
13406
  "mdurl": {
@@ -14697,9 +14721,9 @@
14697
14721
  "peer": true
14698
14722
  },
14699
14723
  "uc.micro": {
14700
- "version": "2.0.0",
14701
- "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.0.0.tgz",
14702
- "integrity": "sha512-DffL94LsNOccVn4hyfRe5rdKa273swqeA5DJpMOeFmEn1wCDc7nAbbB0gXlgBCL7TNzeTv6G7XVWzan7iJtfig==",
14724
+ "version": "2.1.0",
14725
+ "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz",
14726
+ "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==",
14703
14727
  "dev": true
14704
14728
  },
14705
14729
  "unbox-primitive": {
@@ -14920,12 +14944,6 @@
14920
14944
  "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
14921
14945
  "dev": true
14922
14946
  },
14923
- "yaml": {
14924
- "version": "2.3.4",
14925
- "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz",
14926
- "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==",
14927
- "dev": true
14928
- },
14929
14947
  "yargs": {
14930
14948
  "version": "17.7.2",
14931
14949
  "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-primer-react",
3
- "version": "4.1.3-rc.8ad8f6b",
3
+ "version": "4.2.0-rc.18cd52a",
4
4
  "description": "ESLint rules for Primer React",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -45,7 +45,7 @@
45
45
  "eslint-plugin-github": "^4.10.1",
46
46
  "eslint-plugin-prettier": "^5.0.1",
47
47
  "jest": "^29.7.0",
48
- "markdownlint-cli2": "^0.12.1",
48
+ "markdownlint-cli2": "^0.13.0",
49
49
  "markdownlint-cli2-formatter-pretty": "^0.0.5"
50
50
  },
51
51
  "prettier": "@github/prettier-config"
@@ -17,6 +17,7 @@ module.exports = {
17
17
  'primer-react/new-color-css-vars': 'error',
18
18
  'primer-react/a11y-explicit-heading': 'error',
19
19
  'primer-react/new-color-css-vars-have-fallback': 'error',
20
+ 'primer-react/no-deprecated-props': 'warn',
20
21
  },
21
22
  settings: {
22
23
  github: {
package/src/index.js CHANGED
@@ -8,6 +8,7 @@ module.exports = {
8
8
  'new-color-css-vars': require('./rules/new-color-css-vars'),
9
9
  'a11y-explicit-heading': require('./rules/a11y-explicit-heading'),
10
10
  'new-color-css-vars-have-fallback': require('./rules/new-color-css-vars-have-fallback'),
11
+ 'no-deprecated-props': require('./rules/no-deprecated-props'),
11
12
  },
12
13
  configs: {
13
14
  recommended: require('./configs/recommended'),
@@ -0,0 +1,121 @@
1
+ 'use strict'
2
+
3
+ const {RuleTester} = require('eslint')
4
+ const rule = require('../no-deprecated-props')
5
+
6
+ const ruleTester = new RuleTester({
7
+ parserOptions: {
8
+ ecmaVersion: 'latest',
9
+ sourceType: 'module',
10
+ ecmaFeatures: {
11
+ jsx: true,
12
+ },
13
+ },
14
+ })
15
+
16
+ ruleTester.run('no-deprecated-props', rule, {
17
+ valid: [
18
+ `import {ActionList} from '@primer/react';
19
+ <ActionList>
20
+ <ActionList.Group>
21
+ <ActionList.GroupHeading as="h3">Group heading 1</ActionList.GroupHeading>
22
+ <ActionList.Item>Item</ActionList.Item>
23
+ </ActionList.Group>
24
+ <ActionList.Group>
25
+ <ActionList.GroupHeading as="h3">Group heading 2</ActionList.GroupHeading>
26
+ <ActionList.Item>Item 2</ActionList.Item>
27
+ </ActionList.Group>
28
+ </ActionList>`,
29
+ `import {ActionList} from '@primer/react';
30
+ <ActionList>
31
+ <ActionList.Group>
32
+ <ActionList.GroupHeading>Group heading 1</ActionList.GroupHeading>
33
+ <ActionList.Item>Item</ActionList.Item>
34
+ </ActionList.Group>
35
+ <ActionList.Group>
36
+ <ActionList.GroupHeading>Group heading 2</ActionList.GroupHeading>
37
+ <ActionList.Item>Item 2</ActionList.Item>
38
+ </ActionList.Group>
39
+ </ActionList>`,
40
+ `import {ActionList} from '@primer/react';
41
+ <ActionList>
42
+ <ActionList.Group>
43
+ <ActionList.GroupHeading as="h3">Group heading</ActionList.GroupHeading>
44
+ <ActionList.Item>Item</ActionList.Item>
45
+ </ActionList.Group>
46
+ <ActionList.Item>Item 2</ActionList.Item>
47
+ </ActionList>`,
48
+ `import {ActionList} from '@primer/react';
49
+ <ActionList role="listbox">
50
+ <ActionList.Group>
51
+ <ActionList.GroupHeading>Group heading</ActionList.GroupHeading>
52
+ <ActionList.Item>Item</ActionList.Item>
53
+ </ActionList.Group>
54
+ <ActionList.Item>Item 2</ActionList.Item>
55
+ </ActionList>`,
56
+ `import {ActionList} from '@primer/react';
57
+ <ActionList role="menu">
58
+ <ActionList.Item>Item</ActionList.Item>
59
+ <ActionList.Group>
60
+ <ActionList.GroupHeading>Group heading</ActionList.GroupHeading>
61
+ <ActionList.Item>Group item</ActionList.Item>
62
+ </ActionList.Group>
63
+ </ActionList>`,
64
+ ],
65
+ invalid: [
66
+ {
67
+ code: `<ActionList.Group title="Group heading 1"></ActionList.Group>`,
68
+ output: `<ActionList.Group><ActionList.GroupHeading>Group heading 1</ActionList.GroupHeading></ActionList.Group>`,
69
+ errors: [
70
+ {
71
+ messageId: 'titlePropDeprecated',
72
+ },
73
+ ],
74
+ },
75
+ {
76
+ code: `<ActionList.Group title="Group heading 1" sx={{padding: 2}}></ActionList.Group>`,
77
+ output: `<ActionList.Group sx={{padding: 2}}><ActionList.GroupHeading>Group heading 1</ActionList.GroupHeading></ActionList.Group>`,
78
+ errors: [
79
+ {
80
+ messageId: 'titlePropDeprecated',
81
+ },
82
+ ],
83
+ },
84
+ {
85
+ code: `<ActionList.Group variant="filled" title="Group heading 1"></ActionList.Group>`,
86
+ output: `<ActionList.Group variant="filled"><ActionList.GroupHeading>Group heading 1</ActionList.GroupHeading></ActionList.Group>`,
87
+ errors: [
88
+ {
89
+ messageId: 'titlePropDeprecated',
90
+ },
91
+ ],
92
+ },
93
+ {
94
+ code: `<ActionList.Group title={titleVariable}></ActionList.Group>`,
95
+ output: `<ActionList.Group><ActionList.GroupHeading>{titleVariable}</ActionList.GroupHeading></ActionList.Group>`,
96
+ errors: [
97
+ {
98
+ messageId: 'titlePropDeprecated',
99
+ },
100
+ ],
101
+ },
102
+ {
103
+ code: `<ActionList.Group title={'Title'}></ActionList.Group>`,
104
+ output: `<ActionList.Group><ActionList.GroupHeading>{'Title'}</ActionList.GroupHeading></ActionList.Group>`,
105
+ errors: [
106
+ {
107
+ messageId: 'titlePropDeprecated',
108
+ },
109
+ ],
110
+ },
111
+ {
112
+ code: `<ActionList.Group title={condition ? 'Title' : undefined}></ActionList.Group>`,
113
+ output: `<ActionList.Group><ActionList.GroupHeading>{condition ? 'Title' : undefined}</ActionList.GroupHeading></ActionList.Group>`,
114
+ errors: [
115
+ {
116
+ messageId: 'titlePropDeprecated',
117
+ },
118
+ ],
119
+ },
120
+ ],
121
+ })
@@ -0,0 +1,62 @@
1
+ 'use strict'
2
+ const {getJSXOpeningElementAttribute} = require('../utils/get-jsx-opening-element-attribute')
3
+ const {getJSXOpeningElementName} = require('../utils/get-jsx-opening-element-name')
4
+
5
+ /**
6
+ * @type {import('eslint').Rule.RuleModule}
7
+ */
8
+ module.exports = {
9
+ meta: {
10
+ type: 'suggestion',
11
+ docs: {
12
+ description:
13
+ 'Avoid using deprecated `title` prop on `ActionList.Group` component. Use `ActionList.GroupHeading` instead.',
14
+ recommended: true,
15
+ url: 'https://primer.style/components/action-list/react/beta#actionlistgroupheading',
16
+ },
17
+ fixable: 'code',
18
+ schema: [],
19
+ messages: {
20
+ titlePropDeprecated: 'The `title` prop is deprecated. Please use `ActionList.GroupHeading` instead.',
21
+ },
22
+ },
23
+ create(context) {
24
+ return {
25
+ JSXOpeningElement(node) {
26
+ const openingElName = getJSXOpeningElementName(node)
27
+ if (openingElName !== 'ActionList.Group') {
28
+ return
29
+ }
30
+ const title = getJSXOpeningElementAttribute(node, 'title')
31
+ let groupTitle = ''
32
+ if (title !== undefined) {
33
+ context.report({
34
+ node,
35
+ messageId: 'titlePropDeprecated',
36
+ fix(fixer) {
37
+ // Group title is a string literal i.e. title="title"
38
+ if (title.value.type === 'Literal') {
39
+ groupTitle = title.value.value
40
+ // Group title is a JSX expression i.e. title={title}
41
+ } else if (title.value.type === 'JSXExpressionContainer') {
42
+ groupTitle = context.sourceCode.getText(title.value)
43
+ } else {
44
+ // we don't provide fix for cases where the title prop is not a string literal or JSX expression
45
+ return []
46
+ }
47
+ const start = title.range[0]
48
+ const end = title.range[1]
49
+ return [
50
+ fixer.removeRange([start - 1, end]), // remove the space before the title as well
51
+ fixer.insertTextAfterRange(
52
+ [node.range[1], node.range[1]],
53
+ `<ActionList.GroupHeading>${groupTitle}</ActionList.GroupHeading>`,
54
+ ),
55
+ ]
56
+ },
57
+ })
58
+ }
59
+ },
60
+ }
61
+ },
62
+ }