eslint-plugin-primer-react 4.0.3 → 4.0.4-rc.5058fcb
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/.changeset/README.md +3 -3
- package/.eslintrc.js +39 -0
- package/.github/dependabot.yml +11 -5
- package/.github/workflows/add-to-inbox.yml +33 -0
- package/.github/workflows/ci.yml +34 -18
- package/.github/workflows/release.yml +2 -2
- package/.github/workflows/release_canary.yml +8 -5
- package/.github/workflows/release_candidate.yml +4 -4
- package/.markdownlint-cli2.cjs +26 -0
- package/.nvmrc +1 -0
- package/.prettierignore +3 -0
- package/CHANGELOG.md +7 -1
- package/README.md +4 -2
- package/docs/rules/a11y-explicit-heading.md +17 -7
- package/docs/rules/a11y-tooltip-interactive-trigger.md +6 -2
- package/docs/rules/direct-slot-children.md +49 -46
- package/docs/rules/new-color-css-vars-have-fallback.md +25 -0
- package/docs/rules/new-css-color-vars.md +19 -14
- package/docs/rules/no-deprecated-colors.md +91 -82
- package/docs/rules/no-system-props.md +12 -5
- package/package-lock.json +15583 -0
- package/package.json +22 -14
- package/src/configs/components.js +19 -19
- package/src/configs/recommended.js +9 -8
- package/src/index.js +4 -3
- package/src/rules/__tests__/a11y-explicit-heading.test.js +22 -25
- package/src/rules/__tests__/a11y-tooltip-interactive-trigger.test.js +43 -43
- package/src/rules/__tests__/direct-slot-children.test.js +36 -36
- package/src/rules/__tests__/new-color-css-vars.test.js +612 -44
- package/src/rules/__tests__/new-css-vars-have-fallback.test.js +31 -0
- package/src/rules/__tests__/no-deprecated-colors.test.js +66 -66
- package/src/rules/__tests__/no-system-props.test.js +51 -51
- package/src/rules/a11y-explicit-heading.js +16 -13
- package/src/rules/a11y-tooltip-interactive-trigger.js +21 -22
- package/src/rules/direct-slot-children.js +11 -11
- package/src/rules/new-color-css-vars-have-fallback.js +87 -0
- package/src/rules/new-color-css-vars.js +97 -83
- package/src/rules/no-deprecated-colors.js +15 -15
- package/src/rules/no-system-props.js +21 -21
- package/src/url.js +1 -1
- package/src/utils/__tests__/flatten-components.test.js +13 -13
- package/src/utils/css-variable-map.json +538 -184
- package/src/utils/flatten-components.js +11 -11
- package/src/utils/is-imported-from.js +1 -1
- package/src/utils/new-color-css-vars-map.json +326 -0
- /package/.github/{workflows/CODEOWNERS → CODEOWNERS} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const {flattenComponents} = require('../flatten-components')
|
|
2
2
|
|
|
3
|
-
const mockComponents =
|
|
3
|
+
const mockComponents = passedObj => {
|
|
4
4
|
return {
|
|
5
5
|
Button: 'button',
|
|
6
6
|
Link: 'a',
|
|
@@ -8,14 +8,14 @@ const mockComponents = function(passedObj) {
|
|
|
8
8
|
Radio: 'input',
|
|
9
9
|
TextInput: {
|
|
10
10
|
Action: 'button',
|
|
11
|
-
self: 'input'
|
|
11
|
+
self: 'input',
|
|
12
12
|
},
|
|
13
|
-
...passedObj
|
|
13
|
+
...passedObj,
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
describe('getElementType', function() {
|
|
18
|
-
it('flattens passed object 1-level deep', function() {
|
|
17
|
+
describe('getElementType', function () {
|
|
18
|
+
it('flattens passed object 1-level deep', function () {
|
|
19
19
|
const result = flattenComponents(mockComponents())
|
|
20
20
|
|
|
21
21
|
const expectedResult = {
|
|
@@ -24,23 +24,23 @@ describe('getElementType', function() {
|
|
|
24
24
|
Spinner: 'svg',
|
|
25
25
|
Radio: 'input',
|
|
26
26
|
TextInput: 'input',
|
|
27
|
-
'TextInput.Action': 'button'
|
|
27
|
+
'TextInput.Action': 'button',
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
expect(result).toEqual(expectedResult)
|
|
31
31
|
})
|
|
32
32
|
|
|
33
|
-
it('ignores objects nested deeper than 1-level', function() {
|
|
33
|
+
it('ignores objects nested deeper than 1-level', function () {
|
|
34
34
|
const result = flattenComponents(
|
|
35
35
|
mockComponents({
|
|
36
36
|
Select: {
|
|
37
37
|
Items: {
|
|
38
|
-
self: 'div'
|
|
38
|
+
self: 'div',
|
|
39
39
|
},
|
|
40
40
|
Option: 'option',
|
|
41
|
-
self: 'select'
|
|
42
|
-
}
|
|
43
|
-
})
|
|
41
|
+
self: 'select',
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
44
|
)
|
|
45
45
|
|
|
46
46
|
const expectedResult = {
|
|
@@ -51,10 +51,10 @@ describe('getElementType', function() {
|
|
|
51
51
|
TextInput: 'input',
|
|
52
52
|
'TextInput.Action': 'button',
|
|
53
53
|
'Select.Items': {
|
|
54
|
-
self: 'div'
|
|
54
|
+
self: 'div',
|
|
55
55
|
},
|
|
56
56
|
Select: 'select',
|
|
57
|
-
'Select.Option': 'option'
|
|
57
|
+
'Select.Option': 'option',
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
expect(result).toEqual(expectedResult)
|