@gitlab/eslint-plugin 20.5.0 → 20.7.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/CHANGELOG.md +14 -0
- package/lib/rules/require-i18n-strings.js +20 -0
- package/lib/utils/tailwind-utils.js +4 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [20.7.0](https://gitlab.com/gitlab-org/frontend/eslint-plugin/compare/v20.6.0...v20.7.0) (2024-11-27)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **Tailwind:** Add allowlist for max-width media queries ([cfb23da](https://gitlab.com/gitlab-org/frontend/eslint-plugin/commit/cfb23da885a6bb49653710cc88fcf867436e38b9))
|
|
7
|
+
|
|
8
|
+
# [20.6.0](https://gitlab.com/gitlab-org/frontend/eslint-plugin/compare/v20.5.0...v20.6.0) (2024-11-11)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **i18n:** Ignore typenames in rule ([07c67d8](https://gitlab.com/gitlab-org/frontend/eslint-plugin/commit/07c67d8ef85594bcb2ba18fbe92749548fc6a0e7))
|
|
14
|
+
|
|
1
15
|
# [20.5.0](https://gitlab.com/gitlab-org/frontend/eslint-plugin/compare/v20.4.1...v20.5.0) (2024-10-29)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -192,6 +192,25 @@ module.exports = {
|
|
|
192
192
|
return node.callee && node.callee.name === 'RegExp';
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
+
/**
|
|
196
|
+
*
|
|
197
|
+
* In Objects like { __typename: 'Foobar' } for GraphQL mutations /
|
|
198
|
+
* optimistic responses, etc. We don't need to translate the type name.
|
|
199
|
+
*
|
|
200
|
+
* @param node
|
|
201
|
+
* @returns {boolean}
|
|
202
|
+
*/
|
|
203
|
+
function isGraphQLTypeName(node) {
|
|
204
|
+
// For object definitions
|
|
205
|
+
if (node.parent?.type === 'Property') {
|
|
206
|
+
return node.parent?.key?.name === '__typename';
|
|
207
|
+
}
|
|
208
|
+
return (
|
|
209
|
+
node.parent?.left?.type === 'MemberExpression' &&
|
|
210
|
+
node.parent?.left?.property?.name === '__typename'
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
195
214
|
function canSkipLiteral(node) {
|
|
196
215
|
return (
|
|
197
216
|
isNewRegExp(node.parent) ||
|
|
@@ -199,6 +218,7 @@ module.exports = {
|
|
|
199
218
|
(node.parent.left && isHtmlProperty(node.parent.left)) ||
|
|
200
219
|
(node.parent.id && isHtmlProperty(node.parent.id)) ||
|
|
201
220
|
(node.parent.key && isHtmlProperty(node.parent.key)) ||
|
|
221
|
+
isGraphQLTypeName(node) ||
|
|
202
222
|
isTrueConstant(node.parent.parent, node.parent) ||
|
|
203
223
|
isKeyList(node.parent.parent, node.parent) ||
|
|
204
224
|
isMemberExpressionIdentifier(node.parent)
|
|
@@ -6,7 +6,10 @@ const INTERPOLATED_UTILS_VALIDATORS = {
|
|
|
6
6
|
TemplateLiteral: templateLiteralHasInterpolatedUtils,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const MAX_WIDTH_MEDIA_QUERY_ALLOW_LIST = ['hidden'];
|
|
10
|
+
const MAX_WIDTH_MEDIA_QUERY_PATTERN = new RegExp(
|
|
11
|
+
`max-(sm|md|lg|xl):gl-(?!${MAX_WIDTH_MEDIA_QUERY_ALLOW_LIST.join('|')})`,
|
|
12
|
+
);
|
|
10
13
|
const MAX_WIDTH_MEDIA_QUERY_UTIL_ERROR =
|
|
11
14
|
'Do not use max-width media query utility classes unless absolutely necessary. Use min-width media query utility classes instead.';
|
|
12
15
|
const MAX_WIDTH_MEDIA_QUERY_UTIL_VALIDATORS = {
|