@atlaskit/eslint-plugin-design-system 13.4.0 → 13.4.1

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
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/eslint-plugin-design-system
2
2
 
3
+ ## 13.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#136299](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/136299)
8
+ [`4da98e435c8da`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4da98e435c8da) -
9
+ Add better logic to `use-modal-dialog-close-button` rule.
10
+
3
11
  ## 13.4.0
4
12
 
5
13
  ### Minor Changes
@@ -72,7 +72,7 @@ var rule = (0, _createRule.createLintRule)({
72
72
  return;
73
73
  }
74
74
  var name = node.openingElement.name.name;
75
- if (name !== defaultImportLocalName) {
75
+ if (![defaultImportLocalName, modalHeaderLocalName].includes(name)) {
76
76
  return;
77
77
  }
78
78
  var modalHeaderNode = null;
@@ -136,13 +136,31 @@ var rule = (0, _createRule.createLintRule)({
136
136
  _iterator.f();
137
137
  }
138
138
  };
139
- searchNode(node);
139
+ if (name === defaultImportLocalName) {
140
+ searchNode(node);
141
+
142
+ // If there is a close button, skip the rest, as this satisfies the
143
+ // rule. If there is a modal header, it will be recognized in later
144
+ // scans, so don't add duplicate errors
145
+ if (closeButtonNode || modalHeaderNode) {
146
+ return;
147
+ // No close button or modal header exists
148
+ } else {
149
+ return context.report({
150
+ node: node,
151
+ messageId: 'noCloseButtonExists'
152
+ });
153
+ }
154
+ } else if (name === modalHeaderLocalName) {
155
+ modalHeaderNode = node;
156
+ searchNode(node);
157
+
158
+ // If there is a close button, skip the rest, as this satisfies the rule.
159
+ if (closeButtonNode) {
160
+ return;
161
+ }
140
162
 
141
- // If there is a close button, skip the rest, as this satisfies the rule.
142
- if (closeButtonNode) {
143
- return;
144
163
  // No close button exists, so check the modal header
145
- } else if (modalHeaderNode !== null) {
146
164
  var prop = _jsxElement.JSXElementHelper.getAttributeByName(modalHeaderNode, PROP_NAME);
147
165
 
148
166
  // If the prop exists
@@ -175,12 +193,6 @@ var rule = (0, _createRule.createLintRule)({
175
193
  }]
176
194
  });
177
195
  }
178
- // No close button or modal header exists
179
- } else {
180
- return context.report({
181
- node: node,
182
- messageId: 'noCloseButtonExists'
183
- });
184
196
  }
185
197
  }
186
198
  };
@@ -65,7 +65,7 @@ const rule = createLintRule({
65
65
  return;
66
66
  }
67
67
  const name = node.openingElement.name.name;
68
- if (name !== defaultImportLocalName) {
68
+ if (![defaultImportLocalName, modalHeaderLocalName].includes(name)) {
69
69
  return;
70
70
  }
71
71
  let modalHeaderNode = null;
@@ -120,13 +120,31 @@ const rule = createLintRule({
120
120
  checkNode(child);
121
121
  }
122
122
  };
123
- searchNode(node);
123
+ if (name === defaultImportLocalName) {
124
+ searchNode(node);
125
+
126
+ // If there is a close button, skip the rest, as this satisfies the
127
+ // rule. If there is a modal header, it will be recognized in later
128
+ // scans, so don't add duplicate errors
129
+ if (closeButtonNode || modalHeaderNode) {
130
+ return;
131
+ // No close button or modal header exists
132
+ } else {
133
+ return context.report({
134
+ node,
135
+ messageId: 'noCloseButtonExists'
136
+ });
137
+ }
138
+ } else if (name === modalHeaderLocalName) {
139
+ modalHeaderNode = node;
140
+ searchNode(node);
141
+
142
+ // If there is a close button, skip the rest, as this satisfies the rule.
143
+ if (closeButtonNode) {
144
+ return;
145
+ }
124
146
 
125
- // If there is a close button, skip the rest, as this satisfies the rule.
126
- if (closeButtonNode) {
127
- return;
128
147
  // No close button exists, so check the modal header
129
- } else if (modalHeaderNode !== null) {
130
148
  const prop = JSXElementHelper.getAttributeByName(modalHeaderNode, PROP_NAME);
131
149
 
132
150
  // If the prop exists
@@ -155,12 +173,6 @@ const rule = createLintRule({
155
173
  }]
156
174
  });
157
175
  }
158
- // No close button or modal header exists
159
- } else {
160
- return context.report({
161
- node,
162
- messageId: 'noCloseButtonExists'
163
- });
164
176
  }
165
177
  }
166
178
  };
@@ -68,7 +68,7 @@ var rule = createLintRule({
68
68
  return;
69
69
  }
70
70
  var name = node.openingElement.name.name;
71
- if (name !== defaultImportLocalName) {
71
+ if (![defaultImportLocalName, modalHeaderLocalName].includes(name)) {
72
72
  return;
73
73
  }
74
74
  var modalHeaderNode = null;
@@ -132,13 +132,31 @@ var rule = createLintRule({
132
132
  _iterator.f();
133
133
  }
134
134
  };
135
- searchNode(node);
135
+ if (name === defaultImportLocalName) {
136
+ searchNode(node);
137
+
138
+ // If there is a close button, skip the rest, as this satisfies the
139
+ // rule. If there is a modal header, it will be recognized in later
140
+ // scans, so don't add duplicate errors
141
+ if (closeButtonNode || modalHeaderNode) {
142
+ return;
143
+ // No close button or modal header exists
144
+ } else {
145
+ return context.report({
146
+ node: node,
147
+ messageId: 'noCloseButtonExists'
148
+ });
149
+ }
150
+ } else if (name === modalHeaderLocalName) {
151
+ modalHeaderNode = node;
152
+ searchNode(node);
153
+
154
+ // If there is a close button, skip the rest, as this satisfies the rule.
155
+ if (closeButtonNode) {
156
+ return;
157
+ }
136
158
 
137
- // If there is a close button, skip the rest, as this satisfies the rule.
138
- if (closeButtonNode) {
139
- return;
140
159
  // No close button exists, so check the modal header
141
- } else if (modalHeaderNode !== null) {
142
160
  var prop = JSXElementHelper.getAttributeByName(modalHeaderNode, PROP_NAME);
143
161
 
144
162
  // If the prop exists
@@ -171,12 +189,6 @@ var rule = createLintRule({
171
189
  }]
172
190
  });
173
191
  }
174
- // No close button or modal header exists
175
- } else {
176
- return context.report({
177
- node: node,
178
- messageId: 'noCloseButtonExists'
179
- });
180
192
  }
181
193
  }
182
194
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atlaskit/eslint-plugin-design-system",
3
3
  "description": "The essential plugin for use with the Atlassian Design System.",
4
- "version": "13.4.0",
4
+ "version": "13.4.1",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {