@atlaskit/eslint-plugin-ui-styling-standard 0.9.1 → 0.11.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +2 -0
  3. package/constellation/index/overview.mdx +2 -0
  4. package/constellation/no-dynamic-styles/usage.mdx +128 -0
  5. package/constellation/no-unsafe-values/usage.mdx +222 -0
  6. package/dist/cjs/presets/all.codegen.js +3 -1
  7. package/dist/cjs/presets/recommended.codegen.js +3 -1
  8. package/dist/cjs/rules/index.codegen.js +6 -2
  9. package/dist/cjs/rules/no-dynamic-styles/index.js +69 -0
  10. package/dist/cjs/rules/no-unsafe-values/index.js +85 -0
  11. package/dist/cjs/rules/no-unsafe-values/messages.js +24 -0
  12. package/dist/cjs/rules/no-unsafe-values/utils.js +437 -0
  13. package/dist/es2019/presets/all.codegen.js +3 -1
  14. package/dist/es2019/presets/recommended.codegen.js +3 -1
  15. package/dist/es2019/rules/index.codegen.js +6 -2
  16. package/dist/es2019/rules/no-dynamic-styles/index.js +51 -0
  17. package/dist/es2019/rules/no-unsafe-values/index.js +80 -0
  18. package/dist/es2019/rules/no-unsafe-values/messages.js +72 -0
  19. package/dist/es2019/rules/no-unsafe-values/utils.js +350 -0
  20. package/dist/esm/presets/all.codegen.js +3 -1
  21. package/dist/esm/presets/recommended.codegen.js +3 -1
  22. package/dist/esm/rules/index.codegen.js +6 -2
  23. package/dist/esm/rules/no-dynamic-styles/index.js +62 -0
  24. package/dist/esm/rules/no-unsafe-values/index.js +79 -0
  25. package/dist/esm/rules/no-unsafe-values/messages.js +17 -0
  26. package/dist/esm/rules/no-unsafe-values/utils.js +430 -0
  27. package/dist/types/index.codegen.d.ts +4 -0
  28. package/dist/types/presets/all.codegen.d.ts +3 -1
  29. package/dist/types/presets/recommended.codegen.d.ts +3 -1
  30. package/dist/types/rules/index.codegen.d.ts +2 -0
  31. package/dist/types/rules/no-dynamic-styles/index.d.ts +2 -0
  32. package/dist/types/rules/no-unsafe-values/index.d.ts +2 -0
  33. package/dist/types/rules/no-unsafe-values/messages.d.ts +13 -0
  34. package/dist/types/rules/no-unsafe-values/utils.d.ts +28 -0
  35. package/dist/types-ts4.5/index.codegen.d.ts +4 -0
  36. package/dist/types-ts4.5/presets/all.codegen.d.ts +3 -1
  37. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +3 -1
  38. package/dist/types-ts4.5/rules/index.codegen.d.ts +2 -0
  39. package/dist/types-ts4.5/rules/no-dynamic-styles/index.d.ts +2 -0
  40. package/dist/types-ts4.5/rules/no-unsafe-values/index.d.ts +2 -0
  41. package/dist/types-ts4.5/rules/no-unsafe-values/messages.d.ts +13 -0
  42. package/dist/types-ts4.5/rules/no-unsafe-values/utils.d.ts +28 -0
  43. package/package.json +5 -4
  44. package/src/presets/all.codegen.tsx +3 -1
  45. package/src/presets/recommended.codegen.tsx +3 -1
  46. package/src/rules/index.codegen.tsx +5 -1
  47. package/src/rules/no-dynamic-styles/README.md +126 -0
  48. package/src/rules/no-dynamic-styles/__tests__/rule.test.tsx +128 -0
  49. package/src/rules/no-dynamic-styles/index.tsx +63 -0
  50. package/src/rules/no-unsafe-values/README.md +220 -0
  51. package/src/rules/no-unsafe-values/__tests__/no-array-values.test.tsx +27 -0
  52. package/src/rules/no-unsafe-values/__tests__/no-conditional-values.test.tsx +37 -0
  53. package/src/rules/no-unsafe-values/__tests__/no-dynamic-keys.test.tsx +229 -0
  54. package/src/rules/no-unsafe-values/__tests__/no-function-calls.test.tsx +267 -0
  55. package/src/rules/no-unsafe-values/__tests__/no-identifier-arguments.test.tsx +52 -0
  56. package/src/rules/no-unsafe-values/__tests__/no-object-access.test.tsx +106 -0
  57. package/src/rules/no-unsafe-values/__tests__/no-object-references.test.tsx +44 -0
  58. package/src/rules/no-unsafe-values/__tests__/no-spread-elements.test.tsx +48 -0
  59. package/src/rules/no-unsafe-values/__tests__/no-unsafe-values.test.tsx +75 -0
  60. package/src/rules/no-unsafe-values/__tests__/no-variables.test.tsx +121 -0
  61. package/src/rules/no-unsafe-values/index.tsx +96 -0
  62. package/src/rules/no-unsafe-values/messages.tsx +86 -0
  63. package/src/rules/no-unsafe-values/utils.tsx +399 -0
@@ -0,0 +1,430 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
+ import { getAllowedDynamicKeys, getAllowedFunctionCalls, isAllowListedVariable } from '@atlaskit/eslint-utils/allowed-function-calls';
7
+ import { findIdentifierNode } from '@atlaskit/eslint-utils/find-identifier-node';
8
+ import { findVariable } from '@atlaskit/eslint-utils/find-variable';
9
+ function isReferenceToCssVar(variable) {
10
+ var definitions = variable.defs;
11
+ return definitions.every(function (definition) {
12
+ if (definition.type !== 'Variable') {
13
+ return false;
14
+ }
15
+ var initializer = definition.node.init;
16
+ if (!initializer) {
17
+ return false;
18
+ }
19
+ return initializer.type === 'Literal' && typeof initializer.value === 'string' && initializer.value.startsWith('--');
20
+ });
21
+ }
22
+ export var Linter = /*#__PURE__*/function () {
23
+ function Linter(context, baseNode) {
24
+ _classCallCheck(this, Linter);
25
+ this.context = context;
26
+ this.baseNode = baseNode;
27
+ this.allowedDynamicKeys = getAllowedDynamicKeys(context.options);
28
+ this.allowedFunctionCalls = getAllowedFunctionCalls(context.options);
29
+ }
30
+
31
+ /**
32
+ * Wrapper around `context.report` to provide type checking on the message ID.
33
+ */
34
+ _createClass(Linter, [{
35
+ key: "report",
36
+ value: function report(descriptor) {
37
+ this.context.report(descriptor);
38
+ }
39
+
40
+ /**
41
+ * Fallback case to lint any identifier that is not otherwise handled.
42
+ */
43
+ }, {
44
+ key: "lintUnhandledIdentifier",
45
+ value: function lintUnhandledIdentifier(identifier) {
46
+ this.report({
47
+ node: identifier,
48
+ messageId: 'no-variables'
49
+ });
50
+ }
51
+ }, {
52
+ key: "lintIdentifier",
53
+ value: function lintIdentifier(value) {
54
+ var _this = this;
55
+ if (value.name === 'undefined') {
56
+ /**
57
+ * `undefined` gets caught implicitly anyway by other checks below,
58
+ * but we are explicitly handling it here.
59
+ *
60
+ * We could potentially introduce a distinct message for it as well.
61
+ */
62
+ this.lintUnhandledIdentifier(value);
63
+ return;
64
+ }
65
+ var variable = findVariable({
66
+ identifier: value,
67
+ sourceCode: this.context.sourceCode
68
+ });
69
+ if (!variable) {
70
+ this.lintUnhandledIdentifier(value);
71
+ return;
72
+ }
73
+
74
+ /**
75
+ * Allows using whitelisted imported values
76
+ */
77
+ if (isAllowListedVariable({
78
+ allowList: this.allowedFunctionCalls,
79
+ variable: variable
80
+ })) {
81
+ return;
82
+ }
83
+ var definitions = variable.defs;
84
+ if (definitions.length === 0) {
85
+ this.lintUnhandledIdentifier(value);
86
+ return;
87
+ }
88
+ definitions.forEach(function (definition) {
89
+ if (definition.type === 'Variable') {
90
+ var initializer = definition.node.init;
91
+ if (!initializer) {
92
+ _this.lintUnhandledIdentifier(value);
93
+ return;
94
+ }
95
+
96
+ /**
97
+ * Variables can be used if they resolve to a literal.
98
+ */
99
+ if (initializer.type === 'Literal') {
100
+ return;
101
+ }
102
+
103
+ /**
104
+ * Not allowing tagged template expressions through variables.
105
+ */
106
+ if (initializer.type === 'TaggedTemplateExpression') {
107
+ _this.report({
108
+ node: value,
109
+ messageId: 'no-function-calls'
110
+ });
111
+ return;
112
+ }
113
+
114
+ /**
115
+ * Variables can be used if they resolve to an allowed function call.
116
+ */
117
+ if (initializer.type === 'CallExpression') {
118
+ if (_this.isAllowedFunctionCall(initializer)) {
119
+ return;
120
+ }
121
+ _this.report({
122
+ node: value,
123
+ messageId: 'no-function-calls'
124
+ });
125
+ return;
126
+ }
127
+ if (initializer.type === 'TemplateLiteral') {
128
+ var _iterator = _createForOfIteratorHelper(initializer.expressions),
129
+ _step;
130
+ try {
131
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
132
+ var expression = _step.value;
133
+ _this.lintValue(expression);
134
+ }
135
+ } catch (err) {
136
+ _iterator.e(err);
137
+ } finally {
138
+ _iterator.f();
139
+ }
140
+ return;
141
+ }
142
+
143
+ /**
144
+ * This branch is only here for clarity.
145
+ *
146
+ * We could fallback to `no-variables` for it too.
147
+ */
148
+ if (initializer.type === 'ObjectExpression') {
149
+ _this.report({
150
+ node: value,
151
+ messageId: 'no-object-references'
152
+ });
153
+ return;
154
+ }
155
+ }
156
+ _this.lintUnhandledIdentifier(value);
157
+ });
158
+ }
159
+ }, {
160
+ key: "isAllowedDynamicKey",
161
+ value: function isAllowedDynamicKey(expression) {
162
+ var identifier = findIdentifierNode(expression);
163
+ if (!identifier) {
164
+ return false;
165
+ }
166
+ var variable = findVariable({
167
+ identifier: identifier,
168
+ sourceCode: this.context.sourceCode
169
+ });
170
+ if (!variable) {
171
+ return false;
172
+ }
173
+ return isReferenceToCssVar(variable) || isAllowListedVariable({
174
+ allowList: this.allowedDynamicKeys,
175
+ variable: variable
176
+ });
177
+ }
178
+ }, {
179
+ key: "lintKey",
180
+ value: function lintKey(property) {
181
+ /**
182
+ * If it's not computed then it must be a plain string.
183
+ *
184
+ * Private identifiers cannot be computed,
185
+ * but we need the extra check for type narrowing.
186
+ */
187
+ if (!property.computed || property.key.type === 'PrivateIdentifier') {
188
+ return;
189
+ }
190
+
191
+ /**
192
+ * Some dynamic keys are explicitly allowed.
193
+ */
194
+ if (this.isAllowedDynamicKey(property.key)) {
195
+ return;
196
+ }
197
+ this.report({
198
+ node: property.key,
199
+ messageId: 'no-dynamic-keys'
200
+ });
201
+ }
202
+ }, {
203
+ key: "isAllowedFunctionCall",
204
+ value: function isAllowedFunctionCall(value) {
205
+ var identifier = findIdentifierNode(value);
206
+ if (!identifier) {
207
+ return false;
208
+ }
209
+ var variable = findVariable({
210
+ identifier: identifier,
211
+ sourceCode: this.context.sourceCode
212
+ });
213
+ if (!variable) {
214
+ return false;
215
+ }
216
+ return isAllowListedVariable({
217
+ allowList: this.allowedFunctionCalls,
218
+ variable: variable
219
+ });
220
+ }
221
+ }, {
222
+ key: "lintFunctionCall",
223
+ value: function lintFunctionCall(value) {
224
+ if (this.isAllowedFunctionCall(value)) {
225
+ return;
226
+ }
227
+ this.report({
228
+ node: value,
229
+ messageId: 'no-function-calls'
230
+ });
231
+ }
232
+ }, {
233
+ key: "lintObjectExpression",
234
+ value: function lintObjectExpression(expression) {
235
+ var _iterator2 = _createForOfIteratorHelper(expression.properties),
236
+ _step2;
237
+ try {
238
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
239
+ var property = _step2.value;
240
+ if (property.type === 'SpreadElement') {
241
+ this.report({
242
+ node: property,
243
+ messageId: 'no-spread-elements'
244
+ });
245
+ } else {
246
+ this.lintKey(property);
247
+ this.lintValue(property.value);
248
+ }
249
+ }
250
+ } catch (err) {
251
+ _iterator2.e(err);
252
+ } finally {
253
+ _iterator2.f();
254
+ }
255
+ }
256
+ }, {
257
+ key: "lintUnhandledValue",
258
+ value: function lintUnhandledValue(value) {
259
+ /**
260
+ * Default to blocking value if it isn't explictly handled.
261
+ */
262
+ this.report({
263
+ node: value,
264
+ messageId: 'no-unsafe-values'
265
+ });
266
+ }
267
+ }, {
268
+ key: "lintValue",
269
+ value: function lintValue(value) {
270
+ /**
271
+ * Literals are always allowed by this rule.
272
+ */
273
+ if (value.type === 'Literal') {
274
+ return;
275
+ }
276
+
277
+ /**
278
+ * Allow negative numbers.
279
+ */
280
+ if (value.type === 'UnaryExpression' && value.operator === '-' && value.argument.type === 'Literal') {
281
+ return;
282
+ }
283
+ if (value.type === 'TemplateLiteral') {
284
+ var _iterator3 = _createForOfIteratorHelper(value.expressions),
285
+ _step3;
286
+ try {
287
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
288
+ var expression = _step3.value;
289
+ this.lintValue(expression);
290
+ }
291
+ } catch (err) {
292
+ _iterator3.e(err);
293
+ } finally {
294
+ _iterator3.f();
295
+ }
296
+ return;
297
+ }
298
+ if (value.type === 'ConditionalExpression' || value.type === 'LogicalExpression') {
299
+ this.report({
300
+ node: value,
301
+ messageId: 'no-conditional-values'
302
+ });
303
+ return;
304
+ }
305
+ if (value.type === 'BinaryExpression') {
306
+ this.lintValue(value.left);
307
+ this.lintValue(value.right);
308
+ return;
309
+ }
310
+ if (value.type === 'ObjectExpression') {
311
+ this.lintObjectExpression(value);
312
+ return;
313
+ }
314
+ if (value.type === 'Identifier') {
315
+ this.lintIdentifier(value);
316
+ return;
317
+ }
318
+ if (value.type === 'TaggedTemplateExpression') {
319
+ this.report({
320
+ node: value,
321
+ messageId: 'no-function-calls'
322
+ });
323
+ return;
324
+ }
325
+ if (value.type === 'CallExpression') {
326
+ this.lintFunctionCall(value);
327
+ return;
328
+ }
329
+ if (value.type === 'ArrowFunctionExpression' || value.type === 'FunctionExpression') {
330
+ /**
331
+ * Function values are handled by `no-dynamic-styles` instead
332
+ */
333
+ return;
334
+ }
335
+ if (value.type === 'MemberExpression') {
336
+ this.report({
337
+ node: value,
338
+ messageId: 'no-object-access'
339
+ });
340
+ return;
341
+ }
342
+ if (value.type === 'ArrayExpression') {
343
+ this.report({
344
+ node: value,
345
+ messageId: 'no-array-values'
346
+ });
347
+ return;
348
+ }
349
+ this.lintUnhandledValue(value);
350
+ }
351
+ }, {
352
+ key: "lintArgument",
353
+ value: function lintArgument(argument) {
354
+ if (argument.type === 'ArrowFunctionExpression') {
355
+ if (argument.body.type === 'ObjectExpression') {
356
+ // Something in this form:
357
+ //
358
+ // const styles = styled.div(
359
+ // (props) => ({ color: props.height }),
360
+ // );
361
+ this.lintArgument(argument.body);
362
+ }
363
+ return;
364
+ }
365
+ if (argument.type === 'ArrayExpression') {
366
+ var _iterator4 = _createForOfIteratorHelper(argument.elements),
367
+ _step4;
368
+ try {
369
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
370
+ var element = _step4.value;
371
+ if (element === null) {
372
+ continue;
373
+ }
374
+ this.lintArgument(element);
375
+ }
376
+ } catch (err) {
377
+ _iterator4.e(err);
378
+ } finally {
379
+ _iterator4.f();
380
+ }
381
+ return;
382
+ }
383
+ if (argument.type === 'ObjectExpression') {
384
+ this.lintObjectExpression(argument);
385
+ return;
386
+ }
387
+ if (argument.type === 'CallExpression') {
388
+ this.lintFunctionCall(argument);
389
+ return;
390
+ }
391
+ if (argument.type === 'ConditionalExpression' || argument.type === 'LogicalExpression') {
392
+ this.report({
393
+ node: argument,
394
+ messageId: 'no-conditional-values'
395
+ });
396
+ return;
397
+ }
398
+ if (argument.type === 'Identifier' || argument.type === 'MemberExpression') {
399
+ this.report({
400
+ node: argument,
401
+ messageId: 'no-identifier-arguments'
402
+ });
403
+ return;
404
+ }
405
+ this.lintUnhandledValue(argument);
406
+ }
407
+ }, {
408
+ key: "lintArguments",
409
+ value: function lintArguments(args) {
410
+ var _iterator5 = _createForOfIteratorHelper(args),
411
+ _step5;
412
+ try {
413
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
414
+ var argument = _step5.value;
415
+ this.lintArgument(argument);
416
+ }
417
+ } catch (err) {
418
+ _iterator5.e(err);
419
+ } finally {
420
+ _iterator5.f();
421
+ }
422
+ }
423
+ }, {
424
+ key: "run",
425
+ value: function run() {
426
+ this.lintArguments(this.baseNode.arguments);
427
+ }
428
+ }]);
429
+ return Linter;
430
+ }();
@@ -9,8 +9,10 @@ export declare const configs: {
9
9
  '@atlaskit/ui-styling-standard/no-array-arguments': string;
10
10
  '@atlaskit/ui-styling-standard/no-classname-prop': string;
11
11
  '@atlaskit/ui-styling-standard/no-container-queries': string;
12
+ '@atlaskit/ui-styling-standard/no-dynamic-styles': string;
12
13
  '@atlaskit/ui-styling-standard/no-important-styles': string;
13
14
  '@atlaskit/ui-styling-standard/no-nested-selectors': string;
15
+ '@atlaskit/ui-styling-standard/no-unsafe-values': string;
14
16
  '@atlaskit/design-system/consistent-css-prop-usage': (string | {
15
17
  excludeReactComponents: boolean;
16
18
  })[];
@@ -42,8 +44,10 @@ export declare const configs: {
42
44
  '@atlaskit/ui-styling-standard/no-array-arguments': string;
43
45
  '@atlaskit/ui-styling-standard/no-classname-prop': string;
44
46
  '@atlaskit/ui-styling-standard/no-container-queries': string;
47
+ '@atlaskit/ui-styling-standard/no-dynamic-styles': string;
45
48
  '@atlaskit/ui-styling-standard/no-important-styles': string;
46
49
  '@atlaskit/ui-styling-standard/no-nested-selectors': string;
50
+ '@atlaskit/ui-styling-standard/no-unsafe-values': string;
47
51
  '@atlaskit/design-system/consistent-css-prop-usage': (string | {
48
52
  excludeReactComponents: boolean;
49
53
  })[];
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::f2d8f76f2f41101bd777223bb368ede0>>
3
+ * @codegen <<SignedSource::544c8b1c0eb0d6329064dcf92e18e45e>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
  declare const _default: {
@@ -12,8 +12,10 @@ declare const _default: {
12
12
  '@atlaskit/ui-styling-standard/no-array-arguments': string;
13
13
  '@atlaskit/ui-styling-standard/no-classname-prop': string;
14
14
  '@atlaskit/ui-styling-standard/no-container-queries': string;
15
+ '@atlaskit/ui-styling-standard/no-dynamic-styles': string;
15
16
  '@atlaskit/ui-styling-standard/no-important-styles': string;
16
17
  '@atlaskit/ui-styling-standard/no-nested-selectors': string;
18
+ '@atlaskit/ui-styling-standard/no-unsafe-values': string;
17
19
  '@atlaskit/design-system/consistent-css-prop-usage': (string | {
18
20
  excludeReactComponents: boolean;
19
21
  })[];
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::f2d8f76f2f41101bd777223bb368ede0>>
3
+ * @codegen <<SignedSource::544c8b1c0eb0d6329064dcf92e18e45e>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
  declare const _default: {
@@ -12,8 +12,10 @@ declare const _default: {
12
12
  '@atlaskit/ui-styling-standard/no-array-arguments': string;
13
13
  '@atlaskit/ui-styling-standard/no-classname-prop': string;
14
14
  '@atlaskit/ui-styling-standard/no-container-queries': string;
15
+ '@atlaskit/ui-styling-standard/no-dynamic-styles': string;
15
16
  '@atlaskit/ui-styling-standard/no-important-styles': string;
16
17
  '@atlaskit/ui-styling-standard/no-nested-selectors': string;
18
+ '@atlaskit/ui-styling-standard/no-unsafe-values': string;
17
19
  '@atlaskit/design-system/consistent-css-prop-usage': (string | {
18
20
  excludeReactComponents: boolean;
19
21
  })[];
@@ -5,7 +5,9 @@ declare const _default: {
5
5
  'no-array-arguments': import("eslint").Rule.RuleModule;
6
6
  'no-classname-prop': import("eslint").Rule.RuleModule;
7
7
  'no-container-queries': import("eslint").Rule.RuleModule;
8
+ 'no-dynamic-styles': import("eslint").Rule.RuleModule;
8
9
  'no-important-styles': import("eslint").Rule.RuleModule;
9
10
  'no-nested-selectors': import("eslint").Rule.RuleModule;
11
+ 'no-unsafe-values': import("eslint").Rule.RuleModule;
10
12
  };
11
13
  export default _default;
@@ -0,0 +1,2 @@
1
+ export declare const rule: import("eslint").Rule.RuleModule;
2
+ export default rule;
@@ -0,0 +1,2 @@
1
+ export declare const rule: import("eslint").Rule.RuleModule;
2
+ export default rule;
@@ -0,0 +1,13 @@
1
+ export declare const messages: {
2
+ 'no-array-values': string;
3
+ 'no-conditional-values': string;
4
+ 'no-dynamic-keys': string;
5
+ 'no-function-calls': string;
6
+ 'no-identifier-arguments': string;
7
+ 'no-object-access': string;
8
+ 'no-object-references': string;
9
+ 'no-spread-elements': string;
10
+ 'no-unsafe-values': string;
11
+ 'no-variables': string;
12
+ };
13
+ export type MessageId = keyof typeof messages;
@@ -0,0 +1,28 @@
1
+ import type { CallExpression } from 'estree-jsx';
2
+ import type { Rule } from 'eslint';
3
+ export declare class Linter {
4
+ private readonly context;
5
+ private readonly baseNode;
6
+ private readonly allowedDynamicKeys;
7
+ private readonly allowedFunctionCalls;
8
+ constructor(context: Rule.RuleContext, baseNode: CallExpression);
9
+ /**
10
+ * Wrapper around `context.report` to provide type checking on the message ID.
11
+ */
12
+ private report;
13
+ /**
14
+ * Fallback case to lint any identifier that is not otherwise handled.
15
+ */
16
+ private lintUnhandledIdentifier;
17
+ private lintIdentifier;
18
+ private isAllowedDynamicKey;
19
+ private lintKey;
20
+ private isAllowedFunctionCall;
21
+ private lintFunctionCall;
22
+ private lintObjectExpression;
23
+ private lintUnhandledValue;
24
+ private lintValue;
25
+ private lintArgument;
26
+ private lintArguments;
27
+ run(): void;
28
+ }
@@ -9,8 +9,10 @@ export declare const configs: {
9
9
  '@atlaskit/ui-styling-standard/no-array-arguments': string;
10
10
  '@atlaskit/ui-styling-standard/no-classname-prop': string;
11
11
  '@atlaskit/ui-styling-standard/no-container-queries': string;
12
+ '@atlaskit/ui-styling-standard/no-dynamic-styles': string;
12
13
  '@atlaskit/ui-styling-standard/no-important-styles': string;
13
14
  '@atlaskit/ui-styling-standard/no-nested-selectors': string;
15
+ '@atlaskit/ui-styling-standard/no-unsafe-values': string;
14
16
  '@atlaskit/design-system/consistent-css-prop-usage': (string | {
15
17
  excludeReactComponents: boolean;
16
18
  })[];
@@ -42,8 +44,10 @@ export declare const configs: {
42
44
  '@atlaskit/ui-styling-standard/no-array-arguments': string;
43
45
  '@atlaskit/ui-styling-standard/no-classname-prop': string;
44
46
  '@atlaskit/ui-styling-standard/no-container-queries': string;
47
+ '@atlaskit/ui-styling-standard/no-dynamic-styles': string;
45
48
  '@atlaskit/ui-styling-standard/no-important-styles': string;
46
49
  '@atlaskit/ui-styling-standard/no-nested-selectors': string;
50
+ '@atlaskit/ui-styling-standard/no-unsafe-values': string;
47
51
  '@atlaskit/design-system/consistent-css-prop-usage': (string | {
48
52
  excludeReactComponents: boolean;
49
53
  })[];
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::f2d8f76f2f41101bd777223bb368ede0>>
3
+ * @codegen <<SignedSource::544c8b1c0eb0d6329064dcf92e18e45e>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
  declare const _default: {
@@ -12,8 +12,10 @@ declare const _default: {
12
12
  '@atlaskit/ui-styling-standard/no-array-arguments': string;
13
13
  '@atlaskit/ui-styling-standard/no-classname-prop': string;
14
14
  '@atlaskit/ui-styling-standard/no-container-queries': string;
15
+ '@atlaskit/ui-styling-standard/no-dynamic-styles': string;
15
16
  '@atlaskit/ui-styling-standard/no-important-styles': string;
16
17
  '@atlaskit/ui-styling-standard/no-nested-selectors': string;
18
+ '@atlaskit/ui-styling-standard/no-unsafe-values': string;
17
19
  '@atlaskit/design-system/consistent-css-prop-usage': (string | {
18
20
  excludeReactComponents: boolean;
19
21
  })[];
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::f2d8f76f2f41101bd777223bb368ede0>>
3
+ * @codegen <<SignedSource::544c8b1c0eb0d6329064dcf92e18e45e>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
  declare const _default: {
@@ -12,8 +12,10 @@ declare const _default: {
12
12
  '@atlaskit/ui-styling-standard/no-array-arguments': string;
13
13
  '@atlaskit/ui-styling-standard/no-classname-prop': string;
14
14
  '@atlaskit/ui-styling-standard/no-container-queries': string;
15
+ '@atlaskit/ui-styling-standard/no-dynamic-styles': string;
15
16
  '@atlaskit/ui-styling-standard/no-important-styles': string;
16
17
  '@atlaskit/ui-styling-standard/no-nested-selectors': string;
18
+ '@atlaskit/ui-styling-standard/no-unsafe-values': string;
17
19
  '@atlaskit/design-system/consistent-css-prop-usage': (string | {
18
20
  excludeReactComponents: boolean;
19
21
  })[];
@@ -5,7 +5,9 @@ declare const _default: {
5
5
  'no-array-arguments': import("eslint").Rule.RuleModule;
6
6
  'no-classname-prop': import("eslint").Rule.RuleModule;
7
7
  'no-container-queries': import("eslint").Rule.RuleModule;
8
+ 'no-dynamic-styles': import("eslint").Rule.RuleModule;
8
9
  'no-important-styles': import("eslint").Rule.RuleModule;
9
10
  'no-nested-selectors': import("eslint").Rule.RuleModule;
11
+ 'no-unsafe-values': import("eslint").Rule.RuleModule;
10
12
  };
11
13
  export default _default;
@@ -0,0 +1,2 @@
1
+ export declare const rule: import("eslint").Rule.RuleModule;
2
+ export default rule;
@@ -0,0 +1,2 @@
1
+ export declare const rule: import("eslint").Rule.RuleModule;
2
+ export default rule;
@@ -0,0 +1,13 @@
1
+ export declare const messages: {
2
+ 'no-array-values': string;
3
+ 'no-conditional-values': string;
4
+ 'no-dynamic-keys': string;
5
+ 'no-function-calls': string;
6
+ 'no-identifier-arguments': string;
7
+ 'no-object-access': string;
8
+ 'no-object-references': string;
9
+ 'no-spread-elements': string;
10
+ 'no-unsafe-values': string;
11
+ 'no-variables': string;
12
+ };
13
+ export type MessageId = keyof typeof messages;
@@ -0,0 +1,28 @@
1
+ import type { CallExpression } from 'estree-jsx';
2
+ import type { Rule } from 'eslint';
3
+ export declare class Linter {
4
+ private readonly context;
5
+ private readonly baseNode;
6
+ private readonly allowedDynamicKeys;
7
+ private readonly allowedFunctionCalls;
8
+ constructor(context: Rule.RuleContext, baseNode: CallExpression);
9
+ /**
10
+ * Wrapper around `context.report` to provide type checking on the message ID.
11
+ */
12
+ private report;
13
+ /**
14
+ * Fallback case to lint any identifier that is not otherwise handled.
15
+ */
16
+ private lintUnhandledIdentifier;
17
+ private lintIdentifier;
18
+ private isAllowedDynamicKey;
19
+ private lintKey;
20
+ private isAllowedFunctionCall;
21
+ private lintFunctionCall;
22
+ private lintObjectExpression;
23
+ private lintUnhandledValue;
24
+ private lintValue;
25
+ private lintArgument;
26
+ private lintArguments;
27
+ run(): void;
28
+ }