eslint-plugin-primer-react 5.2.0 → 5.2.1-rc.61b0e36
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/package.json
CHANGED
|
@@ -115,6 +115,16 @@ ruleTester.run('a11y-link-in-text-block', rule, {
|
|
|
115
115
|
includes:
|
|
116
116
|
</Heading>
|
|
117
117
|
`,
|
|
118
|
+
`import {Link} from '@primer/react';
|
|
119
|
+
<p>bla blah
|
|
120
|
+
<Link className={styles.someClass}>Link text</Link>
|
|
121
|
+
</p>
|
|
122
|
+
`,
|
|
123
|
+
`import {Link} from '@primer/react';
|
|
124
|
+
<p>bla blah
|
|
125
|
+
<Link className='some-class'>Link text</Link>
|
|
126
|
+
</p>
|
|
127
|
+
`,
|
|
118
128
|
],
|
|
119
129
|
invalid: [
|
|
120
130
|
{
|
|
@@ -28,6 +28,10 @@ module.exports = {
|
|
|
28
28
|
name === 'Link' &&
|
|
29
29
|
node.parent.children
|
|
30
30
|
) {
|
|
31
|
+
// Skip if Link has className because we cannot deduce what styles are applied.
|
|
32
|
+
const classNameAttribute = getJSXOpeningElementAttribute(node.openingElement, 'className')
|
|
33
|
+
if (classNameAttribute) return
|
|
34
|
+
|
|
31
35
|
let siblings = node.parent.children
|
|
32
36
|
const parentName = node.parent.openingElement?.name?.name
|
|
33
37
|
// Skip if Link is nested inside of a heading.
|