File tree Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 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+ ```
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ module.exports = {
1717 'primer-react/new-color-css-vars' : 'error' ,
1818 'primer-react/a11y-explicit-heading' : 'error' ,
1919 'primer-react/new-color-css-vars-have-fallback' : 'error' ,
20+ 'primer-react/no-deprecated-props' : 'warn' ,
2021 } ,
2122 settings : {
2223 github : {
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ module.exports = {
88 'new-color-css-vars' : require ( './rules/new-color-css-vars' ) ,
99 'a11y-explicit-heading' : require ( './rules/a11y-explicit-heading' ) ,
1010 'new-color-css-vars-have-fallback' : require ( './rules/new-color-css-vars-have-fallback' ) ,
11+ 'no-deprecated-props' : require ( './rules/no-deprecated-props' ) ,
1112 } ,
1213 configs : {
1314 recommended : require ( './configs/recommended' ) ,
You can’t perform that action at this time.
0 commit comments