eslint-plugin-primer-react 7.0.0-rc.0a66f81 → 7.0.0-rc.0d4a60c

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
@@ -12,6 +12,10 @@
12
12
 
13
13
  - [#258](https://github.com/primer/eslint-plugin-primer-react/pull/258) [`83f29f3`](https://github.com/primer/eslint-plugin-primer-react/commit/83f29f339999b9c21d95167bcc2680c1797cbab6) Thanks [@keithamus](https://github.com/keithamus)! - Add enforce-css-module-identifier-casing rule
14
14
 
15
+ ### Patch Changes
16
+
17
+ - [#314](https://github.com/primer/eslint-plugin-primer-react/pull/314) [`63ef9fd`](https://github.com/primer/eslint-plugin-primer-react/commit/63ef9fdf02a9c4b80528644a96fd81e366bce187) Thanks [@khiga8](https://github.com/khiga8)! - fix: Link to should be allowed to have tooltip
18
+
15
19
  ## 6.1.6
16
20
 
17
21
  ### Patch Changes
package/package-lock.json CHANGED
@@ -3933,9 +3933,10 @@
3933
3933
  }
3934
3934
  },
3935
3935
  "node_modules/eslint-plugin-prettier": {
3936
- "version": "5.2.1",
3937
- "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz",
3938
- "integrity": "sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==",
3936
+ "version": "5.2.3",
3937
+ "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.3.tgz",
3938
+ "integrity": "sha512-qJ+y0FfCp/mQYQ/vWQ3s7eUlFEL4PyKfAJxsnYTJ4YT73nsJBWqmEpFryxV9OeUiqmsTsYJ5Y+KDNaeP31wrRw==",
3939
+ "license": "MIT",
3939
3940
  "dependencies": {
3940
3941
  "prettier-linter-helpers": "^1.0.0",
3941
3942
  "synckit": "^0.9.1"
@@ -11509,9 +11510,9 @@
11509
11510
  "integrity": "sha512-Lf4YW/bL6Un1R6A76pRZyE1dl1vr31G/ev8UzIc/geCgFWyrKil8hVjYqWVKGB/UIGmb6Slzs9T0wNezdSVegw=="
11510
11511
  },
11511
11512
  "eslint-plugin-prettier": {
11512
- "version": "5.2.1",
11513
- "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz",
11514
- "integrity": "sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==",
11513
+ "version": "5.2.3",
11514
+ "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.3.tgz",
11515
+ "integrity": "sha512-qJ+y0FfCp/mQYQ/vWQ3s7eUlFEL4PyKfAJxsnYTJ4YT73nsJBWqmEpFryxV9OeUiqmsTsYJ5Y+KDNaeP31wrRw==",
11515
11516
  "requires": {
11516
11517
  "prettier-linter-helpers": "^1.0.0",
11517
11518
  "synckit": "^0.9.1"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-primer-react",
3
- "version": "7.0.0-rc.0a66f81",
3
+ "version": "7.0.0-rc.0d4a60c",
4
4
  "description": "ESLint rules for Primer React",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -67,6 +67,22 @@ ruleTester.run('non-interactive-tooltip-trigger', rule, {
67
67
  </Link>
68
68
  </Tooltip>
69
69
  `,
70
+ `
71
+ import {Tooltip, Link} from '@primer/react';
72
+ <Tooltip aria-label="product" direction="e">
73
+ <Link to={productLink}>
74
+ Product
75
+ </Link>
76
+ </Tooltip>
77
+ `,
78
+ `
79
+ import {Tooltip, Link} from '@primer/react';
80
+ <Tooltip aria-label="product" direction="e">
81
+ <Link to="https://github.com">
82
+ Product
83
+ </Link>
84
+ </Tooltip>
85
+ `,
70
86
  ],
71
87
  invalid: [
72
88
  {
@@ -23,7 +23,7 @@ const isAnchorTag = el => {
23
23
  }
24
24
 
25
25
  const isJSXValue = attributes => {
26
- const node = attributes.find(attribute => propName(attribute) === 'href')
26
+ const node = attributes.find(attribute => propName(attribute) === 'href' || propName(attribute))
27
27
  const isJSXExpression = node.value.type === 'JSXExpressionContainer' && node && typeof getPropValue(node) === 'string'
28
28
 
29
29
  return isJSXExpression
@@ -31,8 +31,14 @@ const isJSXValue = attributes => {
31
31
 
32
32
  const isInteractiveAnchor = child => {
33
33
  const hasHref = getJSXOpeningElementAttribute(child.openingElement, 'href')
34
- if (!hasHref) return false
35
- const href = getJSXOpeningElementAttribute(child.openingElement, 'href').value.value
34
+ const hasTo = getJSXOpeningElementAttribute(child.openingElement, 'to')
35
+
36
+ if (!hasHref && !hasTo) return false
37
+
38
+ const href = hasHref
39
+ ? getJSXOpeningElementAttribute(child.openingElement, 'href').value.value
40
+ : getJSXOpeningElementAttribute(child.openingElement, 'to').value.value
41
+
36
42
  const hasJSXValue = isJSXValue(child.openingElement.attributes)
37
43
  const isAnchorInteractive = (typeof href === 'string' && href !== '') || hasJSXValue
38
44