@atlaskit/eslint-plugin-ui-styling-standard 2.3.0 → 2.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +20 -20
  3. package/dist/cjs/presets/all-flat.codegen.js +2 -2
  4. package/dist/cjs/presets/all.codegen.js +2 -2
  5. package/dist/cjs/presets/recommended-flat.codegen.js +2 -2
  6. package/dist/cjs/presets/recommended.codegen.js +2 -2
  7. package/dist/cjs/rules/no-atlaskit-theme/index.js +1 -1
  8. package/dist/cjs/rules/no-imported-style-values/index.js +8 -1
  9. package/dist/cjs/rules/no-nested-selectors/index.js +13 -1
  10. package/dist/cjs/rules/no-unsafe-selectors/constants.js +4 -1
  11. package/dist/cjs/rules/no-unsafe-selectors/lint-selector.js +28 -1
  12. package/dist/es2019/presets/all-flat.codegen.js +2 -2
  13. package/dist/es2019/presets/all.codegen.js +2 -2
  14. package/dist/es2019/presets/recommended-flat.codegen.js +2 -2
  15. package/dist/es2019/presets/recommended.codegen.js +2 -2
  16. package/dist/es2019/rules/no-atlaskit-theme/index.js +1 -1
  17. package/dist/es2019/rules/no-imported-style-values/index.js +8 -1
  18. package/dist/es2019/rules/no-nested-selectors/index.js +13 -1
  19. package/dist/es2019/rules/no-unsafe-selectors/constants.js +4 -1
  20. package/dist/es2019/rules/no-unsafe-selectors/lint-selector.js +26 -1
  21. package/dist/esm/presets/all-flat.codegen.js +2 -2
  22. package/dist/esm/presets/all.codegen.js +2 -2
  23. package/dist/esm/presets/recommended-flat.codegen.js +2 -2
  24. package/dist/esm/presets/recommended.codegen.js +2 -2
  25. package/dist/esm/rules/no-atlaskit-theme/index.js +1 -1
  26. package/dist/esm/rules/no-imported-style-values/index.js +8 -1
  27. package/dist/esm/rules/no-nested-selectors/index.js +13 -1
  28. package/dist/esm/rules/no-unsafe-selectors/constants.js +4 -1
  29. package/dist/esm/rules/no-unsafe-selectors/lint-selector.js +28 -1
  30. package/dist/types/presets/all-flat.codegen.d.ts +1 -1
  31. package/dist/types/presets/all.codegen.d.ts +1 -1
  32. package/dist/types/presets/recommended-flat.codegen.d.ts +1 -1
  33. package/dist/types/presets/recommended.codegen.d.ts +1 -1
  34. package/dist/types/rules/no-unsafe-selectors/constants.d.ts +1 -1
  35. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # @atlaskit/eslint-plugin-ui-styling-standard
2
2
 
3
+ ## 2.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`3e2e34bcc2601`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3e2e34bcc2601) -
8
+ `no-imported-style-values`: no longer reports imported identifiers used in qualified type
9
+ positions, such as `'value' satisfies typeof Tokens.COLOR_TEXT` or
10
+ `'value' satisfies Theme.Color`. These are erased at runtime and are not imported style values.
11
+ - [`a5979af0b9045`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a5979af0b9045) -
12
+ `no-nested-selectors` now lints computed keys wrapped in TypeScript expressions (`satisfies`,
13
+ `as`, type assertions, non-null), e.g. `['.foo' satisfies \`.${typeof FOO_CLASS}\`]`. Previously
14
+ these keys were silently skipped.
15
+
16
+ ## 2.4.0
17
+
18
+ ### Minor Changes
19
+
20
+ - [`187f8c82f1f1e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/187f8c82f1f1e) -
21
+ Raise `no-atlaskit-theme` from a warning to an error in the recommended config. Imports from
22
+ `@atlaskit/theme` now fail lint unless they are removed or disabled.
23
+
24
+ ### Patch Changes
25
+
26
+ - [`9ca54438f46bf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9ca54438f46bf) -
27
+ `no-unsafe-selectors` now honours chained pseudos in its allowlist. `&:focus:not(:focus-visible)`
28
+ was allowlisted but still reported, because each pseudo was checked on its own and `:not` is not
29
+ allowed alone. Other uses of `:not`, such as `&:hover:not(:focus-visible)`, are still reported.
30
+ - [`9ca54438f46bf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9ca54438f46bf) -
31
+ `no-unsafe-selectors` now allows the vendor pseudo-elements that have no standard equivalent:
32
+ `::-moz-focus-inner`, `::-moz-focus-outer`, `::-moz-range-progress`, `::-moz-range-thumb`,
33
+ `::-moz-range-track`, `::-webkit-slider-runnable-track`, and `::-webkit-slider-thumb`. Other
34
+ vendor pseudos, such as `::-webkit-scrollbar` and `::-ms-clear`, are still reported.
35
+
3
36
  ## 2.3.0
4
37
 
5
38
  ### Minor Changes
package/README.md CHANGED
@@ -42,26 +42,26 @@ module.exports = {
42
42
 
43
43
  | Rule | Description | Recommended | Fixable | Suggestions |
44
44
  | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- | ------- | ----------- |
45
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/atlaskit-theme/README.md">atlaskit-theme</a> | Ban certain usages of `@atlaskit/theme` that `@compiled/react` does not understand | Yes | | |
46
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/convert-props-syntax/README.md">convert-props-syntax</a> | Convert props syntax that is unsupported by styled-components@<4 or @emotion/styled to props syntax that is supported. This is useful when used in conjunction with `no-styled-tagged-template-expression`, as output from the latter may use props syntax unsupported by those libraries. | Yes | Yes | |
47
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/enforce-style-prop/README.md">enforce-style-prop</a> | Disallows usage of static styles in the `style` attribute in components | Yes | | |
48
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/local-cx-xcss/README.md">local-cx-xcss</a> | Ensures the cx() function, which is part of the XCSS API, is only used within the xcss prop. This aids tracking what styles are applied to a jsx element. | Yes | | |
49
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/no-array-arguments/README.md">no-array-arguments</a> | Prevents usage of array arguments to style declaration functions | Yes | Yes | |
50
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/no-atlaskit-theme/README.md">no-atlaskit-theme</a> | Disallow imports from `@atlaskit/theme` | Yes | | |
51
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/no-classname-prop/README.md">no-classname-prop</a> | Disallows usage of the `className` prop in JSX | Yes | | |
52
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/no-container-queries/README.md">no-container-queries</a> | Prevents usage of @container query within css styling | Yes | | |
53
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/no-dynamic-styles/README.md">no-dynamic-styles</a> | Disallows use of dynamic styles in CSS-in-JS calls | Yes | | |
54
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/no-exported-styles/README.md">no-exported-styles</a> | Disallows exports of css, keyframes, styled and xcss | Yes | | |
55
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/no-global-styles/README.md">no-global-styles</a> | Prevents global styles through CSS-in-JS or CSS module imports | Yes | | |
56
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/no-important-styles/README.md">no-important-styles</a> | Disallows important style declarations | Yes | | |
57
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/no-imported-style-values/README.md">no-imported-style-values</a> | Disallows imports of style values | Yes | | |
58
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/no-nested-selectors/README.md">no-nested-selectors</a> | Prevents usage of nested selectors within css styling | Yes | | |
59
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/no-styled/README.md">no-styled</a> | Disallows usage of the `styled` imports | Yes | | |
60
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/no-top-layer-unsafe-selectors/README.md">no-top-layer-unsafe-selectors</a> | Disallows selectors that a Design System layering surface rendered in the browser top layer can wrongly match, or wrongly displace. | | Yes | |
61
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/no-unsafe-selectors/README.md">no-unsafe-selectors</a> | Disallows use of nested styles in `css` functions. | Yes | Yes | Yes |
62
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/no-unsafe-values/README.md">no-unsafe-values</a> | Disallows styles that are difficult/impossible to statically anaylze. | Yes | | |
63
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/no-unused-cssmap-properties/README.md">no-unused-cssmap-properties</a> | Detects unused properties in cssMap style objects that are not exported. Helps maintain clean code by identifying style variants that are defined but never used. | Yes | | |
64
- | <a href="./packages/design-system/eslint-plugin-ui-styling-standard/src/rules/use-compiled/README.md">use-compiled</a> | Ensures usage of `@compiled/react` or `@atlaskit/css` instead of other CSS-in-JS libraries | Yes | Yes | |
45
+ | <a href="./src/rules/atlaskit-theme/README.md">atlaskit-theme</a> | Ban certain usages of `@atlaskit/theme` that `@compiled/react` does not understand | Yes | | |
46
+ | <a href="./src/rules/convert-props-syntax/README.md">convert-props-syntax</a> | Convert props syntax that is unsupported by styled-components@<4 or @emotion/styled to props syntax that is supported. This is useful when used in conjunction with `no-styled-tagged-template-expression`, as output from the latter may use props syntax unsupported by those libraries. | Yes | Yes | |
47
+ | <a href="./src/rules/enforce-style-prop/README.md">enforce-style-prop</a> | Disallows usage of static styles in the `style` attribute in components | Yes | | |
48
+ | <a href="./src/rules/local-cx-xcss/README.md">local-cx-xcss</a> | Ensures the cx() function, which is part of the XCSS API, is only used within the xcss prop. This aids tracking what styles are applied to a jsx element. | Yes | | |
49
+ | <a href="./src/rules/no-array-arguments/README.md">no-array-arguments</a> | Prevents usage of array arguments to style declaration functions | Yes | Yes | |
50
+ | <a href="./src/rules/no-atlaskit-theme/README.md">no-atlaskit-theme</a> | Disallow imports from `@atlaskit/theme` | Yes | | |
51
+ | <a href="./src/rules/no-classname-prop/README.md">no-classname-prop</a> | Disallows usage of the `className` prop in JSX | Yes | | |
52
+ | <a href="./src/rules/no-container-queries/README.md">no-container-queries</a> | Prevents usage of @container query within css styling | Yes | | |
53
+ | <a href="./src/rules/no-dynamic-styles/README.md">no-dynamic-styles</a> | Disallows use of dynamic styles in CSS-in-JS calls | Yes | | |
54
+ | <a href="./src/rules/no-exported-styles/README.md">no-exported-styles</a> | Disallows exports of css, keyframes, styled and xcss | Yes | | |
55
+ | <a href="./src/rules/no-global-styles/README.md">no-global-styles</a> | Prevents global styles through CSS-in-JS or CSS module imports | Yes | | |
56
+ | <a href="./src/rules/no-important-styles/README.md">no-important-styles</a> | Disallows important style declarations | Yes | | |
57
+ | <a href="./src/rules/no-imported-style-values/README.md">no-imported-style-values</a> | Disallows imports of style values | Yes | | |
58
+ | <a href="./src/rules/no-nested-selectors/README.md">no-nested-selectors</a> | Prevents usage of nested selectors within css styling | Yes | | |
59
+ | <a href="./src/rules/no-styled/README.md">no-styled</a> | Disallows usage of the `styled` imports | Yes | | |
60
+ | <a href="./src/rules/no-top-layer-unsafe-selectors/README.md">no-top-layer-unsafe-selectors</a> | Disallows selectors that a Design System layering surface rendered in the browser top layer can wrongly match, or wrongly displace. | | Yes | |
61
+ | <a href="./src/rules/no-unsafe-selectors/README.md">no-unsafe-selectors</a> | Disallows use of nested styles in `css` functions. | Yes | Yes | Yes |
62
+ | <a href="./src/rules/no-unsafe-values/README.md">no-unsafe-values</a> | Disallows styles that are difficult/impossible to statically anaylze. | Yes | | |
63
+ | <a href="./src/rules/no-unused-cssmap-properties/README.md">no-unused-cssmap-properties</a> | Detects unused properties in cssMap style objects that are not exported. Helps maintain clean code by identifying style variants that are defined but never used. | Yes | | |
64
+ | <a href="./src/rules/use-compiled/README.md">use-compiled</a> | Ensures usage of `@compiled/react` or `@atlaskit/css` instead of other CSS-in-JS libraries | Yes | Yes | |
65
65
  | <a href="https://atlassian.design/components/eslint-plugin-ui-styling-standard/consistent-css-prop-usage/usage">@atlaskit/design-system/consistent-css-prop-usage</a> | Ensures consistency with `css` and `xcss` prop usages | Yes | Yes | |
66
66
  | <a href="https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-css-tagged-template-expression/usage">@atlaskit/design-system/no-css-tagged-template-expression</a> | Disallows any `css` tagged template expressions that originate from Emotion, Styled Components or Compiled | Yes | Yes | |
67
67
  | <a href="https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-keyframes-tagged-template-expression/usage">@atlaskit/design-system/no-keyframes-tagged-template-expression</a> | Disallows any `keyframe` tagged template expressions that originate from Emotion, Styled Components or Compiled | Yes | Yes | |
@@ -9,7 +9,7 @@ var atlaskitDesignSystemPlugin = _interopRequireWildcard(require("@atlaskit/esli
9
9
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
10
10
  /**
11
11
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
12
- * @codegen <<SignedSource::b13b370d5591cbe6a4d23e6afa0ee390>>
12
+ * @codegen <<SignedSource::75b18fe1e3e0e0eeeb87a8dd4ed975ae>>
13
13
  * @codegenCommand afm workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
14
14
  */
15
15
 
@@ -24,7 +24,7 @@ var config = {
24
24
  '@atlaskit/ui-styling-standard/enforce-style-prop': 'error',
25
25
  '@atlaskit/ui-styling-standard/local-cx-xcss': 'error',
26
26
  '@atlaskit/ui-styling-standard/no-array-arguments': 'error',
27
- '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'warn',
27
+ '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'error',
28
28
  '@atlaskit/ui-styling-standard/no-classname-prop': 'error',
29
29
  '@atlaskit/ui-styling-standard/no-container-queries': 'error',
30
30
  '@atlaskit/ui-styling-standard/no-dynamic-styles': 'error',
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  /**
8
8
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
9
- * @codegen <<SignedSource::cc3bb00111b60fbcdfa28799aa0671ea>>
9
+ * @codegen <<SignedSource::ff2cac75bedd9b12fc1c17bc6cf66c5c>>
10
10
  * @codegenCommand afm workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
11
11
  */
12
12
 
@@ -18,7 +18,7 @@ var config = {
18
18
  '@atlaskit/ui-styling-standard/enforce-style-prop': 'error',
19
19
  '@atlaskit/ui-styling-standard/local-cx-xcss': 'error',
20
20
  '@atlaskit/ui-styling-standard/no-array-arguments': 'error',
21
- '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'warn',
21
+ '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'error',
22
22
  '@atlaskit/ui-styling-standard/no-classname-prop': 'error',
23
23
  '@atlaskit/ui-styling-standard/no-container-queries': 'error',
24
24
  '@atlaskit/ui-styling-standard/no-dynamic-styles': 'error',
@@ -9,7 +9,7 @@ var atlaskitDesignSystemPlugin = _interopRequireWildcard(require("@atlaskit/esli
9
9
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
10
10
  /**
11
11
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
12
- * @codegen <<SignedSource::7f3972a0198dc6de5194e21d5f32c3b0>>
12
+ * @codegen <<SignedSource::4d0de15d2213df65666693ea490b4cce>>
13
13
  * @codegenCommand afm workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
14
14
  */
15
15
 
@@ -24,7 +24,7 @@ var config = {
24
24
  '@atlaskit/ui-styling-standard/enforce-style-prop': 'error',
25
25
  '@atlaskit/ui-styling-standard/local-cx-xcss': 'error',
26
26
  '@atlaskit/ui-styling-standard/no-array-arguments': 'error',
27
- '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'warn',
27
+ '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'error',
28
28
  '@atlaskit/ui-styling-standard/no-classname-prop': 'error',
29
29
  '@atlaskit/ui-styling-standard/no-container-queries': 'error',
30
30
  '@atlaskit/ui-styling-standard/no-dynamic-styles': 'error',
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  /**
8
8
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
9
- * @codegen <<SignedSource::138a044301c208ca5eecc78433523b0b>>
9
+ * @codegen <<SignedSource::56ecb290562bdf88a8a5b5388a39e5f9>>
10
10
  * @codegenCommand afm workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
11
11
  */
12
12
 
@@ -18,7 +18,7 @@ var config = {
18
18
  '@atlaskit/ui-styling-standard/enforce-style-prop': 'error',
19
19
  '@atlaskit/ui-styling-standard/local-cx-xcss': 'error',
20
20
  '@atlaskit/ui-styling-standard/no-array-arguments': 'error',
21
- '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'warn',
21
+ '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'error',
22
22
  '@atlaskit/ui-styling-standard/no-classname-prop': 'error',
23
23
  '@atlaskit/ui-styling-standard/no-container-queries': 'error',
24
24
  '@atlaskit/ui-styling-standard/no-dynamic-styles': 'error',
@@ -11,7 +11,7 @@ var rule = (0, _createRule.createLintRule)({
11
11
  docs: {
12
12
  description: 'Disallow imports from `@atlaskit/theme`',
13
13
  recommended: true,
14
- severity: 'warn'
14
+ severity: 'error'
15
15
  },
16
16
  messages: {
17
17
  'no-atlaskit-theme': 'Do not import `@atlaskit/theme`. Use `@atlaskit/tokens` or Atlassian Design System components instead.'
@@ -83,7 +83,14 @@ var checkIdentifier = function checkIdentifier(identifier, context, functionAllo
83
83
  // Type references and `typeof` queries are erased at runtime and are not
84
84
  // imported style values. Runtime expressions wrapped by `as` or `satisfies`
85
85
  // must still be checked.
86
- if (parent && (parent.type === 'TSTypeReference' || parent.type === 'TSTypeQuery')) {
86
+ // Qualified names (e.g. `typeof Tokens.COLOR_TEXT` or `Theme.Colors`) nest the
87
+ // identifier inside one or more `TSQualifiedName` nodes, so walk up through them
88
+ // to find the enclosing type node.
89
+ var typeContext = parent;
90
+ while (typeContext && typeContext.type === 'TSQualifiedName') {
91
+ typeContext = typeContext.parent;
92
+ }
93
+ if (typeContext && (typeContext.type === 'TSTypeReference' || typeContext.type === 'TSTypeQuery')) {
87
94
  return;
88
95
  }
89
96
 
@@ -16,7 +16,19 @@ var _walkStyleCallProperties = require("../utils/walk-style-call-properties");
16
16
  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; } } }; }
17
17
  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; } }
18
18
  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; }
19
- var getCssSelector = function getCssSelector(key) {
19
+ /**
20
+ * Strip TypeScript-only wrappers from a computed key so the selector inside is still linted,
21
+ * for example `['.foo' satisfies `.${typeof FOO_CLASS}`]` is checked as `'.foo'`.
22
+ */
23
+ var unwrapTypeScriptExpression = function unwrapTypeScriptExpression(key) {
24
+ var expression = key;
25
+ while ((expression.type === 'TSAsExpression' || expression.type === 'TSTypeAssertion' || expression.type === 'TSNonNullExpression' || expression.type === 'TSSatisfiesExpression') && expression.expression) {
26
+ expression = expression.expression;
27
+ }
28
+ return expression;
29
+ };
30
+ var getCssSelector = function getCssSelector(rawKey) {
31
+ var key = unwrapTypeScriptExpression(rawKey);
20
32
  if (key.type === 'Literal' && typeof key.value === 'string') {
21
33
  return key.value;
22
34
  }
@@ -15,7 +15,10 @@ exports.allowedPseudos = void 0;
15
15
 
16
16
  var cssPseudos = ['&:active', '&:autofill', '&:blank', '&:checked', '&:default', '&:defined', '&:disabled', '&:empty', '&:enabled', '&:first', '&:focus', '&:focus-visible', '&:focus-within', '&:fullscreen', '&:hover', '&:in-range', '&:indeterminate', '&:invalid', '&:left', '&:link', '&:local-link', '&:optional', '&:out-of-range', '&:paused', '&:picture-in-picture', '&:placeholder-shown', '&:playing', '&:popover-open', '&:read-only', '&:read-write', '&:required', '&:right', '&:target', '&:user-invalid', '&:user-valid', '&:valid', '&:visited', '&::after', '&::backdrop', '&::before', '&::cue', '&::cue-region', '&::first-letter', '&::first-line', '&::grammar-error', '&::marker', '&::placeholder', '&::selection', '&::spelling-error', '&::target-text', '&::view-transition', '&::-webkit-details-marker',
17
17
  // Chained pseudos (CSSFlattenedChainedPsuedos from @compiled/react)
18
- '&:active:visited', '&:focus:not(:focus-visible)', '&:focus::after', '&:focus::before', '&:focus-visible::after', '&:focus-visible::before', '&:focus-within::after', '&:focus-within::before', '&:hover::after', '&:hover::before', '&:visited:active', '&:visited:hover', '&:visited:focus', '&:visited:focus-visible', '&:visited:focus-within'];
18
+ '&:active:visited', '&:focus:not(:focus-visible)', '&:focus::after', '&:focus::before', '&:focus-visible::after', '&:focus-visible::before', '&:focus-within::after', '&:focus-within::before', '&:hover::after', '&:hover::before', '&:visited:active', '&:visited:hover', '&:visited:focus', '&:visited:focus-visible', '&:visited:focus-within',
19
+ // Vendor pseudo-elements with no standard equivalent. These are not part of CSSPseudos, so the
20
+ // typed @atlaskit/css and xcss APIs still reject them.
21
+ '&::-moz-focus-inner', '&::-moz-focus-outer', '&::-moz-range-progress', '&::-moz-range-thumb', '&::-moz-range-track', '&::-webkit-slider-runnable-track', '&::-webkit-slider-thumb'];
19
22
  var allowedPseudos = exports.allowedPseudos = new Set(
20
23
  /**
21
24
  * The `&` is included above for type checking reasons,
@@ -103,7 +103,7 @@ function checkNoRestrictedPseudos(_ref2, pseudos) {
103
103
  try {
104
104
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
105
105
  var pseudo = _step.value;
106
- if (_constants.allowedPseudos.has(pseudo.value)) {
106
+ if (_constants.allowedPseudos.has(pseudo.value) || isInAllowedPseudoChain(pseudo)) {
107
107
  continue;
108
108
  }
109
109
 
@@ -138,6 +138,33 @@ function checkNoRestrictedPseudos(_ref2, pseudos) {
138
138
  }
139
139
  }
140
140
 
141
+ /**
142
+ * The allowlist includes chained pseudos such as `:focus:not(:focus-visible)` whose parts are not
143
+ * all allowed on their own, so a pseudo is also allowed when a run of adjacent pseudos containing
144
+ * it matches an allowlisted chain.
145
+ */
146
+ function isInAllowedPseudoChain(pseudo) {
147
+ var chain = [pseudo];
148
+ for (var node = pseudo.prev(); (0, _postcssSelectorParser.isPseudo)(node); node = node.prev()) {
149
+ chain.unshift(node);
150
+ }
151
+ for (var _node = pseudo.next(); (0, _postcssSelectorParser.isPseudo)(_node); _node = _node.next()) {
152
+ chain.push(_node);
153
+ }
154
+ var index = chain.indexOf(pseudo);
155
+ for (var start = 0; start <= index; start++) {
156
+ for (var end = index + 1; end <= chain.length; end++) {
157
+ var text = chain.slice(start, end).map(function (node) {
158
+ return String(node).replace(/\s+/g, '');
159
+ }).join('');
160
+ if (_constants.allowedPseudos.has(text)) {
161
+ return true;
162
+ }
163
+ }
164
+ }
165
+ return false;
166
+ }
167
+
141
168
  /**
142
169
  * The original four pseudo-elements have a legacy single colon syntax.
143
170
  *
@@ -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::b13b370d5591cbe6a4d23e6afa0ee390>>
3
+ * @codegen <<SignedSource::75b18fe1e3e0e0eeeb87a8dd4ed975ae>>
4
4
  * @codegenCommand afm workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
 
@@ -16,7 +16,7 @@ const config = {
16
16
  '@atlaskit/ui-styling-standard/enforce-style-prop': 'error',
17
17
  '@atlaskit/ui-styling-standard/local-cx-xcss': 'error',
18
18
  '@atlaskit/ui-styling-standard/no-array-arguments': 'error',
19
- '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'warn',
19
+ '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'error',
20
20
  '@atlaskit/ui-styling-standard/no-classname-prop': 'error',
21
21
  '@atlaskit/ui-styling-standard/no-container-queries': 'error',
22
22
  '@atlaskit/ui-styling-standard/no-dynamic-styles': 'error',
@@ -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::cc3bb00111b60fbcdfa28799aa0671ea>>
3
+ * @codegen <<SignedSource::ff2cac75bedd9b12fc1c17bc6cf66c5c>>
4
4
  * @codegenCommand afm workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
 
@@ -12,7 +12,7 @@ const config = {
12
12
  '@atlaskit/ui-styling-standard/enforce-style-prop': 'error',
13
13
  '@atlaskit/ui-styling-standard/local-cx-xcss': 'error',
14
14
  '@atlaskit/ui-styling-standard/no-array-arguments': 'error',
15
- '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'warn',
15
+ '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'error',
16
16
  '@atlaskit/ui-styling-standard/no-classname-prop': 'error',
17
17
  '@atlaskit/ui-styling-standard/no-container-queries': 'error',
18
18
  '@atlaskit/ui-styling-standard/no-dynamic-styles': 'error',
@@ -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::7f3972a0198dc6de5194e21d5f32c3b0>>
3
+ * @codegen <<SignedSource::4d0de15d2213df65666693ea490b4cce>>
4
4
  * @codegenCommand afm workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
 
@@ -16,7 +16,7 @@ const config = {
16
16
  '@atlaskit/ui-styling-standard/enforce-style-prop': 'error',
17
17
  '@atlaskit/ui-styling-standard/local-cx-xcss': 'error',
18
18
  '@atlaskit/ui-styling-standard/no-array-arguments': 'error',
19
- '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'warn',
19
+ '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'error',
20
20
  '@atlaskit/ui-styling-standard/no-classname-prop': 'error',
21
21
  '@atlaskit/ui-styling-standard/no-container-queries': 'error',
22
22
  '@atlaskit/ui-styling-standard/no-dynamic-styles': 'error',
@@ -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::138a044301c208ca5eecc78433523b0b>>
3
+ * @codegen <<SignedSource::56ecb290562bdf88a8a5b5388a39e5f9>>
4
4
  * @codegenCommand afm workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
 
@@ -12,7 +12,7 @@ const config = {
12
12
  '@atlaskit/ui-styling-standard/enforce-style-prop': 'error',
13
13
  '@atlaskit/ui-styling-standard/local-cx-xcss': 'error',
14
14
  '@atlaskit/ui-styling-standard/no-array-arguments': 'error',
15
- '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'warn',
15
+ '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'error',
16
16
  '@atlaskit/ui-styling-standard/no-classname-prop': 'error',
17
17
  '@atlaskit/ui-styling-standard/no-container-queries': 'error',
18
18
  '@atlaskit/ui-styling-standard/no-dynamic-styles': 'error',
@@ -5,7 +5,7 @@ const rule = createLintRule({
5
5
  docs: {
6
6
  description: 'Disallow imports from `@atlaskit/theme`',
7
7
  recommended: true,
8
- severity: 'warn'
8
+ severity: 'error'
9
9
  },
10
10
  messages: {
11
11
  'no-atlaskit-theme': 'Do not import `@atlaskit/theme`. Use `@atlaskit/tokens` or Atlassian Design System components instead.'
@@ -72,7 +72,14 @@ const checkIdentifier = (identifier, context, functionAllowList, keysAllowList)
72
72
  // Type references and `typeof` queries are erased at runtime and are not
73
73
  // imported style values. Runtime expressions wrapped by `as` or `satisfies`
74
74
  // must still be checked.
75
- if (parent && (parent.type === 'TSTypeReference' || parent.type === 'TSTypeQuery')) {
75
+ // Qualified names (e.g. `typeof Tokens.COLOR_TEXT` or `Theme.Colors`) nest the
76
+ // identifier inside one or more `TSQualifiedName` nodes, so walk up through them
77
+ // to find the enclosing type node.
78
+ let typeContext = parent;
79
+ while (typeContext && typeContext.type === 'TSQualifiedName') {
80
+ typeContext = typeContext.parent;
81
+ }
82
+ if (typeContext && (typeContext.type === 'TSTypeReference' || typeContext.type === 'TSTypeQuery')) {
76
83
  return;
77
84
  }
78
85
 
@@ -5,7 +5,19 @@ import { isSimpleSelector } from '../utils/is-simple-selector';
5
5
  import { parseSelector } from '../utils/parse-selector';
6
6
  import { getStyleCalls } from '../utils/style-calls';
7
7
  import { walkStyleCallProperties } from '../utils/walk-style-call-properties';
8
- const getCssSelector = key => {
8
+ /**
9
+ * Strip TypeScript-only wrappers from a computed key so the selector inside is still linted,
10
+ * for example `['.foo' satisfies `.${typeof FOO_CLASS}`]` is checked as `'.foo'`.
11
+ */
12
+ const unwrapTypeScriptExpression = key => {
13
+ let expression = key;
14
+ while ((expression.type === 'TSAsExpression' || expression.type === 'TSTypeAssertion' || expression.type === 'TSNonNullExpression' || expression.type === 'TSSatisfiesExpression') && expression.expression) {
15
+ expression = expression.expression;
16
+ }
17
+ return expression;
18
+ };
19
+ const getCssSelector = rawKey => {
20
+ const key = unwrapTypeScriptExpression(rawKey);
9
21
  if (key.type === 'Literal' && typeof key.value === 'string') {
10
22
  return key.value;
11
23
  }
@@ -9,7 +9,10 @@
9
9
 
10
10
  const cssPseudos = ['&:active', '&:autofill', '&:blank', '&:checked', '&:default', '&:defined', '&:disabled', '&:empty', '&:enabled', '&:first', '&:focus', '&:focus-visible', '&:focus-within', '&:fullscreen', '&:hover', '&:in-range', '&:indeterminate', '&:invalid', '&:left', '&:link', '&:local-link', '&:optional', '&:out-of-range', '&:paused', '&:picture-in-picture', '&:placeholder-shown', '&:playing', '&:popover-open', '&:read-only', '&:read-write', '&:required', '&:right', '&:target', '&:user-invalid', '&:user-valid', '&:valid', '&:visited', '&::after', '&::backdrop', '&::before', '&::cue', '&::cue-region', '&::first-letter', '&::first-line', '&::grammar-error', '&::marker', '&::placeholder', '&::selection', '&::spelling-error', '&::target-text', '&::view-transition', '&::-webkit-details-marker',
11
11
  // Chained pseudos (CSSFlattenedChainedPsuedos from @compiled/react)
12
- '&:active:visited', '&:focus:not(:focus-visible)', '&:focus::after', '&:focus::before', '&:focus-visible::after', '&:focus-visible::before', '&:focus-within::after', '&:focus-within::before', '&:hover::after', '&:hover::before', '&:visited:active', '&:visited:hover', '&:visited:focus', '&:visited:focus-visible', '&:visited:focus-within'];
12
+ '&:active:visited', '&:focus:not(:focus-visible)', '&:focus::after', '&:focus::before', '&:focus-visible::after', '&:focus-visible::before', '&:focus-within::after', '&:focus-within::before', '&:hover::after', '&:hover::before', '&:visited:active', '&:visited:hover', '&:visited:focus', '&:visited:focus-visible', '&:visited:focus-within',
13
+ // Vendor pseudo-elements with no standard equivalent. These are not part of CSSPseudos, so the
14
+ // typed @atlaskit/css and xcss APIs still reject them.
15
+ '&::-moz-focus-inner', '&::-moz-focus-outer', '&::-moz-range-progress', '&::-moz-range-thumb', '&::-moz-range-track', '&::-webkit-slider-runnable-track', '&::-webkit-slider-thumb'];
13
16
  export const allowedPseudos = new Set(
14
17
  /**
15
18
  * The `&` is included above for type checking reasons,
@@ -71,7 +71,7 @@ function checkNoRestrictedPseudos({
71
71
  sourceNode
72
72
  }, pseudos) {
73
73
  for (const pseudo of pseudos) {
74
- if (allowedPseudos.has(pseudo.value)) {
74
+ if (allowedPseudos.has(pseudo.value) || isInAllowedPseudoChain(pseudo)) {
75
75
  continue;
76
76
  }
77
77
 
@@ -101,6 +101,31 @@ function checkNoRestrictedPseudos({
101
101
  }
102
102
  }
103
103
 
104
+ /**
105
+ * The allowlist includes chained pseudos such as `:focus:not(:focus-visible)` whose parts are not
106
+ * all allowed on their own, so a pseudo is also allowed when a run of adjacent pseudos containing
107
+ * it matches an allowlisted chain.
108
+ */
109
+ function isInAllowedPseudoChain(pseudo) {
110
+ const chain = [pseudo];
111
+ for (let node = pseudo.prev(); isPseudo(node); node = node.prev()) {
112
+ chain.unshift(node);
113
+ }
114
+ for (let node = pseudo.next(); isPseudo(node); node = node.next()) {
115
+ chain.push(node);
116
+ }
117
+ const index = chain.indexOf(pseudo);
118
+ for (let start = 0; start <= index; start++) {
119
+ for (let end = index + 1; end <= chain.length; end++) {
120
+ const text = chain.slice(start, end).map(node => String(node).replace(/\s+/g, '')).join('');
121
+ if (allowedPseudos.has(text)) {
122
+ return true;
123
+ }
124
+ }
125
+ }
126
+ return false;
127
+ }
128
+
104
129
  /**
105
130
  * The original four pseudo-elements have a legacy single colon syntax.
106
131
  *
@@ -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::b13b370d5591cbe6a4d23e6afa0ee390>>
3
+ * @codegen <<SignedSource::75b18fe1e3e0e0eeeb87a8dd4ed975ae>>
4
4
  * @codegenCommand afm workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
 
@@ -16,7 +16,7 @@ var config = {
16
16
  '@atlaskit/ui-styling-standard/enforce-style-prop': 'error',
17
17
  '@atlaskit/ui-styling-standard/local-cx-xcss': 'error',
18
18
  '@atlaskit/ui-styling-standard/no-array-arguments': 'error',
19
- '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'warn',
19
+ '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'error',
20
20
  '@atlaskit/ui-styling-standard/no-classname-prop': 'error',
21
21
  '@atlaskit/ui-styling-standard/no-container-queries': 'error',
22
22
  '@atlaskit/ui-styling-standard/no-dynamic-styles': 'error',
@@ -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::cc3bb00111b60fbcdfa28799aa0671ea>>
3
+ * @codegen <<SignedSource::ff2cac75bedd9b12fc1c17bc6cf66c5c>>
4
4
  * @codegenCommand afm workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
 
@@ -12,7 +12,7 @@ var config = {
12
12
  '@atlaskit/ui-styling-standard/enforce-style-prop': 'error',
13
13
  '@atlaskit/ui-styling-standard/local-cx-xcss': 'error',
14
14
  '@atlaskit/ui-styling-standard/no-array-arguments': 'error',
15
- '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'warn',
15
+ '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'error',
16
16
  '@atlaskit/ui-styling-standard/no-classname-prop': 'error',
17
17
  '@atlaskit/ui-styling-standard/no-container-queries': 'error',
18
18
  '@atlaskit/ui-styling-standard/no-dynamic-styles': 'error',
@@ -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::7f3972a0198dc6de5194e21d5f32c3b0>>
3
+ * @codegen <<SignedSource::4d0de15d2213df65666693ea490b4cce>>
4
4
  * @codegenCommand afm workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
 
@@ -16,7 +16,7 @@ var config = {
16
16
  '@atlaskit/ui-styling-standard/enforce-style-prop': 'error',
17
17
  '@atlaskit/ui-styling-standard/local-cx-xcss': 'error',
18
18
  '@atlaskit/ui-styling-standard/no-array-arguments': 'error',
19
- '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'warn',
19
+ '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'error',
20
20
  '@atlaskit/ui-styling-standard/no-classname-prop': 'error',
21
21
  '@atlaskit/ui-styling-standard/no-container-queries': 'error',
22
22
  '@atlaskit/ui-styling-standard/no-dynamic-styles': 'error',
@@ -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::138a044301c208ca5eecc78433523b0b>>
3
+ * @codegen <<SignedSource::56ecb290562bdf88a8a5b5388a39e5f9>>
4
4
  * @codegenCommand afm workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
 
@@ -12,7 +12,7 @@ var config = {
12
12
  '@atlaskit/ui-styling-standard/enforce-style-prop': 'error',
13
13
  '@atlaskit/ui-styling-standard/local-cx-xcss': 'error',
14
14
  '@atlaskit/ui-styling-standard/no-array-arguments': 'error',
15
- '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'warn',
15
+ '@atlaskit/ui-styling-standard/no-atlaskit-theme': 'error',
16
16
  '@atlaskit/ui-styling-standard/no-classname-prop': 'error',
17
17
  '@atlaskit/ui-styling-standard/no-container-queries': 'error',
18
18
  '@atlaskit/ui-styling-standard/no-dynamic-styles': 'error',
@@ -5,7 +5,7 @@ var rule = createLintRule({
5
5
  docs: {
6
6
  description: 'Disallow imports from `@atlaskit/theme`',
7
7
  recommended: true,
8
- severity: 'warn'
8
+ severity: 'error'
9
9
  },
10
10
  messages: {
11
11
  'no-atlaskit-theme': 'Do not import `@atlaskit/theme`. Use `@atlaskit/tokens` or Atlassian Design System components instead.'
@@ -76,7 +76,14 @@ var checkIdentifier = function checkIdentifier(identifier, context, functionAllo
76
76
  // Type references and `typeof` queries are erased at runtime and are not
77
77
  // imported style values. Runtime expressions wrapped by `as` or `satisfies`
78
78
  // must still be checked.
79
- if (parent && (parent.type === 'TSTypeReference' || parent.type === 'TSTypeQuery')) {
79
+ // Qualified names (e.g. `typeof Tokens.COLOR_TEXT` or `Theme.Colors`) nest the
80
+ // identifier inside one or more `TSQualifiedName` nodes, so walk up through them
81
+ // to find the enclosing type node.
82
+ var typeContext = parent;
83
+ while (typeContext && typeContext.type === 'TSQualifiedName') {
84
+ typeContext = typeContext.parent;
85
+ }
86
+ if (typeContext && (typeContext.type === 'TSTypeReference' || typeContext.type === 'TSTypeQuery')) {
80
87
  return;
81
88
  }
82
89
 
@@ -9,7 +9,19 @@ import { isSimpleSelector } from '../utils/is-simple-selector';
9
9
  import { parseSelector } from '../utils/parse-selector';
10
10
  import { getStyleCalls } from '../utils/style-calls';
11
11
  import { walkStyleCallProperties } from '../utils/walk-style-call-properties';
12
- var getCssSelector = function getCssSelector(key) {
12
+ /**
13
+ * Strip TypeScript-only wrappers from a computed key so the selector inside is still linted,
14
+ * for example `['.foo' satisfies `.${typeof FOO_CLASS}`]` is checked as `'.foo'`.
15
+ */
16
+ var unwrapTypeScriptExpression = function unwrapTypeScriptExpression(key) {
17
+ var expression = key;
18
+ while ((expression.type === 'TSAsExpression' || expression.type === 'TSTypeAssertion' || expression.type === 'TSNonNullExpression' || expression.type === 'TSSatisfiesExpression') && expression.expression) {
19
+ expression = expression.expression;
20
+ }
21
+ return expression;
22
+ };
23
+ var getCssSelector = function getCssSelector(rawKey) {
24
+ var key = unwrapTypeScriptExpression(rawKey);
13
25
  if (key.type === 'Literal' && typeof key.value === 'string') {
14
26
  return key.value;
15
27
  }
@@ -9,7 +9,10 @@
9
9
 
10
10
  var cssPseudos = ['&:active', '&:autofill', '&:blank', '&:checked', '&:default', '&:defined', '&:disabled', '&:empty', '&:enabled', '&:first', '&:focus', '&:focus-visible', '&:focus-within', '&:fullscreen', '&:hover', '&:in-range', '&:indeterminate', '&:invalid', '&:left', '&:link', '&:local-link', '&:optional', '&:out-of-range', '&:paused', '&:picture-in-picture', '&:placeholder-shown', '&:playing', '&:popover-open', '&:read-only', '&:read-write', '&:required', '&:right', '&:target', '&:user-invalid', '&:user-valid', '&:valid', '&:visited', '&::after', '&::backdrop', '&::before', '&::cue', '&::cue-region', '&::first-letter', '&::first-line', '&::grammar-error', '&::marker', '&::placeholder', '&::selection', '&::spelling-error', '&::target-text', '&::view-transition', '&::-webkit-details-marker',
11
11
  // Chained pseudos (CSSFlattenedChainedPsuedos from @compiled/react)
12
- '&:active:visited', '&:focus:not(:focus-visible)', '&:focus::after', '&:focus::before', '&:focus-visible::after', '&:focus-visible::before', '&:focus-within::after', '&:focus-within::before', '&:hover::after', '&:hover::before', '&:visited:active', '&:visited:hover', '&:visited:focus', '&:visited:focus-visible', '&:visited:focus-within'];
12
+ '&:active:visited', '&:focus:not(:focus-visible)', '&:focus::after', '&:focus::before', '&:focus-visible::after', '&:focus-visible::before', '&:focus-within::after', '&:focus-within::before', '&:hover::after', '&:hover::before', '&:visited:active', '&:visited:hover', '&:visited:focus', '&:visited:focus-visible', '&:visited:focus-within',
13
+ // Vendor pseudo-elements with no standard equivalent. These are not part of CSSPseudos, so the
14
+ // typed @atlaskit/css and xcss APIs still reject them.
15
+ '&::-moz-focus-inner', '&::-moz-focus-outer', '&::-moz-range-progress', '&::-moz-range-thumb', '&::-moz-range-track', '&::-webkit-slider-runnable-track', '&::-webkit-slider-thumb'];
13
16
  export var allowedPseudos = new Set(
14
17
  /**
15
18
  * The `&` is included above for type checking reasons,
@@ -96,7 +96,7 @@ function checkNoRestrictedPseudos(_ref2, pseudos) {
96
96
  try {
97
97
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
98
98
  var pseudo = _step.value;
99
- if (allowedPseudos.has(pseudo.value)) {
99
+ if (allowedPseudos.has(pseudo.value) || isInAllowedPseudoChain(pseudo)) {
100
100
  continue;
101
101
  }
102
102
 
@@ -131,6 +131,33 @@ function checkNoRestrictedPseudos(_ref2, pseudos) {
131
131
  }
132
132
  }
133
133
 
134
+ /**
135
+ * The allowlist includes chained pseudos such as `:focus:not(:focus-visible)` whose parts are not
136
+ * all allowed on their own, so a pseudo is also allowed when a run of adjacent pseudos containing
137
+ * it matches an allowlisted chain.
138
+ */
139
+ function isInAllowedPseudoChain(pseudo) {
140
+ var chain = [pseudo];
141
+ for (var node = pseudo.prev(); isPseudo(node); node = node.prev()) {
142
+ chain.unshift(node);
143
+ }
144
+ for (var _node = pseudo.next(); isPseudo(_node); _node = _node.next()) {
145
+ chain.push(_node);
146
+ }
147
+ var index = chain.indexOf(pseudo);
148
+ for (var start = 0; start <= index; start++) {
149
+ for (var end = index + 1; end <= chain.length; end++) {
150
+ var text = chain.slice(start, end).map(function (node) {
151
+ return String(node).replace(/\s+/g, '');
152
+ }).join('');
153
+ if (allowedPseudos.has(text)) {
154
+ return true;
155
+ }
156
+ }
157
+ }
158
+ return false;
159
+ }
160
+
134
161
  /**
135
162
  * The original four pseudo-elements have a legacy single colon syntax.
136
163
  *
@@ -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::b13b370d5591cbe6a4d23e6afa0ee390>>
3
+ * @codegen <<SignedSource::75b18fe1e3e0e0eeeb87a8dd4ed975ae>>
4
4
  * @codegenCommand afm workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
  import type { Linter } from 'eslint';
@@ -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::cc3bb00111b60fbcdfa28799aa0671ea>>
3
+ * @codegen <<SignedSource::ff2cac75bedd9b12fc1c17bc6cf66c5c>>
4
4
  * @codegenCommand afm workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
  import type { ESLint } from 'eslint';
@@ -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::7f3972a0198dc6de5194e21d5f32c3b0>>
3
+ * @codegen <<SignedSource::4d0de15d2213df65666693ea490b4cce>>
4
4
  * @codegenCommand afm workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
  import type { Linter } from 'eslint';
@@ -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::138a044301c208ca5eecc78433523b0b>>
3
+ * @codegen <<SignedSource::56ecb290562bdf88a8a5b5388a39e5f9>>
4
4
  * @codegenCommand afm workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
  import type { ESLint } from 'eslint';
@@ -13,6 +13,6 @@ type HasAllUnique<Tuple, Union, Seen = never> = Tuple extends readonly [infer He
13
13
  * Exporting this so it isn't considered unused.
14
14
  */
15
15
  export type _ = Validate<HasAllUnique<typeof cssPseudos, CSSPseudos>>;
16
- declare const cssPseudos: readonly ['&:active', '&:autofill', '&:blank', '&:checked', '&:default', '&:defined', '&:disabled', '&:empty', '&:enabled', '&:first', '&:focus', '&:focus-visible', '&:focus-within', '&:fullscreen', '&:hover', '&:in-range', '&:indeterminate', '&:invalid', '&:left', '&:link', '&:local-link', '&:optional', '&:out-of-range', '&:paused', '&:picture-in-picture', '&:placeholder-shown', '&:playing', '&:popover-open', '&:read-only', '&:read-write', '&:required', '&:right', '&:target', '&:user-invalid', '&:user-valid', '&:valid', '&:visited', '&::after', '&::backdrop', '&::before', '&::cue', '&::cue-region', '&::first-letter', '&::first-line', '&::grammar-error', '&::marker', '&::placeholder', '&::selection', '&::spelling-error', '&::target-text', '&::view-transition', '&::-webkit-details-marker', '&:active:visited', '&:focus:not(:focus-visible)', '&:focus::after', '&:focus::before', '&:focus-visible::after', '&:focus-visible::before', '&:focus-within::after', '&:focus-within::before', '&:hover::after', '&:hover::before', '&:visited:active', '&:visited:hover', '&:visited:focus', '&:visited:focus-visible', '&:visited:focus-within'];
16
+ declare const cssPseudos: readonly ['&:active', '&:autofill', '&:blank', '&:checked', '&:default', '&:defined', '&:disabled', '&:empty', '&:enabled', '&:first', '&:focus', '&:focus-visible', '&:focus-within', '&:fullscreen', '&:hover', '&:in-range', '&:indeterminate', '&:invalid', '&:left', '&:link', '&:local-link', '&:optional', '&:out-of-range', '&:paused', '&:picture-in-picture', '&:placeholder-shown', '&:playing', '&:popover-open', '&:read-only', '&:read-write', '&:required', '&:right', '&:target', '&:user-invalid', '&:user-valid', '&:valid', '&:visited', '&::after', '&::backdrop', '&::before', '&::cue', '&::cue-region', '&::first-letter', '&::first-line', '&::grammar-error', '&::marker', '&::placeholder', '&::selection', '&::spelling-error', '&::target-text', '&::view-transition', '&::-webkit-details-marker', '&:active:visited', '&:focus:not(:focus-visible)', '&:focus::after', '&:focus::before', '&:focus-visible::after', '&:focus-visible::before', '&:focus-within::after', '&:focus-within::before', '&:hover::after', '&:hover::before', '&:visited:active', '&:visited:hover', '&:visited:focus', '&:visited:focus-visible', '&:visited:focus-within', '&::-moz-focus-inner', '&::-moz-focus-outer', '&::-moz-range-progress', '&::-moz-range-thumb', '&::-moz-range-track', '&::-webkit-slider-runnable-track', '&::-webkit-slider-thumb'];
17
17
  export declare const allowedPseudos: Set<string>;
18
18
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/eslint-plugin-ui-styling-standard",
3
- "version": "2.3.0",
3
+ "version": "2.4.1",
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",