eslint-plugin-primer-react 8.0.0-rc.d848c88 → 8.0.0
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/.github/copilot-instructions.md +159 -0
- package/.github/workflows/add-to-inbox.yml +2 -2
- package/.markdownlint-cli2.cjs +2 -2
- package/CHANGELOG.md +2 -2
- package/eslint.config.js +54 -0
- package/package.json +15 -9
- package/src/rules/__tests__/a11y-explicit-heading.test.js +5 -3
- package/src/rules/__tests__/a11y-link-in-text-block.test.js +5 -3
- package/src/rules/__tests__/a11y-no-duplicate-form-labels.test.js +5 -9
- package/src/rules/__tests__/a11y-no-title-usage.test.js +5 -3
- package/src/rules/__tests__/a11y-remove-disable-tooltip.test.js +5 -3
- package/src/rules/__tests__/a11y-tooltip-interactive-trigger.test.js +5 -3
- package/src/rules/__tests__/a11y-use-accessible-tooltip.test.js +5 -3
- package/src/rules/__tests__/direct-slot-children.test.js +5 -3
- package/src/rules/__tests__/enforce-button-for-link-with-nohref.test.js +5 -3
- package/src/rules/__tests__/enforce-css-module-identifier-casing.test.js +5 -3
- package/src/rules/__tests__/new-color-css-vars.test.js +5 -3
- package/src/rules/__tests__/no-deprecated-entrypoints.test.js +5 -3
- package/src/rules/__tests__/no-deprecated-experimental-components.test.js +5 -3
- package/src/rules/__tests__/no-deprecated-props.test.js +5 -3
- package/src/rules/__tests__/no-system-props.test.js +5 -4
- package/src/rules/__tests__/no-unnecessary-components.test.js +6 -4
- package/src/rules/__tests__/no-wildcard-imports.test.js +6 -43
- package/src/rules/__tests__/prefer-action-list-item-onselect.test.js +6 -4
- package/src/rules/__tests__/use-deprecated-from-deprecated.test.js +5 -3
- package/src/rules/no-deprecated-experimental-components.js +0 -1
- package/.eslintignore +0 -2
- package/.eslintrc.js +0 -39
- package/package-lock.json +0 -15692
|
@@ -4,12 +4,14 @@ const {RuleTester} = require('eslint')
|
|
|
4
4
|
const rule = require('../no-wildcard-imports')
|
|
5
5
|
|
|
6
6
|
const ruleTester = new RuleTester({
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
languageOptions: {
|
|
8
|
+
parser: require(require.resolve('@typescript-eslint/parser', {paths: [require.resolve('eslint-plugin-github')]})),
|
|
9
9
|
ecmaVersion: 'latest',
|
|
10
10
|
sourceType: 'module',
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
parserOptions: {
|
|
12
|
+
ecmaFeatures: {
|
|
13
|
+
jsx: true,
|
|
14
|
+
},
|
|
13
15
|
},
|
|
14
16
|
},
|
|
15
17
|
})
|
|
@@ -69,20 +71,6 @@ ruleTester.run('no-wildcard-imports', rule, {
|
|
|
69
71
|
],
|
|
70
72
|
},
|
|
71
73
|
|
|
72
|
-
// Test default import
|
|
73
|
-
{
|
|
74
|
-
code: `import useIsomorphicLayoutEffect from '@primer/react/lib-esm/utils/useIsomorphicLayoutEffect'`,
|
|
75
|
-
output: `import {useIsomorphicLayoutEffect} from '@primer/react'`,
|
|
76
|
-
errors: [
|
|
77
|
-
{
|
|
78
|
-
messageId: 'wildcardMigration',
|
|
79
|
-
data: {
|
|
80
|
-
wildcardEntrypoint: '@primer/react/lib-esm/utils/useIsomorphicLayoutEffect',
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
},
|
|
85
|
-
|
|
86
74
|
// Test multiple wildcard imports into single entrypoint
|
|
87
75
|
{
|
|
88
76
|
code: `import {useResizeObserver} from '@primer/react/lib-esm/hooks/useResizeObserver'
|
|
@@ -306,18 +294,6 @@ import {type ButtonBaseProps} from '@primer/react/experimental'`,
|
|
|
306
294
|
},
|
|
307
295
|
],
|
|
308
296
|
},
|
|
309
|
-
{
|
|
310
|
-
code: `import type {ItemProps} from '@primer/react/lib-esm/deprecated/ActionList/Item'`,
|
|
311
|
-
output: `import {type ActionListItemProps as ItemProps} from '@primer/react/deprecated'`,
|
|
312
|
-
errors: [
|
|
313
|
-
{
|
|
314
|
-
messageId: 'wildcardMigration',
|
|
315
|
-
data: {
|
|
316
|
-
wildcardEntrypoint: '@primer/react/lib-esm/deprecated/ActionList/Item',
|
|
317
|
-
},
|
|
318
|
-
},
|
|
319
|
-
],
|
|
320
|
-
},
|
|
321
297
|
|
|
322
298
|
// Hooks -------------------------------------------------------------------
|
|
323
299
|
|
|
@@ -391,19 +367,6 @@ import {type ButtonBaseProps} from '@primer/react/experimental'`,
|
|
|
391
367
|
|
|
392
368
|
// Utilities ---------------------------------------------------------------
|
|
393
369
|
|
|
394
|
-
// @primer/react/lib-esm/sx
|
|
395
|
-
{
|
|
396
|
-
code: `import type {BetterSystemStyleObject, SxProp, BetterCssProperties} from '@primer/react/lib-esm/sx'`,
|
|
397
|
-
output: `import {type BetterSystemStyleObject, type SxProp, type BetterCssProperties} from '@primer/react'`,
|
|
398
|
-
errors: [
|
|
399
|
-
{
|
|
400
|
-
messageId: 'wildcardMigration',
|
|
401
|
-
data: {
|
|
402
|
-
wildcardEntrypoint: '@primer/react/lib-esm/sx',
|
|
403
|
-
},
|
|
404
|
-
},
|
|
405
|
-
],
|
|
406
|
-
},
|
|
407
370
|
// @primer/react/lib-esm/FeatureFlags/DefaultFeatureFlags
|
|
408
371
|
{
|
|
409
372
|
code: `import {DefaultFeatureFlags} from '@primer/react/lib-esm/FeatureFlags/DefaultFeatureFlags'`,
|
|
@@ -2,12 +2,14 @@ const {RuleTester} = require('@typescript-eslint/rule-tester')
|
|
|
2
2
|
const rule = require('../prefer-action-list-item-onselect')
|
|
3
3
|
|
|
4
4
|
const ruleTester = new RuleTester({
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
languageOptions: {
|
|
6
|
+
parser: require(require.resolve('@typescript-eslint/parser', {paths: [require.resolve('eslint-plugin-github')]})),
|
|
7
7
|
ecmaVersion: 2018,
|
|
8
8
|
sourceType: 'module',
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
parserOptions: {
|
|
10
|
+
ecmaFeatures: {
|
|
11
|
+
jsx: true,
|
|
12
|
+
},
|
|
11
13
|
},
|
|
12
14
|
},
|
|
13
15
|
})
|
|
@@ -4,11 +4,13 @@ const {RuleTester} = require('eslint')
|
|
|
4
4
|
const rule = require('../use-deprecated-from-deprecated')
|
|
5
5
|
|
|
6
6
|
const ruleTester = new RuleTester({
|
|
7
|
-
|
|
7
|
+
languageOptions: {
|
|
8
8
|
ecmaVersion: 'latest',
|
|
9
9
|
sourceType: 'module',
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
parserOptions: {
|
|
11
|
+
ecmaFeatures: {
|
|
12
|
+
jsx: true,
|
|
13
|
+
},
|
|
12
14
|
},
|
|
13
15
|
},
|
|
14
16
|
})
|
|
@@ -52,7 +52,6 @@ module.exports = {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
if (experimental.length > 0) {
|
|
55
|
-
// eslint-disable-next-line i18n-text/no-en
|
|
56
55
|
const message = `The experimental ${components.join(', ')} ${
|
|
57
56
|
components.length > 1 ? 'are' : 'is'
|
|
58
57
|
} deprecated. Please import from the stable entrypoint (@primer/react) if available. Check https://primer.style/product/getting-started/react/migration-guides/ for migration guidance or https://primer.style/product/components/ for alternative components.`
|
package/.eslintignore
DELETED
package/.eslintrc.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @type {import('eslint').Linter.Config}
|
|
5
|
-
*/
|
|
6
|
-
module.exports = {
|
|
7
|
-
extends: ['eslint:recommended', 'plugin:github/recommended'],
|
|
8
|
-
parserOptions: {
|
|
9
|
-
ecmaVersion: 'latest',
|
|
10
|
-
},
|
|
11
|
-
env: {
|
|
12
|
-
commonjs: true,
|
|
13
|
-
node: true,
|
|
14
|
-
},
|
|
15
|
-
rules: {
|
|
16
|
-
'import/no-commonjs': 'off',
|
|
17
|
-
'no-shadow': 'off',
|
|
18
|
-
'no-unused-vars': [
|
|
19
|
-
'error',
|
|
20
|
-
{
|
|
21
|
-
varsIgnorePattern: '^_',
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
overrides: [
|
|
26
|
-
{
|
|
27
|
-
files: ['**/*.test.js'],
|
|
28
|
-
env: {
|
|
29
|
-
jest: true,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
files: ['.eslintrc.js'],
|
|
34
|
-
rules: {
|
|
35
|
-
'filenames/match-regex': 'off',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
}
|