@atlaskit/eslint-plugin-ui-styling-standard 2.1.6 → 2.1.7

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,12 @@
1
1
  # @atlaskit/eslint-plugin-ui-styling-standard
2
2
 
3
+ ## 2.1.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f0c3543359684`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f0c3543359684) -
8
+ Allow safe local named dimension-based container queries
9
+
3
10
  ## 2.1.6
4
11
 
5
12
  ### Patch Changes
@@ -36,6 +36,38 @@ var isStaticContainerKey = function isStaticContainerKey(node) {
36
36
  }
37
37
  return expression.type === 'TemplateLiteral' && ((_expression$expressio = expression.expressions) === null || _expression$expressio === void 0 ? void 0 : _expression$expressio.length) === 0;
38
38
  };
39
+ var getStaticString = function getStaticString(node) {
40
+ var _expression$expressio2;
41
+ if (!node) {
42
+ return undefined;
43
+ }
44
+ var expression = unwrapTypeScriptExpression(node);
45
+ if (expression.type === 'Literal') {
46
+ var value = expression.value;
47
+ return typeof value === 'string' ? value : undefined;
48
+ }
49
+ if (expression.type === 'TemplateLiteral' && ((_expression$expressio2 = expression.expressions) === null || _expression$expressio2 === void 0 ? void 0 : _expression$expressio2.length) === 0) {
50
+ var _expression$quasis;
51
+ return (_expression$quasis = expression.quasis) === null || _expression$quasis === void 0 || (_expression$quasis = _expression$quasis[0]) === null || _expression$quasis === void 0 || (_expression$quasis = _expression$quasis.value) === null || _expression$quasis === void 0 ? void 0 : _expression$quasis.raw;
52
+ }
53
+ return undefined;
54
+ };
55
+ var getPropertyName = function getPropertyName(node) {
56
+ var expression = unwrapTypeScriptExpression(node);
57
+ return expression.type === 'Identifier' ? expression.name : getStaticString(expression);
58
+ };
59
+ var isDimensionQuery = function isDimensionQuery(query) {
60
+ // Policy source: https://hello.atlassian.net/wiki/spaces/~7012119e15ecf78c74278a34bd6681745f7bb/pages/2595609668/What+would+it+take+to+get+container+queries+working
61
+ var condition = query.replace(/^@container\s+[-_a-zA-Z][-_a-zA-Z0-9]*\s*/, '');
62
+ return !condition.includes('style(') && /\b(?:width|height|min-width|max-width|min-height|max-height)\b/i.test(condition);
63
+ };
64
+ var getContainerName = function getContainerName(query) {
65
+ var match = query.match(/^@container\s+([-_a-zA-Z][-_a-zA-Z0-9]*)\b/);
66
+ return match === null || match === void 0 ? void 0 : match[1];
67
+ };
68
+ var isContainerDeclaration = function isContainerDeclaration(node) {
69
+ return getPropertyName(node) === 'containerName';
70
+ };
39
71
  var isImportedContainerType = function isImportedContainerType(node, context) {
40
72
  var expression = node;
41
73
  var _loop = function _loop() {
@@ -65,12 +97,12 @@ var isImportedContainerType = function isImportedContainerType(node, context) {
65
97
  return false;
66
98
  };
67
99
  var isContainerQuery = function isContainerQuery(node) {
68
- var _expression$quasis;
100
+ var _expression$quasis2;
69
101
  var expression = unwrapTypeScriptExpression(node);
70
102
  if (expression.type === 'Literal' && typeof expression.value === 'string') {
71
103
  return expression.value.includes('@container');
72
104
  }
73
- return expression.type === 'TemplateLiteral' && Boolean((_expression$quasis = expression.quasis) === null || _expression$quasis === void 0 ? void 0 : _expression$quasis.some(function (quasi) {
105
+ return expression.type === 'TemplateLiteral' && Boolean((_expression$quasis2 = expression.quasis) === null || _expression$quasis2 === void 0 ? void 0 : _expression$quasis2.some(function (quasi) {
74
106
  var _quasi$value;
75
107
  return (_quasi$value = quasi.value) === null || _quasi$value === void 0 || (_quasi$value = _quasi$value.raw) === null || _quasi$value === void 0 ? void 0 : _quasi$value.includes('@container');
76
108
  }));
@@ -84,14 +116,36 @@ var rule = (0, _createRule.createLintRule)({
84
116
  severity: 'error'
85
117
  },
86
118
  messages: {
87
- 'no-container-queries': 'We block @container queries as they break scope and are not type-safe. We suggest alternatives such as JS-based APIs or @media queries.'
119
+ 'no-container-queries': '@container queries must use a named container declared in the same file and a width/height-based condition.',
120
+ 'no-container-style-queries': 'Style queries are not allowed. Use a width/height-based @container query instead.',
121
+ 'no-unbound-container-queries': 'Container queries must include a container name, for example @container card (min-width: 30rem).',
122
+ 'no-mismatched-container-name': 'The @container name must match a containerName declared in the same file.',
123
+ 'no-non-dimension-container-queries': 'Container queries must be dimension-based (width or height); style and other feature queries are not allowed.'
88
124
  },
89
125
  type: 'problem',
90
126
  schema: schema
91
127
  },
92
128
  create: function create(context) {
93
129
  var importSources = (0, _isSupportedImport.getImportSources)(context);
130
+ var containerNames = new Set();
94
131
  return {
132
+ Program: function Program(node) {
133
+ _estraverse.default.traverse(node, {
134
+ enter: function enter(child) {
135
+ if (child.type !== 'Property') {
136
+ return;
137
+ }
138
+ var property = child;
139
+ if (isContainerDeclaration(property.key)) {
140
+ var id = getStaticString(property.value);
141
+ if (id) {
142
+ containerNames.add(id);
143
+ }
144
+ }
145
+ },
146
+ fallback: 'iteration'
147
+ });
148
+ },
95
149
  CallExpression: function CallExpression(node) {
96
150
  var _getScope = (0, _contextCompat.getScope)(context, node),
97
151
  references = _getScope.references;
@@ -105,12 +159,15 @@ var rule = (0, _createRule.createLintRule)({
105
159
  if (!isContainerQuery(key)) {
106
160
  return;
107
161
  }
108
- if (isImportedContainerType(key, context) && isStaticContainerKey(key.expression)) {
162
+ var query = getStaticString(key);
163
+ var queryName = query ? getContainerName(query) : undefined;
164
+ var reportMessageId = !query ? 'no-container-queries' : query.includes('style(') ? 'no-container-style-queries' : !queryName ? 'no-unbound-container-queries' : !containerNames.has(queryName) ? 'no-mismatched-container-name' : !isDimensionQuery(query) ? 'no-non-dimension-container-queries' : 'no-container-queries';
165
+ if (isImportedContainerType(key, context) && isStaticContainerKey(key.expression) && query && queryName && containerNames.has(queryName) && isDimensionQuery(query)) {
109
166
  return;
110
167
  }
111
168
  context.report({
112
169
  node: node.key,
113
- messageId: 'no-container-queries'
170
+ messageId: reportMessageId
114
171
  });
115
172
  },
116
173
  /**
@@ -80,13 +80,6 @@ var checkIdentifier = function checkIdentifier(identifier, context, functionAllo
80
80
  var _ref = identifier,
81
81
  parent = _ref.parent;
82
82
 
83
- // Type references and `typeof` queries are erased at runtime and are not
84
- // imported style values. Runtime expressions wrapped by `as` or `satisfies`
85
- // must still be checked.
86
- if (parent && (parent.type === 'TSTypeReference' || parent.type === 'TSTypeQuery')) {
87
- return;
88
- }
89
-
90
83
  // Even though `member` in `object.member` is syntactically an identifier,
91
84
  // it should be ignored as `.member` is syntax sugar for `['member']` here.
92
85
  // We should still lint `object[member]` (when `parent.computed` === true)
@@ -13,13 +13,6 @@ var _findVariable = require("@atlaskit/eslint-utils/find-variable");
13
13
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
14
14
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
15
15
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
16
- var unwrapSatisfiesExpression = function unwrapSatisfiesExpression(node) {
17
- var currentNode = node;
18
- while (currentNode.type === 'TSSatisfiesExpression') {
19
- currentNode = currentNode.expression;
20
- }
21
- return currentNode;
22
- };
23
16
  function isReferenceToCssVar(variable) {
24
17
  var definitions = variable.defs;
25
18
  return definitions.every(function (definition) {
@@ -196,16 +189,6 @@ var Linter = exports.Linter = /*#__PURE__*/function () {
196
189
  }, {
197
190
  key: "lintKey",
198
191
  value: function lintKey(property) {
199
- var key = property.key;
200
-
201
- // A type-only `satisfies` annotation preserves a static key at runtime.
202
- // It is safe for the same reason as a directly written string literal.
203
- var unwrappedKey = unwrapSatisfiesExpression(key);
204
- var isSatisfiesExpression = unwrappedKey !== key;
205
- if (property.computed && isSatisfiesExpression && unwrappedKey.type === 'Literal' && typeof unwrappedKey.value === 'string') {
206
- return;
207
- }
208
-
209
192
  /**
210
193
  * If it's not computed then it must be a plain string.
211
194
  *
@@ -29,6 +29,38 @@ const isStaticContainerKey = node => {
29
29
  }
30
30
  return expression.type === 'TemplateLiteral' && ((_expression$expressio = expression.expressions) === null || _expression$expressio === void 0 ? void 0 : _expression$expressio.length) === 0;
31
31
  };
32
+ const getStaticString = node => {
33
+ var _expression$expressio2;
34
+ if (!node) {
35
+ return undefined;
36
+ }
37
+ const expression = unwrapTypeScriptExpression(node);
38
+ if (expression.type === 'Literal') {
39
+ const value = expression.value;
40
+ return typeof value === 'string' ? value : undefined;
41
+ }
42
+ if (expression.type === 'TemplateLiteral' && ((_expression$expressio2 = expression.expressions) === null || _expression$expressio2 === void 0 ? void 0 : _expression$expressio2.length) === 0) {
43
+ var _expression$quasis, _expression$quasis$, _expression$quasis$$v;
44
+ return (_expression$quasis = expression.quasis) === null || _expression$quasis === void 0 ? void 0 : (_expression$quasis$ = _expression$quasis[0]) === null || _expression$quasis$ === void 0 ? void 0 : (_expression$quasis$$v = _expression$quasis$.value) === null || _expression$quasis$$v === void 0 ? void 0 : _expression$quasis$$v.raw;
45
+ }
46
+ return undefined;
47
+ };
48
+ const getPropertyName = node => {
49
+ const expression = unwrapTypeScriptExpression(node);
50
+ return expression.type === 'Identifier' ? expression.name : getStaticString(expression);
51
+ };
52
+ const isDimensionQuery = query => {
53
+ // Policy source: https://hello.atlassian.net/wiki/spaces/~7012119e15ecf78c74278a34bd6681745f7bb/pages/2595609668/What+would+it+take+to+get+container+queries+working
54
+ const condition = query.replace(/^@container\s+[-_a-zA-Z][-_a-zA-Z0-9]*\s*/, '');
55
+ return !condition.includes('style(') && /\b(?:width|height|min-width|max-width|min-height|max-height)\b/i.test(condition);
56
+ };
57
+ const getContainerName = query => {
58
+ const match = query.match(/^@container\s+([-_a-zA-Z][-_a-zA-Z0-9]*)\b/);
59
+ return match === null || match === void 0 ? void 0 : match[1];
60
+ };
61
+ const isContainerDeclaration = node => {
62
+ return getPropertyName(node) === 'containerName';
63
+ };
32
64
  const isImportedContainerType = (node, context) => {
33
65
  let expression = node;
34
66
  while (expression.type === 'TSSatisfiesExpression') {
@@ -48,12 +80,12 @@ const isImportedContainerType = (node, context) => {
48
80
  return false;
49
81
  };
50
82
  const isContainerQuery = node => {
51
- var _expression$quasis;
83
+ var _expression$quasis2;
52
84
  const expression = unwrapTypeScriptExpression(node);
53
85
  if (expression.type === 'Literal' && typeof expression.value === 'string') {
54
86
  return expression.value.includes('@container');
55
87
  }
56
- return expression.type === 'TemplateLiteral' && Boolean((_expression$quasis = expression.quasis) === null || _expression$quasis === void 0 ? void 0 : _expression$quasis.some(quasi => {
88
+ return expression.type === 'TemplateLiteral' && Boolean((_expression$quasis2 = expression.quasis) === null || _expression$quasis2 === void 0 ? void 0 : _expression$quasis2.some(quasi => {
57
89
  var _quasi$value, _quasi$value$raw;
58
90
  return (_quasi$value = quasi.value) === null || _quasi$value === void 0 ? void 0 : (_quasi$value$raw = _quasi$value.raw) === null || _quasi$value$raw === void 0 ? void 0 : _quasi$value$raw.includes('@container');
59
91
  }));
@@ -67,14 +99,36 @@ const rule = createLintRule({
67
99
  severity: 'error'
68
100
  },
69
101
  messages: {
70
- 'no-container-queries': 'We block @container queries as they break scope and are not type-safe. We suggest alternatives such as JS-based APIs or @media queries.'
102
+ 'no-container-queries': '@container queries must use a named container declared in the same file and a width/height-based condition.',
103
+ 'no-container-style-queries': 'Style queries are not allowed. Use a width/height-based @container query instead.',
104
+ 'no-unbound-container-queries': 'Container queries must include a container name, for example @container card (min-width: 30rem).',
105
+ 'no-mismatched-container-name': 'The @container name must match a containerName declared in the same file.',
106
+ 'no-non-dimension-container-queries': 'Container queries must be dimension-based (width or height); style and other feature queries are not allowed.'
71
107
  },
72
108
  type: 'problem',
73
109
  schema
74
110
  },
75
111
  create(context) {
76
112
  const importSources = getImportSources(context);
113
+ const containerNames = new Set();
77
114
  return {
115
+ Program(node) {
116
+ estraverse.traverse(node, {
117
+ enter(child) {
118
+ if (child.type !== 'Property') {
119
+ return;
120
+ }
121
+ const property = child;
122
+ if (isContainerDeclaration(property.key)) {
123
+ const id = getStaticString(property.value);
124
+ if (id) {
125
+ containerNames.add(id);
126
+ }
127
+ }
128
+ },
129
+ fallback: 'iteration'
130
+ });
131
+ },
78
132
  CallExpression(node) {
79
133
  const {
80
134
  references
@@ -89,12 +143,15 @@ const rule = createLintRule({
89
143
  if (!isContainerQuery(key)) {
90
144
  return;
91
145
  }
92
- if (isImportedContainerType(key, context) && isStaticContainerKey(key.expression)) {
146
+ const query = getStaticString(key);
147
+ const queryName = query ? getContainerName(query) : undefined;
148
+ const reportMessageId = !query ? 'no-container-queries' : query.includes('style(') ? 'no-container-style-queries' : !queryName ? 'no-unbound-container-queries' : !containerNames.has(queryName) ? 'no-mismatched-container-name' : !isDimensionQuery(query) ? 'no-non-dimension-container-queries' : 'no-container-queries';
149
+ if (isImportedContainerType(key, context) && isStaticContainerKey(key.expression) && query && queryName && containerNames.has(queryName) && isDimensionQuery(query)) {
93
150
  return;
94
151
  }
95
152
  context.report({
96
153
  node: node.key,
97
- messageId: 'no-container-queries'
154
+ messageId: reportMessageId
98
155
  });
99
156
  },
100
157
  /**
@@ -69,13 +69,6 @@ const checkIdentifier = (identifier, context, functionAllowList, keysAllowList)
69
69
  parent
70
70
  } = identifier;
71
71
 
72
- // Type references and `typeof` queries are erased at runtime and are not
73
- // imported style values. Runtime expressions wrapped by `as` or `satisfies`
74
- // must still be checked.
75
- if (parent && (parent.type === 'TSTypeReference' || parent.type === 'TSTypeQuery')) {
76
- return;
77
- }
78
-
79
72
  // Even though `member` in `object.member` is syntactically an identifier,
80
73
  // it should be ignored as `.member` is syntax sugar for `['member']` here.
81
74
  // We should still lint `object[member]` (when `parent.computed` === true)
@@ -1,13 +1,6 @@
1
1
  import { getAllowedDynamicKeys, getAllowedFunctionCalls, isAllowListedVariable } from '@atlaskit/eslint-utils/allowed-function-calls';
2
2
  import { findIdentifierNode } from '@atlaskit/eslint-utils/find-identifier-node';
3
3
  import { findVariable } from '@atlaskit/eslint-utils/find-variable';
4
- const unwrapSatisfiesExpression = node => {
5
- let currentNode = node;
6
- while (currentNode.type === 'TSSatisfiesExpression') {
7
- currentNode = currentNode.expression;
8
- }
9
- return currentNode;
10
- };
11
4
  function isReferenceToCssVar(variable) {
12
5
  const definitions = variable.defs;
13
6
  return definitions.every(definition => {
@@ -163,16 +156,6 @@ export class Linter {
163
156
  });
164
157
  }
165
158
  lintKey(property) {
166
- const key = property.key;
167
-
168
- // A type-only `satisfies` annotation preserves a static key at runtime.
169
- // It is safe for the same reason as a directly written string literal.
170
- const unwrappedKey = unwrapSatisfiesExpression(key);
171
- const isSatisfiesExpression = unwrappedKey !== key;
172
- if (property.computed && isSatisfiesExpression && unwrappedKey.type === 'Literal' && typeof unwrappedKey.value === 'string') {
173
- return;
174
- }
175
-
176
159
  /**
177
160
  * If it's not computed then it must be a plain string.
178
161
  *
@@ -29,6 +29,38 @@ var isStaticContainerKey = function isStaticContainerKey(node) {
29
29
  }
30
30
  return expression.type === 'TemplateLiteral' && ((_expression$expressio = expression.expressions) === null || _expression$expressio === void 0 ? void 0 : _expression$expressio.length) === 0;
31
31
  };
32
+ var getStaticString = function getStaticString(node) {
33
+ var _expression$expressio2;
34
+ if (!node) {
35
+ return undefined;
36
+ }
37
+ var expression = unwrapTypeScriptExpression(node);
38
+ if (expression.type === 'Literal') {
39
+ var value = expression.value;
40
+ return typeof value === 'string' ? value : undefined;
41
+ }
42
+ if (expression.type === 'TemplateLiteral' && ((_expression$expressio2 = expression.expressions) === null || _expression$expressio2 === void 0 ? void 0 : _expression$expressio2.length) === 0) {
43
+ var _expression$quasis;
44
+ return (_expression$quasis = expression.quasis) === null || _expression$quasis === void 0 || (_expression$quasis = _expression$quasis[0]) === null || _expression$quasis === void 0 || (_expression$quasis = _expression$quasis.value) === null || _expression$quasis === void 0 ? void 0 : _expression$quasis.raw;
45
+ }
46
+ return undefined;
47
+ };
48
+ var getPropertyName = function getPropertyName(node) {
49
+ var expression = unwrapTypeScriptExpression(node);
50
+ return expression.type === 'Identifier' ? expression.name : getStaticString(expression);
51
+ };
52
+ var isDimensionQuery = function isDimensionQuery(query) {
53
+ // Policy source: https://hello.atlassian.net/wiki/spaces/~7012119e15ecf78c74278a34bd6681745f7bb/pages/2595609668/What+would+it+take+to+get+container+queries+working
54
+ var condition = query.replace(/^@container\s+[-_a-zA-Z][-_a-zA-Z0-9]*\s*/, '');
55
+ return !condition.includes('style(') && /\b(?:width|height|min-width|max-width|min-height|max-height)\b/i.test(condition);
56
+ };
57
+ var getContainerName = function getContainerName(query) {
58
+ var match = query.match(/^@container\s+([-_a-zA-Z][-_a-zA-Z0-9]*)\b/);
59
+ return match === null || match === void 0 ? void 0 : match[1];
60
+ };
61
+ var isContainerDeclaration = function isContainerDeclaration(node) {
62
+ return getPropertyName(node) === 'containerName';
63
+ };
32
64
  var isImportedContainerType = function isImportedContainerType(node, context) {
33
65
  var expression = node;
34
66
  var _loop = function _loop() {
@@ -58,12 +90,12 @@ var isImportedContainerType = function isImportedContainerType(node, context) {
58
90
  return false;
59
91
  };
60
92
  var isContainerQuery = function isContainerQuery(node) {
61
- var _expression$quasis;
93
+ var _expression$quasis2;
62
94
  var expression = unwrapTypeScriptExpression(node);
63
95
  if (expression.type === 'Literal' && typeof expression.value === 'string') {
64
96
  return expression.value.includes('@container');
65
97
  }
66
- return expression.type === 'TemplateLiteral' && Boolean((_expression$quasis = expression.quasis) === null || _expression$quasis === void 0 ? void 0 : _expression$quasis.some(function (quasi) {
98
+ return expression.type === 'TemplateLiteral' && Boolean((_expression$quasis2 = expression.quasis) === null || _expression$quasis2 === void 0 ? void 0 : _expression$quasis2.some(function (quasi) {
67
99
  var _quasi$value;
68
100
  return (_quasi$value = quasi.value) === null || _quasi$value === void 0 || (_quasi$value = _quasi$value.raw) === null || _quasi$value === void 0 ? void 0 : _quasi$value.includes('@container');
69
101
  }));
@@ -77,14 +109,36 @@ var rule = createLintRule({
77
109
  severity: 'error'
78
110
  },
79
111
  messages: {
80
- 'no-container-queries': 'We block @container queries as they break scope and are not type-safe. We suggest alternatives such as JS-based APIs or @media queries.'
112
+ 'no-container-queries': '@container queries must use a named container declared in the same file and a width/height-based condition.',
113
+ 'no-container-style-queries': 'Style queries are not allowed. Use a width/height-based @container query instead.',
114
+ 'no-unbound-container-queries': 'Container queries must include a container name, for example @container card (min-width: 30rem).',
115
+ 'no-mismatched-container-name': 'The @container name must match a containerName declared in the same file.',
116
+ 'no-non-dimension-container-queries': 'Container queries must be dimension-based (width or height); style and other feature queries are not allowed.'
81
117
  },
82
118
  type: 'problem',
83
119
  schema: schema
84
120
  },
85
121
  create: function create(context) {
86
122
  var importSources = getImportSources(context);
123
+ var containerNames = new Set();
87
124
  return {
125
+ Program: function Program(node) {
126
+ estraverse.traverse(node, {
127
+ enter: function enter(child) {
128
+ if (child.type !== 'Property') {
129
+ return;
130
+ }
131
+ var property = child;
132
+ if (isContainerDeclaration(property.key)) {
133
+ var id = getStaticString(property.value);
134
+ if (id) {
135
+ containerNames.add(id);
136
+ }
137
+ }
138
+ },
139
+ fallback: 'iteration'
140
+ });
141
+ },
88
142
  CallExpression: function CallExpression(node) {
89
143
  var _getScope = getScope(context, node),
90
144
  references = _getScope.references;
@@ -98,12 +152,15 @@ var rule = createLintRule({
98
152
  if (!isContainerQuery(key)) {
99
153
  return;
100
154
  }
101
- if (isImportedContainerType(key, context) && isStaticContainerKey(key.expression)) {
155
+ var query = getStaticString(key);
156
+ var queryName = query ? getContainerName(query) : undefined;
157
+ var reportMessageId = !query ? 'no-container-queries' : query.includes('style(') ? 'no-container-style-queries' : !queryName ? 'no-unbound-container-queries' : !containerNames.has(queryName) ? 'no-mismatched-container-name' : !isDimensionQuery(query) ? 'no-non-dimension-container-queries' : 'no-container-queries';
158
+ if (isImportedContainerType(key, context) && isStaticContainerKey(key.expression) && query && queryName && containerNames.has(queryName) && isDimensionQuery(query)) {
102
159
  return;
103
160
  }
104
161
  context.report({
105
162
  node: node.key,
106
- messageId: 'no-container-queries'
163
+ messageId: reportMessageId
107
164
  });
108
165
  },
109
166
  /**
@@ -73,13 +73,6 @@ var checkIdentifier = function checkIdentifier(identifier, context, functionAllo
73
73
  var _ref = identifier,
74
74
  parent = _ref.parent;
75
75
 
76
- // Type references and `typeof` queries are erased at runtime and are not
77
- // imported style values. Runtime expressions wrapped by `as` or `satisfies`
78
- // must still be checked.
79
- if (parent && (parent.type === 'TSTypeReference' || parent.type === 'TSTypeQuery')) {
80
- return;
81
- }
82
-
83
76
  // Even though `member` in `object.member` is syntactically an identifier,
84
77
  // it should be ignored as `.member` is syntax sugar for `['member']` here.
85
78
  // We should still lint `object[member]` (when `parent.computed` === true)
@@ -6,13 +6,6 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
6
6
  import { getAllowedDynamicKeys, getAllowedFunctionCalls, isAllowListedVariable } from '@atlaskit/eslint-utils/allowed-function-calls';
7
7
  import { findIdentifierNode } from '@atlaskit/eslint-utils/find-identifier-node';
8
8
  import { findVariable } from '@atlaskit/eslint-utils/find-variable';
9
- var unwrapSatisfiesExpression = function unwrapSatisfiesExpression(node) {
10
- var currentNode = node;
11
- while (currentNode.type === 'TSSatisfiesExpression') {
12
- currentNode = currentNode.expression;
13
- }
14
- return currentNode;
15
- };
16
9
  function isReferenceToCssVar(variable) {
17
10
  var definitions = variable.defs;
18
11
  return definitions.every(function (definition) {
@@ -189,16 +182,6 @@ export var Linter = /*#__PURE__*/function () {
189
182
  }, {
190
183
  key: "lintKey",
191
184
  value: function lintKey(property) {
192
- var key = property.key;
193
-
194
- // A type-only `satisfies` annotation preserves a static key at runtime.
195
- // It is safe for the same reason as a directly written string literal.
196
- var unwrappedKey = unwrapSatisfiesExpression(key);
197
- var isSatisfiesExpression = unwrappedKey !== key;
198
- if (property.computed && isSatisfiesExpression && unwrappedKey.type === 'Literal' && typeof unwrappedKey.value === 'string') {
199
- return;
200
- }
201
-
202
185
  /**
203
186
  * If it's not computed then it must be a plain string.
204
187
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/eslint-plugin-ui-styling-standard",
3
- "version": "2.1.6",
3
+ "version": "2.1.7",
4
4
  "author": "Atlassian Pty Ltd",
5
5
  "description": "The eslint plugin to enforce and educate on Atlassian's UI Styling Standard",
6
6
  "license": "Apache-2.0",