@atlaskit/eslint-plugin-ui-styling-standard 3.0.3 → 3.0.5
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 +15 -0
- package/README.md +28 -28
- package/dist/cjs/rules/convert-props-syntax/index.js +1 -1
- package/dist/cjs/rules/enforce-style-prop/index.js +1 -1
- package/dist/cjs/rules/local-cx-xcss/index.js +1 -1
- package/dist/cjs/rules/no-array-arguments/index.js +1 -1
- package/dist/cjs/rules/no-atlaskit-theme/index.js +1 -1
- package/dist/cjs/rules/no-classname-prop/index.js +1 -1
- package/dist/cjs/rules/no-container-queries/index.js +22 -23
- package/dist/cjs/rules/no-dynamic-styles/index.js +1 -1
- package/dist/cjs/rules/no-exported-styles/index.js +1 -1
- package/dist/cjs/rules/no-global-styles/index.js +2 -2
- package/dist/cjs/rules/no-important-styles/index.js +1 -1
- package/dist/cjs/rules/no-imported-style-values/index.js +9 -3
- package/dist/cjs/rules/no-nested-selectors/index.js +4 -2
- package/dist/cjs/rules/no-styled/index.js +1 -1
- package/dist/cjs/rules/no-unsafe-selectors/index.js +10 -10
- package/dist/cjs/rules/no-unsafe-selectors/lint-selector.js +6 -1
- package/dist/cjs/rules/no-unsafe-selectors/source-position-utils.js +5 -0
- package/dist/cjs/rules/no-unused-cssmap-properties/index.js +1 -1
- package/dist/cjs/rules/utils/parse-selector.js +6 -0
- package/dist/es2019/rules/convert-props-syntax/index.js +1 -1
- package/dist/es2019/rules/enforce-style-prop/index.js +1 -1
- package/dist/es2019/rules/local-cx-xcss/index.js +1 -1
- package/dist/es2019/rules/no-array-arguments/index.js +1 -1
- package/dist/es2019/rules/no-atlaskit-theme/index.js +1 -1
- package/dist/es2019/rules/no-classname-prop/index.js +1 -1
- package/dist/es2019/rules/no-container-queries/index.js +22 -23
- package/dist/es2019/rules/no-dynamic-styles/index.js +1 -1
- package/dist/es2019/rules/no-exported-styles/index.js +1 -1
- package/dist/es2019/rules/no-global-styles/index.js +2 -2
- package/dist/es2019/rules/no-important-styles/index.js +1 -1
- package/dist/es2019/rules/no-imported-style-values/index.js +10 -4
- package/dist/es2019/rules/no-nested-selectors/index.js +2 -2
- package/dist/es2019/rules/no-styled/index.js +1 -1
- package/dist/es2019/rules/no-unsafe-selectors/index.js +10 -10
- package/dist/es2019/rules/no-unsafe-selectors/lint-selector.js +7 -1
- package/dist/es2019/rules/no-unsafe-selectors/source-position-utils.js +5 -0
- package/dist/es2019/rules/no-unused-cssmap-properties/index.js +1 -1
- package/dist/es2019/rules/utils/parse-selector.js +6 -0
- package/dist/esm/rules/convert-props-syntax/index.js +1 -1
- package/dist/esm/rules/enforce-style-prop/index.js +1 -1
- package/dist/esm/rules/local-cx-xcss/index.js +1 -1
- package/dist/esm/rules/no-array-arguments/index.js +1 -1
- package/dist/esm/rules/no-atlaskit-theme/index.js +1 -1
- package/dist/esm/rules/no-classname-prop/index.js +1 -1
- package/dist/esm/rules/no-container-queries/index.js +22 -23
- package/dist/esm/rules/no-dynamic-styles/index.js +1 -1
- package/dist/esm/rules/no-exported-styles/index.js +1 -1
- package/dist/esm/rules/no-global-styles/index.js +2 -2
- package/dist/esm/rules/no-important-styles/index.js +1 -1
- package/dist/esm/rules/no-imported-style-values/index.js +9 -3
- package/dist/esm/rules/no-nested-selectors/index.js +4 -2
- package/dist/esm/rules/no-styled/index.js +1 -1
- package/dist/esm/rules/no-unsafe-selectors/index.js +10 -10
- package/dist/esm/rules/no-unsafe-selectors/lint-selector.js +7 -1
- package/dist/esm/rules/no-unsafe-selectors/source-position-utils.js +5 -0
- package/dist/esm/rules/no-unused-cssmap-properties/index.js +1 -1
- package/dist/esm/rules/utils/parse-selector.js +6 -0
- package/dist/types/rules/no-unsafe-selectors/lint-selector.d.ts +16 -2
- package/dist/types/rules/no-unsafe-selectors/source-position-utils.d.ts +9 -4
- package/dist/types/rules/utils/parse-selector.d.ts +17 -4
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-ui-styling-standard
|
|
2
2
|
|
|
3
|
+
## 3.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f7d67770416b8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f7d67770416b8) -
|
|
8
|
+
`no-container-queries` collects container names with a `Property` visitor instead of walking the
|
|
9
|
+
whole file again with estraverse.
|
|
10
|
+
|
|
11
|
+
## 3.0.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`1215148c363e4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1215148c363e4) -
|
|
16
|
+
Fix false positives for type-wrapped cx calls in xcss.
|
|
17
|
+
|
|
3
18
|
## 3.0.3
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -40,33 +40,33 @@ module.exports = {
|
|
|
40
40
|
<!-- START_RULE_TABLE_CODEGEN -->
|
|
41
41
|
<!-- @codegenCommand afm workspace @atlaskit/eslint-plugin-ui-styling-standard codegen -->
|
|
42
42
|
|
|
43
|
-
| Rule | Description
|
|
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
|
|
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
|
|
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.
|
|
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
|
|
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`
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
60
|
-
| <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.
|
|
61
|
-
| <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.
|
|
62
|
-
| <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.
|
|
63
|
-
| <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
|
|
64
|
-
| <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
|
|
65
|
-
| <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
|
|
66
|
-
| <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
|
|
67
|
-
| <a href="https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-styled-tagged-template-expression/usage">@atlaskit/design-system/no-styled-tagged-template-expression</a> | Disallows any `styled` tagged template expressions that originate from Emotion, Styled Components or Compiled
|
|
68
|
-
| <a href="https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-empty-styled-expression/usage">@atlaskit/design-system/no-empty-styled-expression</a> | Forbids any styled expression to be used when passing empty arguments to styled.div() (or other JSX elements).
|
|
69
|
-
| <a href="https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-invalid-css-map/usage">@atlaskit/design-system/no-invalid-css-map</a> | Checks the validity of a CSS map created through cssMap. This is intended to be used alongside TypeScript's type-checking.
|
|
70
|
-
| <a href="https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-css-map-scoped/usage">@atlaskit/design-system/no-css-map-scoped</a> | Disallows usage of the experimental `cssMapScoped` API from `@compiled/react`. This API is internal and is not part of the public Compiled CSS-in-JS interface.
|
|
43
|
+
| Rule | Description | Recommended | Fixable | Suggestions |
|
|
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 | | | |
|
|
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-unsafe-selectors/README.md">no-unsafe-selectors</a> | Disallows use of nested styles in `css` functions. | Yes | Yes | Yes |
|
|
61
|
+
| <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 | | |
|
|
62
|
+
| <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 | | |
|
|
63
|
+
| <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 | |
|
|
64
|
+
| <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 | |
|
|
65
|
+
| <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 | |
|
|
66
|
+
| <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 | |
|
|
67
|
+
| <a href="https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-styled-tagged-template-expression/usage">@atlaskit/design-system/no-styled-tagged-template-expression</a> | Disallows any `styled` tagged template expressions that originate from Emotion, Styled Components or Compiled | Yes | Yes | |
|
|
68
|
+
| <a href="https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-empty-styled-expression/usage">@atlaskit/design-system/no-empty-styled-expression</a> | Forbids any styled expression to be used when passing empty arguments to styled.div() (or other JSX elements). | Yes | | |
|
|
69
|
+
| <a href="https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-invalid-css-map/usage">@atlaskit/design-system/no-invalid-css-map</a> | Checks the validity of a CSS map created through cssMap. This is intended to be used alongside TypeScript's type-checking. | Yes | | |
|
|
70
|
+
| <a href="https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-css-map-scoped/usage">@atlaskit/design-system/no-css-map-scoped</a> | Disallows usage of the experimental `cssMapScoped` API from `@compiled/react`. This API is internal and is not part of the public Compiled CSS-in-JS interface. | Yes | | |
|
|
71
71
|
|
|
72
72
|
<!-- END_RULE_TABLE_CODEGEN -->
|
|
@@ -373,7 +373,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
373
373
|
meta: {
|
|
374
374
|
name: 'convert-props-syntax',
|
|
375
375
|
docs: {
|
|
376
|
-
description: '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.',
|
|
376
|
+
description: '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.',
|
|
377
377
|
recommended: true,
|
|
378
378
|
severity: 'error'
|
|
379
379
|
},
|
|
@@ -184,7 +184,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
184
184
|
severity: 'error'
|
|
185
185
|
},
|
|
186
186
|
messages: {
|
|
187
|
-
'enforce-style-prop':
|
|
187
|
+
'enforce-style-prop': 'Move static style values into module-scoped cssMap() or css() declarations and apply them with css or xcss; keep only runtime values in style.'
|
|
188
188
|
},
|
|
189
189
|
type: 'problem'
|
|
190
190
|
},
|
|
@@ -27,7 +27,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
27
27
|
severity: 'error'
|
|
28
28
|
},
|
|
29
29
|
messages: {
|
|
30
|
-
'local-cx-xcss':
|
|
30
|
+
'local-cx-xcss': 'Call cx() directly inside the xcss prop, for example xcss={cx(styles.base, active && styles.active)}, instead of storing its result elsewhere.'
|
|
31
31
|
},
|
|
32
32
|
type: 'problem'
|
|
33
33
|
},
|
|
@@ -31,7 +31,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
31
31
|
severity: 'error'
|
|
32
32
|
},
|
|
33
33
|
messages: {
|
|
34
|
-
'no-array-arguments':
|
|
34
|
+
'no-array-arguments': 'Pass style objects as separate arguments instead of wrapping arguments in an array; delete an empty array argument.'
|
|
35
35
|
},
|
|
36
36
|
type: 'problem',
|
|
37
37
|
fixable: 'code',
|
|
@@ -14,7 +14,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
14
14
|
severity: 'error'
|
|
15
15
|
},
|
|
16
16
|
messages: {
|
|
17
|
-
'no-atlaskit-theme':
|
|
17
|
+
'no-atlaskit-theme': 'Replace @atlaskit/theme imports with semantic token() values from @atlaskit/tokens or the matching ADS component; migrate each imported helper before removing the import.'
|
|
18
18
|
},
|
|
19
19
|
type: 'problem'
|
|
20
20
|
},
|
|
@@ -21,7 +21,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
21
21
|
severity: 'error'
|
|
22
22
|
},
|
|
23
23
|
messages: {
|
|
24
|
-
'no-classname-prop':
|
|
24
|
+
'no-classname-prop': 'Apply local styles through css instead of className. Use supported component props or its bounded xcss interface for component customization.'
|
|
25
25
|
},
|
|
26
26
|
type: 'problem'
|
|
27
27
|
},
|
|
@@ -116,11 +116,11 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
116
116
|
severity: 'error'
|
|
117
117
|
},
|
|
118
118
|
messages: {
|
|
119
|
-
'no-container-queries':
|
|
120
|
-
'no-container-style-queries':
|
|
121
|
-
'no-unbound-container-queries':
|
|
122
|
-
'no-mismatched-container-name':
|
|
123
|
-
'no-non-dimension-container-queries':
|
|
119
|
+
'no-container-queries': 'Use a named container declared in this file and a width/height condition; type the static query key with satisfies and the default Container import from @atlaskit/css/at-rules/container.',
|
|
120
|
+
'no-container-style-queries': 'Replace the style query with an explicit prop and local cssMap variant, or use a width/height-based query when size is the intended condition.',
|
|
121
|
+
'no-unbound-container-queries': 'Name the container in the same file and reference it in the query, for example containerName: "card" with "@container card (min-width: 30rem)".',
|
|
122
|
+
'no-mismatched-container-name': 'Use the same container name in this @container query and the containerName declaration in this file; rename the mismatched declaration or query.',
|
|
123
|
+
'no-non-dimension-container-queries': 'Use a width/height condition for this named local container. Represent other conditions as explicit props selecting local styles.'
|
|
124
124
|
},
|
|
125
125
|
type: 'problem',
|
|
126
126
|
schema: schema
|
|
@@ -128,29 +128,28 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
128
128
|
create: function create(context) {
|
|
129
129
|
var importSources = (0, _isSupportedImport.getImportSources)(context);
|
|
130
130
|
var containerNames = new Set();
|
|
131
|
+
var styleCalls = [];
|
|
131
132
|
return {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
var id = getStaticString(property.value);
|
|
141
|
-
if (id) {
|
|
142
|
-
containerNames.add(id);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
fallback: 'iteration'
|
|
147
|
-
});
|
|
133
|
+
Property: function Property(node) {
|
|
134
|
+
var property = node;
|
|
135
|
+
if (isContainerDeclaration(property.key)) {
|
|
136
|
+
var id = getStaticString(property.value);
|
|
137
|
+
if (id) {
|
|
138
|
+
containerNames.add(id);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
148
141
|
},
|
|
149
142
|
CallExpression: function CallExpression(node) {
|
|
150
143
|
var _getScope = (0, _contextCompat.getScope)(context, node),
|
|
151
144
|
references = _getScope.references;
|
|
152
145
|
if ((0, _isSupportedImport.isCss)(node.callee, references, importSources) || (0, _isSupportedImport.isStyled)(node.callee, references, importSources) || (0, _isSupportedImport.isKeyframes)(node.callee, references, importSources) || (0, _isSupportedImport.isCssMap)(node.callee, references, importSources) || (0, _isSupportedImport.isXcss)(node.callee, references, importSources)) {
|
|
153
|
-
|
|
146
|
+
styleCalls.push(node);
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
// Container names can be declared after the style call that uses them, so check queries once the file is visited
|
|
150
|
+
'Program:exit': function ProgramExit() {
|
|
151
|
+
styleCalls.forEach(function (styleCall) {
|
|
152
|
+
_estraverse.default.traverse(styleCall, {
|
|
154
153
|
enter: function enter(node) {
|
|
155
154
|
if (node.type !== 'Property') {
|
|
156
155
|
return;
|
|
@@ -175,7 +174,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
175
174
|
*/
|
|
176
175
|
fallback: 'iteration'
|
|
177
176
|
});
|
|
178
|
-
}
|
|
177
|
+
});
|
|
179
178
|
}
|
|
180
179
|
};
|
|
181
180
|
}
|
|
@@ -34,7 +34,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
34
34
|
},
|
|
35
35
|
schema: schema,
|
|
36
36
|
messages: {
|
|
37
|
-
'no-dynamic-styles':
|
|
37
|
+
'no-dynamic-styles': 'Declare static variants with cssMap() and select the variant in JSX; pass values known only at runtime through the style prop.'
|
|
38
38
|
},
|
|
39
39
|
type: 'problem'
|
|
40
40
|
},
|
|
@@ -29,7 +29,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
29
29
|
severity: 'error'
|
|
30
30
|
},
|
|
31
31
|
messages: {
|
|
32
|
-
'no-exported-styles':
|
|
32
|
+
'no-exported-styles': 'Keep css, cssMap, keyframes, styled and xcss declarations in the file that uses them. Export a component to share its styling instead of exporting style values.'
|
|
33
33
|
},
|
|
34
34
|
type: 'problem',
|
|
35
35
|
schema: schema
|
|
@@ -26,8 +26,8 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
26
26
|
severity: 'error'
|
|
27
27
|
},
|
|
28
28
|
messages: {
|
|
29
|
-
'no-global-styles':
|
|
30
|
-
'no-css-modules':
|
|
29
|
+
'no-global-styles': 'Move global declarations into local cssMap() or css() styles on their owning elements. Use @atlaskit/css-reset only for the supported global reset.',
|
|
30
|
+
'no-css-modules': 'Replace the CSS-file import with local cssMap() or css() declarations from @atlaskit/css and apply them on the owning elements; preserve the imported styles during migration.'
|
|
31
31
|
},
|
|
32
32
|
type: 'problem'
|
|
33
33
|
},
|
|
@@ -18,7 +18,7 @@ var rule = (0, _createRuleWithTypedConfig.createLintRuleWithTypedConfig)({
|
|
|
18
18
|
severity: 'error'
|
|
19
19
|
},
|
|
20
20
|
messages: {
|
|
21
|
-
'no-important-styles':
|
|
21
|
+
'no-important-styles': 'Remove !important and apply the intended style directly to the owning element; resolve conflicting declarations through local style composition.'
|
|
22
22
|
},
|
|
23
23
|
type: 'problem',
|
|
24
24
|
schema: {
|
|
@@ -12,6 +12,7 @@ var _contextCompat = require("@atlaskit/eslint-utils/context-compat");
|
|
|
12
12
|
var _findVariable = require("@atlaskit/eslint-utils/find-variable");
|
|
13
13
|
var _isSupportedImport = require("@atlaskit/eslint-utils/is-supported-import");
|
|
14
14
|
var _createRule = require("../utils/create-rule");
|
|
15
|
+
var _isTypeWrapper = require("../utils/is-type-wrapper");
|
|
15
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; } } }; }
|
|
16
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; } }
|
|
17
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; }
|
|
@@ -123,7 +124,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
123
124
|
severity: 'error'
|
|
124
125
|
},
|
|
125
126
|
messages: {
|
|
126
|
-
'no-imported-style-values':
|
|
127
|
+
'no-imported-style-values': 'Declare and use these styles in the same file. Share a component across files instead of importing css, cssMap, styled, keyframes or xcss values.'
|
|
127
128
|
},
|
|
128
129
|
type: 'problem',
|
|
129
130
|
schema: schema
|
|
@@ -150,6 +151,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
150
151
|
}
|
|
151
152
|
};
|
|
152
153
|
var isValidCx = function isValidCx(jsxAttribute, identifier) {
|
|
154
|
+
var _callExpression;
|
|
153
155
|
/**
|
|
154
156
|
* We don't want to allow `cx` for `css` (or `style`)
|
|
155
157
|
*/
|
|
@@ -158,7 +160,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
158
160
|
}
|
|
159
161
|
|
|
160
162
|
/**
|
|
161
|
-
*
|
|
163
|
+
* Allow `xcss={cx(...)}` through type-only wrappers, but not runtime wrappers.
|
|
162
164
|
*/
|
|
163
165
|
|
|
164
166
|
var jsxExpression = jsxAttribute.value;
|
|
@@ -166,7 +168,11 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
166
168
|
return false;
|
|
167
169
|
}
|
|
168
170
|
var callExpression = jsxExpression.expression;
|
|
169
|
-
|
|
171
|
+
while ((0, _isTypeWrapper.isTypeWrapper)(callExpression)) {
|
|
172
|
+
// ESTree does not model TypeScript wrappers; each has an expression child.
|
|
173
|
+
callExpression = callExpression.expression;
|
|
174
|
+
}
|
|
175
|
+
if (((_callExpression = callExpression) === null || _callExpression === void 0 ? void 0 : _callExpression.type) !== 'CallExpression') {
|
|
170
176
|
return false;
|
|
171
177
|
}
|
|
172
178
|
if (callExpression.callee !== identifier) {
|
|
@@ -51,7 +51,9 @@ function isAllowedSelector(selector) {
|
|
|
51
51
|
var isHeadAllowed = (0, _postcssSelectorParser.isNesting)(head) || (0, _postcssSelectorParser.isPseudo)(head);
|
|
52
52
|
|
|
53
53
|
// All remaining nodes must be pseudo selectors.
|
|
54
|
-
var isTailAllowed = tail.every(
|
|
54
|
+
var isTailAllowed = tail.every(function (node) {
|
|
55
|
+
return (0, _postcssSelectorParser.isPseudo)(node);
|
|
56
|
+
});
|
|
55
57
|
return isHeadAllowed && isTailAllowed;
|
|
56
58
|
}
|
|
57
59
|
var rule = (0, _createRuleWithTypedConfig.createLintRuleWithTypedConfig)({
|
|
@@ -63,7 +65,7 @@ var rule = (0, _createRuleWithTypedConfig.createLintRuleWithTypedConfig)({
|
|
|
63
65
|
severity: 'error'
|
|
64
66
|
},
|
|
65
67
|
messages: {
|
|
66
|
-
'no-nested-selectors':
|
|
68
|
+
'no-nested-selectors': 'Apply local styles directly to the child element instead of selecting it through a parent or external context; pass explicit props for conditional variants.'
|
|
67
69
|
},
|
|
68
70
|
type: 'problem',
|
|
69
71
|
schema: {
|
|
@@ -16,7 +16,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
16
16
|
severity: 'error'
|
|
17
17
|
},
|
|
18
18
|
messages: {
|
|
19
|
-
'no-styled':
|
|
19
|
+
'no-styled': 'Replace styled with module-scoped cssMap() or css() from @atlaskit/css and apply styles on the element; pass runtime-only values through style.'
|
|
20
20
|
},
|
|
21
21
|
type: 'problem'
|
|
22
22
|
},
|
|
@@ -101,23 +101,23 @@ var rule = (0, _createRuleWithTypedConfig.createLintRuleWithTypedConfig)({
|
|
|
101
101
|
/**
|
|
102
102
|
* Selector messages
|
|
103
103
|
*/
|
|
104
|
-
'no-ambiguous-pseudos':
|
|
105
|
-
'no-increased-specificity':
|
|
106
|
-
'no-restricted-pseudos':
|
|
107
|
-
'no-legacy-pseudo-element-syntax':
|
|
104
|
+
'no-ambiguous-pseudos': 'Prefix the pseudo-selector with & when it targets this element (for example &:hover); apply descendant styles directly to the child instead.',
|
|
105
|
+
'no-increased-specificity': 'Replace chained nesting selectors such as && with one & selector, then resolve competing styles through local composition.',
|
|
106
|
+
'no-restricted-pseudos': 'The {{pseudo}} pseudo-selector is unsupported. Use an allowed local pseudo such as &:hover, or pass explicit state as a prop and select a local cssMap variant.',
|
|
107
|
+
'no-legacy-pseudo-element-syntax': 'Use a double colon for pseudo-elements, for example &::before or &::after, instead of the legacy single-colon syntax.',
|
|
108
108
|
'no-unparsable-selectors': "The selector '{{selectorText}}' could not be parsed. Correct its CSS syntax; if it is valid, report the selector and reproduction to #help-ui-styling-standard.",
|
|
109
|
-
'no-selectors-object':
|
|
109
|
+
'no-selectors-object': 'Move selectors out of the selectors object into supported local style keys; apply child styles directly to each child element.',
|
|
110
110
|
/**
|
|
111
111
|
* At-rule messages
|
|
112
112
|
*/
|
|
113
|
-
'no-keyframes-at-rules':
|
|
114
|
-
'no-restricted-at-rules':
|
|
115
|
-
'no-grouped-at-rules':
|
|
116
|
-
'no-noncanonical-media-query':
|
|
113
|
+
'no-keyframes-at-rules': 'Replace the @keyframes at-rule with keyframes() from @compiled/react and reference its result through animationName.',
|
|
114
|
+
'no-restricted-at-rules': '{{atRule}} is unsupported. Use a supported @media, @supports or @property rule; for runtime conditions select a local style variant in JavaScript.',
|
|
115
|
+
'no-grouped-at-rules': 'Flatten grouped at-rules into complete keys, for example "@media (min-width: 48rem)" instead of an "@media" object containing conditions.',
|
|
116
|
+
'no-noncanonical-media-query': 'Match the literal query to its imported @atlaskit/css/at-rules type, including the exact breakpoint, units and comparison operator.',
|
|
117
117
|
/**
|
|
118
118
|
* Suggestion messages
|
|
119
119
|
*/
|
|
120
|
-
'insert-nesting-selector':
|
|
120
|
+
'insert-nesting-selector': 'Insert & before this pseudo-selector to target the element itself, for example &:hover.'
|
|
121
121
|
},
|
|
122
122
|
schema: {
|
|
123
123
|
type: 'object',
|
|
@@ -14,6 +14,11 @@ var _sourcePositionUtils = require("./source-position-utils");
|
|
|
14
14
|
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; } } }; }
|
|
15
15
|
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; } }
|
|
16
16
|
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; }
|
|
17
|
+
/**
|
|
18
|
+
* Structural stand-ins for postcss-selector-parser types. Importing Selector /
|
|
19
|
+
* Pseudo / Nesting under TSRS expands into an infinite Container/Diff cycle.
|
|
20
|
+
*/
|
|
21
|
+
|
|
17
22
|
function lintSelector(args) {
|
|
18
23
|
checkNoAmbiguousPseudos(args);
|
|
19
24
|
var pseudos = [];
|
|
@@ -237,7 +242,7 @@ function checkNoIncreasedSpecificity(_ref4, nestings) {
|
|
|
237
242
|
var lastNesting = nesting;
|
|
238
243
|
while ((0, _postcssSelectorParser.isNesting)(next)) {
|
|
239
244
|
lastNesting = next;
|
|
240
|
-
next =
|
|
245
|
+
next = lastNesting.next();
|
|
241
246
|
}
|
|
242
247
|
var _getRangeFromNode = (0, _sourcePositionUtils.getRangeFromNode)({
|
|
243
248
|
node: nesting,
|
|
@@ -4,6 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getRangeFromNode = getRangeFromNode;
|
|
7
|
+
/**
|
|
8
|
+
* Structural stand-in for postcss-selector-parser's Node. Avoid importing that
|
|
9
|
+
* Node type — under TSRS it expands into an infinite Container/Diff cycle.
|
|
10
|
+
*/
|
|
11
|
+
|
|
7
12
|
function getRangeFromNode(_ref) {
|
|
8
13
|
var node = _ref.node,
|
|
9
14
|
sourceNode = _ref.sourceNode;
|
|
@@ -77,7 +77,7 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
77
77
|
severity: 'warn'
|
|
78
78
|
},
|
|
79
79
|
messages: {
|
|
80
|
-
'unused-property':
|
|
80
|
+
'unused-property': 'The "{{propertyName}}" style is never used. Remove it from cssMap, or apply it to the intended element if the style is still required.'
|
|
81
81
|
},
|
|
82
82
|
type: 'problem'
|
|
83
83
|
},
|
|
@@ -8,6 +8,12 @@ exports.parseSelector = parseSelector;
|
|
|
8
8
|
var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
|
|
9
9
|
var _contextCompat = require("@atlaskit/eslint-utils/context-compat");
|
|
10
10
|
var cssSelectorProcessor = (0, _postcssSelectorParser.default)();
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Structural stand-in for postcss-selector-parser's Root AST. Avoid returning the
|
|
14
|
+
* library's Selector/Container types — under TSRS they expand into an infinite cycle.
|
|
15
|
+
*/
|
|
16
|
+
|
|
11
17
|
var selectorCache = new WeakMap();
|
|
12
18
|
|
|
13
19
|
/**
|
|
@@ -269,7 +269,7 @@ const rule = createLintRule({
|
|
|
269
269
|
meta: {
|
|
270
270
|
name: 'convert-props-syntax',
|
|
271
271
|
docs: {
|
|
272
|
-
description: '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.',
|
|
272
|
+
description: '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.',
|
|
273
273
|
recommended: true,
|
|
274
274
|
severity: 'error'
|
|
275
275
|
},
|
|
@@ -180,7 +180,7 @@ const rule = createLintRule({
|
|
|
180
180
|
severity: 'error'
|
|
181
181
|
},
|
|
182
182
|
messages: {
|
|
183
|
-
'enforce-style-prop':
|
|
183
|
+
'enforce-style-prop': 'Move static style values into module-scoped cssMap() or css() declarations and apply them with css or xcss; keep only runtime values in style.'
|
|
184
184
|
},
|
|
185
185
|
type: 'problem'
|
|
186
186
|
},
|
|
@@ -21,7 +21,7 @@ const rule = createLintRule({
|
|
|
21
21
|
severity: 'error'
|
|
22
22
|
},
|
|
23
23
|
messages: {
|
|
24
|
-
'local-cx-xcss':
|
|
24
|
+
'local-cx-xcss': 'Call cx() directly inside the xcss prop, for example xcss={cx(styles.base, active && styles.active)}, instead of storing its result elsewhere.'
|
|
25
25
|
},
|
|
26
26
|
type: 'problem'
|
|
27
27
|
},
|
|
@@ -22,7 +22,7 @@ const rule = createLintRule({
|
|
|
22
22
|
severity: 'error'
|
|
23
23
|
},
|
|
24
24
|
messages: {
|
|
25
|
-
'no-array-arguments':
|
|
25
|
+
'no-array-arguments': 'Pass style objects as separate arguments instead of wrapping arguments in an array; delete an empty array argument.'
|
|
26
26
|
},
|
|
27
27
|
type: 'problem',
|
|
28
28
|
fixable: 'code',
|
|
@@ -8,7 +8,7 @@ const rule = createLintRule({
|
|
|
8
8
|
severity: 'error'
|
|
9
9
|
},
|
|
10
10
|
messages: {
|
|
11
|
-
'no-atlaskit-theme':
|
|
11
|
+
'no-atlaskit-theme': 'Replace @atlaskit/theme imports with semantic token() values from @atlaskit/tokens or the matching ADS component; migrate each imported helper before removing the import.'
|
|
12
12
|
},
|
|
13
13
|
type: 'problem'
|
|
14
14
|
},
|
|
@@ -15,7 +15,7 @@ const rule = createLintRule({
|
|
|
15
15
|
severity: 'error'
|
|
16
16
|
},
|
|
17
17
|
messages: {
|
|
18
|
-
'no-classname-prop':
|
|
18
|
+
'no-classname-prop': 'Apply local styles through css instead of className. Use supported component props or its bounded xcss interface for component customization.'
|
|
19
19
|
},
|
|
20
20
|
type: 'problem'
|
|
21
21
|
},
|