eslint-plugin-primer-react 4.1.2 → 4.1.3-rc.53b6e5c

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": "4.1.2",
3
+ "version": "4.1.3-rc.53b6e5c",
4
4
  "description": "ESLint rules for Primer React",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -45,7 +45,7 @@
45
45
  "eslint-plugin-github": "^4.10.1",
46
46
  "eslint-plugin-prettier": "^5.0.1",
47
47
  "jest": "^29.7.0",
48
- "markdownlint-cli2": "^0.11.0",
48
+ "markdownlint-cli2": "^0.12.1",
49
49
  "markdownlint-cli2-formatter-pretty": "^0.0.5"
50
50
  },
51
51
  "prettier": "@github/prettier-config"
@@ -23,6 +23,11 @@ ruleTester.run('no-system-props', rule, {
23
23
  `import {Button} from '@primer/react'; <Button size="large" />`,
24
24
  `import {ActionMenu} from '@primer/react'; <ActionMenu.Overlay width="large" />`,
25
25
  {code: `<img width="200px" />`, options: [{skipImportCheck: true}]},
26
+ {code: `<Placeholder width="200px" />`, options: [{skipImportCheck: true, ignoreNames: ['Placeholder']}]},
27
+ {
28
+ code: `<Placeholder.Header width="200px" />`,
29
+ options: [{skipImportCheck: true, ignoreNames: ['Placeholder.Header']}],
30
+ },
26
31
  ],
27
32
  invalid: [
28
33
  {
@@ -32,6 +32,7 @@ const excludedComponentProps = new Map([
32
32
  ['SplitPageLayout.Pane', new Set(['padding', 'position', 'width'])],
33
33
  ['SplitPageLayout.Content', new Set(['padding', 'width'])],
34
34
  ['StyledOcticon', new Set(['size'])],
35
+ ['Octicon', new Set(['size', 'color'])],
35
36
  ['PointerBox', new Set(['bg'])],
36
37
  ['TextInput', new Set(['size'])],
37
38
  ['TextInputWithTokens', new Set(['size', 'maxHeight'])],
@@ -55,12 +56,9 @@ module.exports = {
55
56
  schema: [
56
57
  {
57
58
  properties: {
58
- skipImportCheck: {
59
- type: 'boolean',
60
- },
61
- includeUtilityComponents: {
62
- type: 'boolean',
63
- },
59
+ skipImportCheck: {type: 'boolean'},
60
+ includeUtilityComponents: {type: 'boolean'},
61
+ ignoreNames: {type: 'array'},
64
62
  },
65
63
  },
66
64
  ],
@@ -72,8 +70,8 @@ module.exports = {
72
70
  // If `skipImportCheck` is true, this rule will check for deprecated styled system props
73
71
  // used in any components (not just ones that are imported from `@primer/react`).
74
72
  const skipImportCheck = context.options[0] ? context.options[0].skipImportCheck : false
75
-
76
73
  const includeUtilityComponents = context.options[0] ? context.options[0].includeUtilityComponents : false
74
+ const ignoreNames = context.options[0] ? context.options[0].ignoreNames || [] : []
77
75
 
78
76
  const excludedComponents = new Set([
79
77
  ...alwaysExcludedComponents,
@@ -92,6 +90,7 @@ module.exports = {
92
90
  }
93
91
 
94
92
  const componentName = getJSXOpeningElementName(jsxNode)
93
+ if (ignoreNames.length && ignoreNames.includes(componentName)) return
95
94
 
96
95
  if (excludedComponents.has(componentName)) return
97
96