eslint-plugin-primer-react 6.1.1 → 6.1.2-rc.b701a6b

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-primer-react",
3
- "version": "6.1.1",
3
+ "version": "6.1.2-rc.b701a6b",
4
4
  "description": "ESLint rules for Primer React",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -71,13 +71,13 @@ ruleTester.run('no-wildcard-imports', rule, {
71
71
 
72
72
  // Test default import
73
73
  {
74
- code: `import useIsomorphicLayoutEffect from '@primer/react/lib-esm/useIsomorphicLayoutEffect'`,
74
+ code: `import useIsomorphicLayoutEffect from '@primer/react/lib-esm/utils/useIsomorphicLayoutEffect'`,
75
75
  output: `import {useIsomorphicLayoutEffect} from '@primer/react'`,
76
76
  errors: [
77
77
  {
78
78
  messageId: 'wildcardMigration',
79
79
  data: {
80
- wildcardEntrypoint: '@primer/react/lib-esm/useIsomorphicLayoutEffect',
80
+ wildcardEntrypoint: '@primer/react/lib-esm/utils/useIsomorphicLayoutEffect',
81
81
  },
82
82
  },
83
83
  ],
@@ -85,8 +85,8 @@ ruleTester.run('no-wildcard-imports', rule, {
85
85
 
86
86
  // Test multiple wildcard imports into single entrypoint
87
87
  {
88
- code: `import useResizeObserver from '@primer/react/lib-esm/hooks/useResizeObserver'
89
- import useIsomorphicLayoutEffect from '@primer/react/lib-esm/useIsomorphicLayoutEffect'`,
88
+ code: `import {useResizeObserver} from '@primer/react/lib-esm/hooks/useResizeObserver'
89
+ import useIsomorphicLayoutEffect from '@primer/react/lib-esm/utils/useIsomorphicLayoutEffect'`,
90
90
  output: `import {useResizeObserver} from '@primer/react'
91
91
  import {useIsomorphicLayoutEffect} from '@primer/react'`,
92
92
  errors: [
@@ -99,7 +99,21 @@ ruleTester.run('no-wildcard-imports', rule, {
99
99
  {
100
100
  messageId: 'wildcardMigration',
101
101
  data: {
102
- wildcardEntrypoint: '@primer/react/lib-esm/useIsomorphicLayoutEffect',
102
+ wildcardEntrypoint: '@primer/react/lib-esm/utils/useIsomorphicLayoutEffect',
103
+ },
104
+ },
105
+ ],
106
+ },
107
+
108
+ // Test renamed wildcard imports
109
+ {
110
+ code: `import type {ItemProps} from '@primer/react/lib-esm/deprecated/ActionList/Item'`,
111
+ output: `import type {ActionListItemProps as ItemProps} from '@primer/react/deprecated'`,
112
+ errors: [
113
+ {
114
+ messageId: 'wildcardMigration',
115
+ data: {
116
+ wildcardEntrypoint: '@primer/react/lib-esm/deprecated/ActionList/Item',
103
117
  },
104
118
  },
105
119
  ],
@@ -154,7 +168,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
154
168
  },
155
169
  {
156
170
  code: `import {SelectPanel} from '@primer/react/lib-esm/SelectPanel/SelectPanel'`,
157
- output: `import {SelectPanel} from '@primer/react/experimental'`,
171
+ output: `import {SelectPanel} from '@primer/react'`,
158
172
  errors: [
159
173
  {
160
174
  messageId: 'wildcardMigration',
@@ -166,7 +180,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
166
180
  },
167
181
  {
168
182
  code: `import type {SelectPanelProps} from '@primer/react/lib-esm/SelectPanel/SelectPanel'`,
169
- output: `import type {SelectPanelProps} from '@primer/react/experimental'`,
183
+ output: `import type {SelectPanelProps} from '@primer/react'`,
170
184
  errors: [
171
185
  {
172
186
  messageId: 'wildcardMigration',
@@ -226,7 +240,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
226
240
  },
227
241
  {
228
242
  code: `import type {ItemProps} from '@primer/react/lib-esm/deprecated/ActionList'`,
229
- output: `import type {ActionListItemProps} from '@primer/react/deprecated'`,
243
+ output: `import type {ActionListItemProps as ItemProps} from '@primer/react/deprecated'`,
230
244
  errors: [
231
245
  {
232
246
  messageId: 'wildcardMigration',
@@ -238,7 +252,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
238
252
  },
239
253
  {
240
254
  code: `import type {GroupedListProps} from '@primer/react/lib-esm/deprecated/ActionList/List'`,
241
- output: `import type {ActionListGroupedListProps} from '@primer/react/deprecated'`,
255
+ output: `import type {ActionListGroupedListProps as GroupedListProps} from '@primer/react/deprecated'`,
242
256
  errors: [
243
257
  {
244
258
  messageId: 'wildcardMigration',
@@ -250,7 +264,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
250
264
  },
251
265
  {
252
266
  code: `import {ItemInput} from '@primer/react/lib-esm/deprecated/ActionList/List'`,
253
- output: `import {ActionListItemInput} from '@primer/react/deprecated'`,
267
+ output: `import {ActionListItemInput as ItemInput} from '@primer/react/deprecated'`,
254
268
  errors: [
255
269
  {
256
270
  messageId: 'wildcardMigration',
@@ -262,7 +276,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
262
276
  },
263
277
  {
264
278
  code: `import type {ItemProps} from '@primer/react/lib-esm/deprecated/ActionList/Item'`,
265
- output: `import type {ActionListItemProps} from '@primer/react/deprecated'`,
279
+ output: `import type {ActionListItemProps as ItemProps} from '@primer/react/deprecated'`,
266
280
  errors: [
267
281
  {
268
282
  messageId: 'wildcardMigration',
@@ -277,13 +291,13 @@ import type {ButtonBaseProps} from '@primer/react'`,
277
291
 
278
292
  // @primer/react/lib-esm/useIsomorphicLayoutEffect
279
293
  {
280
- code: `import useIsomorphicLayoutEffect from '@primer/react/lib-esm/useIsomorphicLayoutEffect'`,
294
+ code: `import useIsomorphicLayoutEffect from '@primer/react/lib-esm/utils/useIsomorphicLayoutEffect'`,
281
295
  output: `import {useIsomorphicLayoutEffect} from '@primer/react'`,
282
296
  errors: [
283
297
  {
284
298
  messageId: 'wildcardMigration',
285
299
  data: {
286
- wildcardEntrypoint: '@primer/react/lib-esm/useIsomorphicLayoutEffect',
300
+ wildcardEntrypoint: '@primer/react/lib-esm/utils/useIsomorphicLayoutEffect',
287
301
  },
288
302
  },
289
303
  ],
@@ -291,7 +305,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
291
305
 
292
306
  // @primer/react/lib-esm/hooks/useResizeObserver
293
307
  {
294
- code: `import useResizeObserver from '@primer/react/lib-esm/hooks/useResizeObserver'`,
308
+ code: `import {useResizeObserver} from '@primer/react/lib-esm/hooks/useResizeObserver'`,
295
309
  output: `import {useResizeObserver} from '@primer/react'`,
296
310
  errors: [
297
311
  {
@@ -305,7 +319,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
305
319
 
306
320
  // @primer/react/lib-esm/hooks/useProvidedRefOrCreate
307
321
  {
308
- code: `import useProvidedRefOrCreate from '@primer/react/lib-esm/hooks/useProvidedRefOrCreate'`,
322
+ code: `import {useProvidedRefOrCreate} from '@primer/react/lib-esm/hooks/useProvidedRefOrCreate'`,
309
323
  output: `import {useProvidedRefOrCreate} from '@primer/react'`,
310
324
  errors: [
311
325
  {
@@ -319,7 +333,7 @@ import type {ButtonBaseProps} from '@primer/react'`,
319
333
 
320
334
  // @primer/react/lib-esm/hooks/useResponsiveValue
321
335
  {
322
- code: `import useResponsiveValue from '@primer/react/lib-esm/hooks/useResponsiveValue'`,
336
+ code: `import {useResponsiveValue} from '@primer/react/lib-esm/hooks/useResponsiveValue'`,
323
337
  output: `import {useResponsiveValue} from '@primer/react'`,
324
338
  errors: [
325
339
  {
@@ -35,6 +35,11 @@ const wildcardImports = new Map([
35
35
  name: 'Dialog',
36
36
  from: '@primer/react/experimental',
37
37
  },
38
+ {
39
+ name: 'DialogHeaderProps',
40
+ from: '@primer/react/experimental',
41
+ type: 'type',
42
+ },
38
43
  ],
39
44
  ],
40
45
  [
@@ -42,12 +47,12 @@ const wildcardImports = new Map([
42
47
  [
43
48
  {
44
49
  name: 'SelectPanel',
45
- from: '@primer/react/experimental',
50
+ from: '@primer/react',
46
51
  },
47
52
  {
48
53
  type: 'type',
49
54
  name: 'SelectPanelProps',
50
- from: '@primer/react/experimental',
55
+ from: '@primer/react',
51
56
  },
52
57
  ],
53
58
  ],
@@ -132,7 +137,7 @@ const wildcardImports = new Map([
132
137
 
133
138
  // Hooks
134
139
  [
135
- '@primer/react/lib-esm/useIsomorphicLayoutEffect',
140
+ '@primer/react/lib-esm/utils/useIsomorphicLayoutEffect',
136
141
  [
137
142
  {
138
143
  name: 'default',
@@ -145,9 +150,8 @@ const wildcardImports = new Map([
145
150
  '@primer/react/lib-esm/hooks/useResizeObserver',
146
151
  [
147
152
  {
148
- name: 'default',
153
+ name: 'useResizeObserver',
149
154
  from: '@primer/react',
150
- as: 'useResizeObserver',
151
155
  },
152
156
  ],
153
157
  ],
@@ -155,9 +159,8 @@ const wildcardImports = new Map([
155
159
  '@primer/react/lib-esm/hooks/useProvidedRefOrCreate',
156
160
  [
157
161
  {
158
- name: 'default',
162
+ name: 'useProvidedRefOrCreate',
159
163
  from: '@primer/react',
160
- as: 'useProvidedRefOrCreate',
161
164
  },
162
165
  ],
163
166
  ],
@@ -165,9 +168,8 @@ const wildcardImports = new Map([
165
168
  '@primer/react/lib-esm/hooks/useResponsiveValue',
166
169
  [
167
170
  {
168
- name: 'default',
171
+ name: 'useResponsiveValue',
169
172
  from: '@primer/react',
170
- as: 'useResponsiveValue',
171
173
  },
172
174
  ],
173
175
  ],
@@ -282,7 +284,7 @@ module.exports = {
282
284
  }
283
285
 
284
286
  if (migration.as) {
285
- changes.get(migration.from).push([migration.as, migration.as, migration.type])
287
+ changes.get(migration.from).push([migration.as, specifier.local.name, migration.type])
286
288
  } else {
287
289
  changes.get(migration.from).push([migration.name, specifier.local.name, migration.type])
288
290
  }
@@ -357,7 +359,7 @@ module.exports = {
357
359
  }
358
360
  return imported
359
361
  })
360
- yield fixer.insertTextAfter(node, `import type {${specifiers.join(', ')}} from '${entrypoint}'`)
362
+ yield fixer.insertTextAfter(node, `\nimport type {${specifiers.join(', ')}} from '${entrypoint}'`)
361
363
  }
362
364
  }
363
365
  },
@@ -7,22 +7,50 @@ const components = [
7
7
  identifier: 'Dialog',
8
8
  entrypoint: '@primer/react',
9
9
  },
10
+ {
11
+ identifier: 'DialogProps',
12
+ entrypoint: '@primer/react',
13
+ },
14
+ {
15
+ identifier: 'DialogHeaderProps',
16
+ entrypoint: '@primer/react',
17
+ },
10
18
  {
11
19
  identifier: 'Octicon',
12
20
  entrypoint: '@primer/react',
13
21
  },
22
+ {
23
+ identifier: 'OcticonProps',
24
+ entrypoint: '@primer/react',
25
+ },
14
26
  {
15
27
  identifier: 'Pagehead',
16
28
  entrypoint: '@primer/react',
17
29
  },
30
+ {
31
+ identifier: 'PageheadProps',
32
+ entrypoint: '@primer/react',
33
+ },
18
34
  {
19
35
  identifier: 'TabNav',
20
36
  entrypoint: '@primer/react',
21
37
  },
38
+ {
39
+ identifier: 'TabNavProps',
40
+ entrypoint: '@primer/react',
41
+ },
42
+ {
43
+ identifier: 'TabNavLinkProps',
44
+ entrypoint: '@primer/react',
45
+ },
22
46
  {
23
47
  identifier: 'Tooltip',
24
48
  entrypoint: '@primer/react',
25
49
  },
50
+ {
51
+ identifier: 'TooltipProps',
52
+ entrypoint: '@primer/react',
53
+ },
26
54
  ]
27
55
 
28
56
  const entrypoints = new Map()