@atlaskit/eslint-plugin-ui-styling-standard 0.4.0 → 0.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.
- package/CHANGELOG.md +6 -0
- package/constellation/consistent-css-prop-usage/usage.mdx +2 -2
- package/constellation/index/overview.mdx +8 -11
- package/constellation/no-css-tagged-template-expression/usage.mdx +2 -2
- package/constellation/no-empty-styled-expression/usage.mdx +2 -2
- package/constellation/no-exported-css/usage.mdx +2 -2
- package/constellation/no-exported-keyframes/usage.mdx +2 -2
- package/constellation/no-invalid-css-map/usage.mdx +2 -2
- package/constellation/no-js-xcss/usage.mdx +1 -19
- package/constellation/no-keyframes-tagged-template-expression/usage.mdx +2 -2
- package/constellation/no-styled-tagged-template-expression/usage.mdx +2 -2
- package/dist/cjs/presets/all.codegen.js +4 -2
- package/dist/cjs/presets/recommended.codegen.js +4 -2
- package/dist/cjs/rules/external-rules.js +27 -1
- package/dist/es2019/presets/all.codegen.js +4 -2
- package/dist/es2019/presets/recommended.codegen.js +4 -2
- package/dist/es2019/rules/external-rules.js +27 -1
- package/dist/esm/presets/all.codegen.js +4 -2
- package/dist/esm/presets/recommended.codegen.js +4 -2
- package/dist/esm/rules/external-rules.js +27 -1
- package/dist/types/index.codegen.d.ts +6 -2
- package/dist/types/presets/all.codegen.d.ts +4 -2
- package/dist/types/presets/recommended.codegen.d.ts +4 -2
- package/dist/types-ts4.5/index.codegen.d.ts +6 -2
- package/dist/types-ts4.5/presets/all.codegen.d.ts +4 -2
- package/dist/types-ts4.5/presets/recommended.codegen.d.ts +4 -2
- package/package.json +1 -1
- package/scripts/codegen.tsx +1 -1
- package/src/presets/all.codegen.tsx +13 -2
- package/src/presets/recommended.codegen.tsx +13 -2
- package/src/rules/external-rules.tsx +30 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-ui-styling-standard
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#76885](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/76885) [`06030bc18dd4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/06030bc18dd4) - Disable `styled-components` handling for `no-styled-tagged-template-expression` rule, due to edge case where props are converted to output that fails typechecking.
|
|
8
|
+
|
|
3
9
|
## 0.4.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# @atlaskit/design-system/consistent-css-prop-usage
|
|
2
2
|
|
|
3
|
-
Ensures consistency with `css` and `xcss` prop usages
|
|
3
|
+
Ensures consistency with all `css` and `xcss` prop usages.
|
|
4
4
|
|
|
5
|
-
This rule is maintained by another package and configured here
|
|
5
|
+
This rule is maintained by another package and configured here; refer to https://atlassian.design/components/eslint-plugin-design-system/consistent-css-prop-usage/usage for more details.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
The UI Styling Standard is a set of ESLint rules and principles to guide building web styling code
|
|
1
|
+
The UI Styling Standard is a set of principles to guide styling UI code
|
|
4
2
|
across Atlassian's frontend codebases and ecosystem.
|
|
5
3
|
|
|
4
|
+
These are the current ESLint rules that enforce and help comply with the UI Styling Standard today,
|
|
5
|
+
but more are planned to support the standard over time.
|
|
6
|
+
|
|
6
7
|
## Rules
|
|
7
8
|
|
|
8
9
|
<!-- START_RULE_TABLE_CODEGEN -->
|
|
@@ -26,6 +27,8 @@ across Atlassian's frontend codebases and ecosystem.
|
|
|
26
27
|
|
|
27
28
|
## Purpose of the UI Styling Standard
|
|
28
29
|
|
|
30
|
+
For Atlassians, refer to the [internal UI Styling Standard policy](https://go.atlassian.com/ui-styling-standard-policy).
|
|
31
|
+
|
|
29
32
|
To enforce scoped encapsulation, type safety, and deterministic behavior in styling code that is
|
|
30
33
|
present in other programming languages. This is a stepping stone to large performance improvements,
|
|
31
34
|
reduced visual regressions, and enables testing and maintainability at scale.
|
|
@@ -41,7 +44,7 @@ code migrations, and future advancements like generative AI.
|
|
|
41
44
|
- To reduce the amount of overall custom styling code written while supporting customization without without the need for hacks and technical debt.
|
|
42
45
|
- We aim to see a reduction of the “average styles per component”, reducing the effort to build and maintain UIs.
|
|
43
46
|
|
|
44
|
-
## Basic
|
|
47
|
+
## Basic principles
|
|
45
48
|
|
|
46
49
|
We want the styling ecosystem (CSS, CSS-in-JS, and parts of JSX) at Atlassian and the wider ecosystem
|
|
47
50
|
we support to be as mature as the other code we write, such as TypeScript/JavaScript, Java, Go, etc.
|
|
@@ -58,15 +61,9 @@ we support to be as mature as the other code we write, such as TypeScript/JavaSc
|
|
|
58
61
|
As the W3C CSS spec and wider industry grows, having our styling code meet these principles will mean we
|
|
59
62
|
can programatically evolve that a better future state.
|
|
60
63
|
|
|
61
|
-
## How we'll achieve this
|
|
62
|
-
|
|
63
|
-
Within Atlassian, most frontend code will have this enforced over time through ESLint rules and engineering standardization.
|
|
64
|
-
|
|
65
|
-
Refer to the eslint rules for more details: _documentation coming soon_
|
|
66
|
-
|
|
67
64
|
## Examples
|
|
68
65
|
|
|
69
|
-
|
|
66
|
+
Refer to the [eslint rules](#rules) for more in-depth examples.
|
|
70
67
|
|
|
71
68
|
### Incorrect code
|
|
72
69
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# @atlaskit/design-system/no-css-tagged-template-expression
|
|
2
2
|
|
|
3
|
-
Disallows any css tagged template expressions that originate from
|
|
3
|
+
Disallows any `css` tagged template expressions that originate from a CSS-in-JS library, including `@atlaskit/css`, `@compiled/react`, Emotion, and `styled-components`.
|
|
4
4
|
|
|
5
|
-
This rule is maintained by another package and configured here
|
|
5
|
+
This rule is maintained by another package and configured here; refer to https://atlassian.design/components/eslint-plugin-design-system/no-css-tagged-template-expression/usage for more details.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# @atlaskit/design-system/no-empty-styled-expression
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Forbids any styled expression to be used when passing empty arguments to styled.div() (or other JSX elements).
|
|
4
4
|
|
|
5
|
-
This rule is maintained by another package and configured here
|
|
5
|
+
This rule is maintained by another package and configured here; refer to https://atlassian.design/components/eslint-plugin-design-system/no-empty-styled-expression/usage for more details.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# @atlaskit/design-system/no-exported-css
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Forbid exporting `css` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable.
|
|
4
4
|
|
|
5
|
-
This rule is maintained by another package and configured here
|
|
5
|
+
This rule is maintained by another package and configured here; refer to https://atlassian.design/components/eslint-plugin-design-system/no-exported-css/usage for more details.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# @atlaskit/design-system/no-exported-keyframes
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Forbid exporting `keyframes` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable.
|
|
4
4
|
|
|
5
|
-
This rule is maintained by another package and configured here
|
|
5
|
+
This rule is maintained by another package and configured here; refer to https://atlassian.design/components/eslint-plugin-design-system/no-exported-keyframes/usage for more details.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# @atlaskit/design-system/no-invalid-css-map
|
|
2
2
|
|
|
3
|
-
Ensure that all usages of the cssMap API are valid, and enforces the format of the object that is passed to cssMap.
|
|
3
|
+
Ensure that all usages of the cssMap API are valid, and enforces the format of the object that is passed to cssMap. This is intended to be used alongside TypeScript's type-checking.
|
|
4
4
|
|
|
5
|
-
This rule is maintained by another package and configured here
|
|
5
|
+
This rule is maintained by another package and configured here; refer to https://atlassian.design/components/eslint-plugin-design-system/no-invalid-css-map/usage for more details.
|
|
@@ -2,22 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
Disallows using xcss prop inside JavaScript files.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## Incorrect
|
|
8
|
-
|
|
9
|
-
Do not use xcss in a JavaScript file as type safety is required to ensure compatability and support
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
// my-component.js
|
|
13
|
-
<Button xcss={{ fill: 'var(--ds-text)' }} />
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Correct
|
|
17
|
-
|
|
18
|
-
Using xcss in a TypeScript file is perfectly fine
|
|
19
|
-
|
|
20
|
-
```tsx
|
|
21
|
-
// my-component.tsx
|
|
22
|
-
<Button xcss={{ color: 'var(--ds-text)' }} />
|
|
23
|
-
```
|
|
5
|
+
This rule is maintained by another package and configured here; refer to https://github.com/atlassian-labs/compiled/tree/master/packages/eslint-plugin/src/rules/no-js-xcss for more details.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# @atlaskit/design-system/no-keyframes-tagged-template-expression
|
|
2
2
|
|
|
3
|
-
Disallows any keyframes tagged template expressions that originate from
|
|
3
|
+
Disallows any `keyframes` tagged template expressions that originate from a CSS-in-JS library, including `@atlaskit/css`, `@compiled/react`, Emotion, and `styled-components`.
|
|
4
4
|
|
|
5
|
-
This rule is maintained by another package and configured here
|
|
5
|
+
This rule is maintained by another package and configured here; refer to https://atlassian.design/components/eslint-plugin-design-system/no-keyframes-tagged-template-expression/usage for more details.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# @atlaskit/design-system/no-styled-tagged-template-expression
|
|
2
2
|
|
|
3
|
-
Disallows any styled tagged template expressions that originate from
|
|
3
|
+
Disallows any `styled` tagged template expressions that originate from from a CSS-in-JS library, including `@atlaskit/css`, `@compiled/react`, Emotion, and `styled-components`.
|
|
4
4
|
|
|
5
|
-
This rule is maintained by another package and configured here
|
|
5
|
+
This rule is maintained by another package and configured here; refer to https://atlassian.design/components/eslint-plugin-design-system/no-styled-tagged-template-expression/usage for more details.
|
|
@@ -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::
|
|
9
|
+
* @codegen <<SignedSource::9869b1757ca915f74b471fe04f72e5ea>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
11
11
|
*/
|
|
12
12
|
var _default = exports.default = {
|
|
@@ -18,7 +18,9 @@ var _default = exports.default = {
|
|
|
18
18
|
}],
|
|
19
19
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'warn',
|
|
20
20
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': 'warn',
|
|
21
|
-
'@atlaskit/design-system/no-styled-tagged-template-expression': 'warn',
|
|
21
|
+
'@atlaskit/design-system/no-styled-tagged-template-expression': ['warn', {
|
|
22
|
+
importSources: ['@compiled/react', '@atlaskit/css', '@emotion/core', '@emotion/react', '@emotion/styled']
|
|
23
|
+
}],
|
|
22
24
|
'@compiled/no-suppress-xcss': 'warn',
|
|
23
25
|
'@compiled/no-js-xcss': 'warn',
|
|
24
26
|
'@atlaskit/design-system/no-empty-styled-expression': ['warn', {
|
|
@@ -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::
|
|
9
|
+
* @codegen <<SignedSource::9869b1757ca915f74b471fe04f72e5ea>>
|
|
10
10
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
11
11
|
*/
|
|
12
12
|
var _default = exports.default = {
|
|
@@ -18,7 +18,9 @@ var _default = exports.default = {
|
|
|
18
18
|
}],
|
|
19
19
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'warn',
|
|
20
20
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': 'warn',
|
|
21
|
-
'@atlaskit/design-system/no-styled-tagged-template-expression': 'warn',
|
|
21
|
+
'@atlaskit/design-system/no-styled-tagged-template-expression': ['warn', {
|
|
22
|
+
importSources: ['@compiled/react', '@atlaskit/css', '@emotion/core', '@emotion/react', '@emotion/styled']
|
|
23
|
+
}],
|
|
22
24
|
'@compiled/no-suppress-xcss': 'warn',
|
|
23
25
|
'@compiled/no-js-xcss': 'warn',
|
|
24
26
|
'@atlaskit/design-system/no-empty-styled-expression': ['warn', {
|
|
@@ -8,6 +8,29 @@ var _createRule = require("./utils/create-rule");
|
|
|
8
8
|
/** External rules must be scoped, have a display name, and external urls. */
|
|
9
9
|
|
|
10
10
|
var importSources = ['@compiled/react', '@atlaskit/css', '@emotion/core', '@emotion/react', '@emotion/styled', 'styled-components'];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Same as importSources, but excludes `styled-components` because the type-checking
|
|
14
|
+
* for `styled-components` does not support the `no-styled-tagged-template-expression`
|
|
15
|
+
* lint output for this:
|
|
16
|
+
*
|
|
17
|
+
* export const Container = styled(Section)`
|
|
18
|
+
* max-height: ${gridSize * 46}px;
|
|
19
|
+
* overflow: auto;
|
|
20
|
+
* `;
|
|
21
|
+
*
|
|
22
|
+
* export const ErrorStateContainer = styled(Container)`
|
|
23
|
+
* margin: ${
|
|
24
|
+
* (props: any) =>
|
|
25
|
+
* props.canManageAutomations // Use negative margin to reduce whitespace when the Footer component is shown
|
|
26
|
+
* ? `${gridSize * -4}px ${gridSize * 2}px`
|
|
27
|
+
* : `0 ${gridSize * 2}px`
|
|
28
|
+
* };
|
|
29
|
+
* `;
|
|
30
|
+
*/
|
|
31
|
+
var noStyledTaggedTemplateExpressionImportSources = ['@compiled/react', '@atlaskit/css',
|
|
32
|
+
// doesn't do anything because @atlaskit/css doesn't expose a styled API
|
|
33
|
+
'@emotion/core', '@emotion/react', '@emotion/styled'];
|
|
11
34
|
var externalRules = exports.externalRules = [{
|
|
12
35
|
name: '@atlaskit/design-system/consistent-css-prop-usage',
|
|
13
36
|
displayName: 'consistent-css-prop-usage',
|
|
@@ -60,7 +83,10 @@ var externalRules = exports.externalRules = [{
|
|
|
60
83
|
url: (0, _createRule.getRuleUrl)('no-styled-tagged-template-expression'),
|
|
61
84
|
externalUrl: 'https://atlassian.design/components/eslint-plugin-design-system/no-styled-tagged-template-expression/usage',
|
|
62
85
|
recommended: true,
|
|
63
|
-
severity: 'warn'
|
|
86
|
+
severity: 'warn',
|
|
87
|
+
pluginConfig: {
|
|
88
|
+
importSources: noStyledTaggedTemplateExpressionImportSources
|
|
89
|
+
}
|
|
64
90
|
}
|
|
65
91
|
}, {
|
|
66
92
|
name: '@compiled/no-suppress-xcss',
|
|
@@ -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::
|
|
3
|
+
* @codegen <<SignedSource::9869b1757ca915f74b471fe04f72e5ea>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
@@ -12,7 +12,9 @@ export default {
|
|
|
12
12
|
}],
|
|
13
13
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'warn',
|
|
14
14
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': 'warn',
|
|
15
|
-
'@atlaskit/design-system/no-styled-tagged-template-expression': 'warn',
|
|
15
|
+
'@atlaskit/design-system/no-styled-tagged-template-expression': ['warn', {
|
|
16
|
+
importSources: ['@compiled/react', '@atlaskit/css', '@emotion/core', '@emotion/react', '@emotion/styled']
|
|
17
|
+
}],
|
|
16
18
|
'@compiled/no-suppress-xcss': 'warn',
|
|
17
19
|
'@compiled/no-js-xcss': 'warn',
|
|
18
20
|
'@atlaskit/design-system/no-empty-styled-expression': ['warn', {
|
|
@@ -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::
|
|
3
|
+
* @codegen <<SignedSource::9869b1757ca915f74b471fe04f72e5ea>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
@@ -12,7 +12,9 @@ export default {
|
|
|
12
12
|
}],
|
|
13
13
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'warn',
|
|
14
14
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': 'warn',
|
|
15
|
-
'@atlaskit/design-system/no-styled-tagged-template-expression': 'warn',
|
|
15
|
+
'@atlaskit/design-system/no-styled-tagged-template-expression': ['warn', {
|
|
16
|
+
importSources: ['@compiled/react', '@atlaskit/css', '@emotion/core', '@emotion/react', '@emotion/styled']
|
|
17
|
+
}],
|
|
16
18
|
'@compiled/no-suppress-xcss': 'warn',
|
|
17
19
|
'@compiled/no-js-xcss': 'warn',
|
|
18
20
|
'@atlaskit/design-system/no-empty-styled-expression': ['warn', {
|
|
@@ -3,6 +3,29 @@ import { getRuleUrl } from './utils/create-rule';
|
|
|
3
3
|
/** External rules must be scoped, have a display name, and external urls. */
|
|
4
4
|
|
|
5
5
|
const importSources = ['@compiled/react', '@atlaskit/css', '@emotion/core', '@emotion/react', '@emotion/styled', 'styled-components'];
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Same as importSources, but excludes `styled-components` because the type-checking
|
|
9
|
+
* for `styled-components` does not support the `no-styled-tagged-template-expression`
|
|
10
|
+
* lint output for this:
|
|
11
|
+
*
|
|
12
|
+
* export const Container = styled(Section)`
|
|
13
|
+
* max-height: ${gridSize * 46}px;
|
|
14
|
+
* overflow: auto;
|
|
15
|
+
* `;
|
|
16
|
+
*
|
|
17
|
+
* export const ErrorStateContainer = styled(Container)`
|
|
18
|
+
* margin: ${
|
|
19
|
+
* (props: any) =>
|
|
20
|
+
* props.canManageAutomations // Use negative margin to reduce whitespace when the Footer component is shown
|
|
21
|
+
* ? `${gridSize * -4}px ${gridSize * 2}px`
|
|
22
|
+
* : `0 ${gridSize * 2}px`
|
|
23
|
+
* };
|
|
24
|
+
* `;
|
|
25
|
+
*/
|
|
26
|
+
const noStyledTaggedTemplateExpressionImportSources = ['@compiled/react', '@atlaskit/css',
|
|
27
|
+
// doesn't do anything because @atlaskit/css doesn't expose a styled API
|
|
28
|
+
'@emotion/core', '@emotion/react', '@emotion/styled'];
|
|
6
29
|
export const externalRules = [{
|
|
7
30
|
name: '@atlaskit/design-system/consistent-css-prop-usage',
|
|
8
31
|
displayName: 'consistent-css-prop-usage',
|
|
@@ -55,7 +78,10 @@ export const externalRules = [{
|
|
|
55
78
|
url: getRuleUrl('no-styled-tagged-template-expression'),
|
|
56
79
|
externalUrl: 'https://atlassian.design/components/eslint-plugin-design-system/no-styled-tagged-template-expression/usage',
|
|
57
80
|
recommended: true,
|
|
58
|
-
severity: 'warn'
|
|
81
|
+
severity: 'warn',
|
|
82
|
+
pluginConfig: {
|
|
83
|
+
importSources: noStyledTaggedTemplateExpressionImportSources
|
|
84
|
+
}
|
|
59
85
|
}
|
|
60
86
|
}, {
|
|
61
87
|
name: '@compiled/no-suppress-xcss',
|
|
@@ -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::
|
|
3
|
+
* @codegen <<SignedSource::9869b1757ca915f74b471fe04f72e5ea>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
@@ -12,7 +12,9 @@ export default {
|
|
|
12
12
|
}],
|
|
13
13
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'warn',
|
|
14
14
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': 'warn',
|
|
15
|
-
'@atlaskit/design-system/no-styled-tagged-template-expression': 'warn',
|
|
15
|
+
'@atlaskit/design-system/no-styled-tagged-template-expression': ['warn', {
|
|
16
|
+
importSources: ['@compiled/react', '@atlaskit/css', '@emotion/core', '@emotion/react', '@emotion/styled']
|
|
17
|
+
}],
|
|
16
18
|
'@compiled/no-suppress-xcss': 'warn',
|
|
17
19
|
'@compiled/no-js-xcss': 'warn',
|
|
18
20
|
'@atlaskit/design-system/no-empty-styled-expression': ['warn', {
|
|
@@ -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::
|
|
3
|
+
* @codegen <<SignedSource::9869b1757ca915f74b471fe04f72e5ea>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
@@ -12,7 +12,9 @@ export default {
|
|
|
12
12
|
}],
|
|
13
13
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'warn',
|
|
14
14
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': 'warn',
|
|
15
|
-
'@atlaskit/design-system/no-styled-tagged-template-expression': 'warn',
|
|
15
|
+
'@atlaskit/design-system/no-styled-tagged-template-expression': ['warn', {
|
|
16
|
+
importSources: ['@compiled/react', '@atlaskit/css', '@emotion/core', '@emotion/react', '@emotion/styled']
|
|
17
|
+
}],
|
|
16
18
|
'@compiled/no-suppress-xcss': 'warn',
|
|
17
19
|
'@compiled/no-js-xcss': 'warn',
|
|
18
20
|
'@atlaskit/design-system/no-empty-styled-expression': ['warn', {
|
|
@@ -3,6 +3,29 @@ import { getRuleUrl } from './utils/create-rule';
|
|
|
3
3
|
/** External rules must be scoped, have a display name, and external urls. */
|
|
4
4
|
|
|
5
5
|
var importSources = ['@compiled/react', '@atlaskit/css', '@emotion/core', '@emotion/react', '@emotion/styled', 'styled-components'];
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Same as importSources, but excludes `styled-components` because the type-checking
|
|
9
|
+
* for `styled-components` does not support the `no-styled-tagged-template-expression`
|
|
10
|
+
* lint output for this:
|
|
11
|
+
*
|
|
12
|
+
* export const Container = styled(Section)`
|
|
13
|
+
* max-height: ${gridSize * 46}px;
|
|
14
|
+
* overflow: auto;
|
|
15
|
+
* `;
|
|
16
|
+
*
|
|
17
|
+
* export const ErrorStateContainer = styled(Container)`
|
|
18
|
+
* margin: ${
|
|
19
|
+
* (props: any) =>
|
|
20
|
+
* props.canManageAutomations // Use negative margin to reduce whitespace when the Footer component is shown
|
|
21
|
+
* ? `${gridSize * -4}px ${gridSize * 2}px`
|
|
22
|
+
* : `0 ${gridSize * 2}px`
|
|
23
|
+
* };
|
|
24
|
+
* `;
|
|
25
|
+
*/
|
|
26
|
+
var noStyledTaggedTemplateExpressionImportSources = ['@compiled/react', '@atlaskit/css',
|
|
27
|
+
// doesn't do anything because @atlaskit/css doesn't expose a styled API
|
|
28
|
+
'@emotion/core', '@emotion/react', '@emotion/styled'];
|
|
6
29
|
export var externalRules = [{
|
|
7
30
|
name: '@atlaskit/design-system/consistent-css-prop-usage',
|
|
8
31
|
displayName: 'consistent-css-prop-usage',
|
|
@@ -55,7 +78,10 @@ export var externalRules = [{
|
|
|
55
78
|
url: getRuleUrl('no-styled-tagged-template-expression'),
|
|
56
79
|
externalUrl: 'https://atlassian.design/components/eslint-plugin-design-system/no-styled-tagged-template-expression/usage',
|
|
57
80
|
recommended: true,
|
|
58
|
-
severity: 'warn'
|
|
81
|
+
severity: 'warn',
|
|
82
|
+
pluginConfig: {
|
|
83
|
+
importSources: noStyledTaggedTemplateExpressionImportSources
|
|
84
|
+
}
|
|
59
85
|
}
|
|
60
86
|
}, {
|
|
61
87
|
name: '@compiled/no-suppress-xcss',
|
|
@@ -9,7 +9,9 @@ export declare const configs: {
|
|
|
9
9
|
})[];
|
|
10
10
|
'@atlaskit/design-system/no-css-tagged-template-expression': string;
|
|
11
11
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': string;
|
|
12
|
-
'@atlaskit/design-system/no-styled-tagged-template-expression': string
|
|
12
|
+
'@atlaskit/design-system/no-styled-tagged-template-expression': (string | {
|
|
13
|
+
importSources: string[];
|
|
14
|
+
})[];
|
|
13
15
|
'@compiled/no-suppress-xcss': string;
|
|
14
16
|
'@compiled/no-js-xcss': string;
|
|
15
17
|
'@atlaskit/design-system/no-empty-styled-expression': (string | {
|
|
@@ -35,7 +37,9 @@ export declare const configs: {
|
|
|
35
37
|
})[];
|
|
36
38
|
'@atlaskit/design-system/no-css-tagged-template-expression': string;
|
|
37
39
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': string;
|
|
38
|
-
'@atlaskit/design-system/no-styled-tagged-template-expression': string
|
|
40
|
+
'@atlaskit/design-system/no-styled-tagged-template-expression': (string | {
|
|
41
|
+
importSources: string[];
|
|
42
|
+
})[];
|
|
39
43
|
'@compiled/no-suppress-xcss': string;
|
|
40
44
|
'@compiled/no-js-xcss': string;
|
|
41
45
|
'@atlaskit/design-system/no-empty-styled-expression': (string | {
|
|
@@ -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::
|
|
3
|
+
* @codegen <<SignedSource::9869b1757ca915f74b471fe04f72e5ea>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -12,7 +12,9 @@ declare const _default: {
|
|
|
12
12
|
})[];
|
|
13
13
|
'@atlaskit/design-system/no-css-tagged-template-expression': string;
|
|
14
14
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': string;
|
|
15
|
-
'@atlaskit/design-system/no-styled-tagged-template-expression': string
|
|
15
|
+
'@atlaskit/design-system/no-styled-tagged-template-expression': (string | {
|
|
16
|
+
importSources: string[];
|
|
17
|
+
})[];
|
|
16
18
|
'@compiled/no-suppress-xcss': string;
|
|
17
19
|
'@compiled/no-js-xcss': string;
|
|
18
20
|
'@atlaskit/design-system/no-empty-styled-expression': (string | {
|
|
@@ -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::
|
|
3
|
+
* @codegen <<SignedSource::9869b1757ca915f74b471fe04f72e5ea>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -12,7 +12,9 @@ declare const _default: {
|
|
|
12
12
|
})[];
|
|
13
13
|
'@atlaskit/design-system/no-css-tagged-template-expression': string;
|
|
14
14
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': string;
|
|
15
|
-
'@atlaskit/design-system/no-styled-tagged-template-expression': string
|
|
15
|
+
'@atlaskit/design-system/no-styled-tagged-template-expression': (string | {
|
|
16
|
+
importSources: string[];
|
|
17
|
+
})[];
|
|
16
18
|
'@compiled/no-suppress-xcss': string;
|
|
17
19
|
'@compiled/no-js-xcss': string;
|
|
18
20
|
'@atlaskit/design-system/no-empty-styled-expression': (string | {
|
|
@@ -9,7 +9,9 @@ export declare const configs: {
|
|
|
9
9
|
})[];
|
|
10
10
|
'@atlaskit/design-system/no-css-tagged-template-expression': string;
|
|
11
11
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': string;
|
|
12
|
-
'@atlaskit/design-system/no-styled-tagged-template-expression': string
|
|
12
|
+
'@atlaskit/design-system/no-styled-tagged-template-expression': (string | {
|
|
13
|
+
importSources: string[];
|
|
14
|
+
})[];
|
|
13
15
|
'@compiled/no-suppress-xcss': string;
|
|
14
16
|
'@compiled/no-js-xcss': string;
|
|
15
17
|
'@atlaskit/design-system/no-empty-styled-expression': (string | {
|
|
@@ -35,7 +37,9 @@ export declare const configs: {
|
|
|
35
37
|
})[];
|
|
36
38
|
'@atlaskit/design-system/no-css-tagged-template-expression': string;
|
|
37
39
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': string;
|
|
38
|
-
'@atlaskit/design-system/no-styled-tagged-template-expression': string
|
|
40
|
+
'@atlaskit/design-system/no-styled-tagged-template-expression': (string | {
|
|
41
|
+
importSources: string[];
|
|
42
|
+
})[];
|
|
39
43
|
'@compiled/no-suppress-xcss': string;
|
|
40
44
|
'@compiled/no-js-xcss': string;
|
|
41
45
|
'@atlaskit/design-system/no-empty-styled-expression': (string | {
|
|
@@ -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::
|
|
3
|
+
* @codegen <<SignedSource::9869b1757ca915f74b471fe04f72e5ea>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -12,7 +12,9 @@ declare const _default: {
|
|
|
12
12
|
})[];
|
|
13
13
|
'@atlaskit/design-system/no-css-tagged-template-expression': string;
|
|
14
14
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': string;
|
|
15
|
-
'@atlaskit/design-system/no-styled-tagged-template-expression': string
|
|
15
|
+
'@atlaskit/design-system/no-styled-tagged-template-expression': (string | {
|
|
16
|
+
importSources: string[];
|
|
17
|
+
})[];
|
|
16
18
|
'@compiled/no-suppress-xcss': string;
|
|
17
19
|
'@compiled/no-js-xcss': string;
|
|
18
20
|
'@atlaskit/design-system/no-empty-styled-expression': (string | {
|
|
@@ -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::
|
|
3
|
+
* @codegen <<SignedSource::9869b1757ca915f74b471fe04f72e5ea>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -12,7 +12,9 @@ declare const _default: {
|
|
|
12
12
|
})[];
|
|
13
13
|
'@atlaskit/design-system/no-css-tagged-template-expression': string;
|
|
14
14
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': string;
|
|
15
|
-
'@atlaskit/design-system/no-styled-tagged-template-expression': string
|
|
15
|
+
'@atlaskit/design-system/no-styled-tagged-template-expression': (string | {
|
|
16
|
+
importSources: string[];
|
|
17
|
+
})[];
|
|
16
18
|
'@compiled/no-suppress-xcss': string;
|
|
17
19
|
'@compiled/no-js-xcss': string;
|
|
18
20
|
'@atlaskit/design-system/no-empty-styled-expression': (string | {
|
package/package.json
CHANGED
package/scripts/codegen.tsx
CHANGED
|
@@ -259,7 +259,7 @@ async function generateExternalRulePage(
|
|
|
259
259
|
|
|
260
260
|
${
|
|
261
261
|
rule.module.meta?.docs?.externalUrl
|
|
262
|
-
? `This rule is maintained by another package and configured here
|
|
262
|
+
? `This rule is maintained by another package and configured here; refer to ${rule.module.meta.docs.externalUrl} for more details.`
|
|
263
263
|
: ''
|
|
264
264
|
}
|
|
265
265
|
`;
|
|
@@ -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::
|
|
3
|
+
* @codegen <<SignedSource::9869b1757ca915f74b471fe04f72e5ea>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
@@ -17,7 +17,18 @@ export default {
|
|
|
17
17
|
],
|
|
18
18
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'warn',
|
|
19
19
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': 'warn',
|
|
20
|
-
'@atlaskit/design-system/no-styled-tagged-template-expression':
|
|
20
|
+
'@atlaskit/design-system/no-styled-tagged-template-expression': [
|
|
21
|
+
'warn',
|
|
22
|
+
{
|
|
23
|
+
importSources: [
|
|
24
|
+
'@compiled/react',
|
|
25
|
+
'@atlaskit/css',
|
|
26
|
+
'@emotion/core',
|
|
27
|
+
'@emotion/react',
|
|
28
|
+
'@emotion/styled',
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
21
32
|
'@compiled/no-suppress-xcss': 'warn',
|
|
22
33
|
'@compiled/no-js-xcss': 'warn',
|
|
23
34
|
'@atlaskit/design-system/no-empty-styled-expression': [
|
|
@@ -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::
|
|
3
|
+
* @codegen <<SignedSource::9869b1757ca915f74b471fe04f72e5ea>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
5
5
|
*/
|
|
6
6
|
export default {
|
|
@@ -17,7 +17,18 @@ export default {
|
|
|
17
17
|
],
|
|
18
18
|
'@atlaskit/design-system/no-css-tagged-template-expression': 'warn',
|
|
19
19
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': 'warn',
|
|
20
|
-
'@atlaskit/design-system/no-styled-tagged-template-expression':
|
|
20
|
+
'@atlaskit/design-system/no-styled-tagged-template-expression': [
|
|
21
|
+
'warn',
|
|
22
|
+
{
|
|
23
|
+
importSources: [
|
|
24
|
+
'@compiled/react',
|
|
25
|
+
'@atlaskit/css',
|
|
26
|
+
'@emotion/core',
|
|
27
|
+
'@emotion/react',
|
|
28
|
+
'@emotion/styled',
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
21
32
|
'@compiled/no-suppress-xcss': 'warn',
|
|
22
33
|
'@compiled/no-js-xcss': 'warn',
|
|
23
34
|
'@atlaskit/design-system/no-empty-styled-expression': [
|
|
@@ -17,6 +17,33 @@ const importSources: readonly string[] = [
|
|
|
17
17
|
'styled-components',
|
|
18
18
|
];
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Same as importSources, but excludes `styled-components` because the type-checking
|
|
22
|
+
* for `styled-components` does not support the `no-styled-tagged-template-expression`
|
|
23
|
+
* lint output for this:
|
|
24
|
+
*
|
|
25
|
+
* export const Container = styled(Section)`
|
|
26
|
+
* max-height: ${gridSize * 46}px;
|
|
27
|
+
* overflow: auto;
|
|
28
|
+
* `;
|
|
29
|
+
*
|
|
30
|
+
* export const ErrorStateContainer = styled(Container)`
|
|
31
|
+
* margin: ${
|
|
32
|
+
* (props: any) =>
|
|
33
|
+
* props.canManageAutomations // Use negative margin to reduce whitespace when the Footer component is shown
|
|
34
|
+
* ? `${gridSize * -4}px ${gridSize * 2}px`
|
|
35
|
+
* : `0 ${gridSize * 2}px`
|
|
36
|
+
* };
|
|
37
|
+
* `;
|
|
38
|
+
*/
|
|
39
|
+
const noStyledTaggedTemplateExpressionImportSources: readonly string[] = [
|
|
40
|
+
'@compiled/react',
|
|
41
|
+
'@atlaskit/css', // doesn't do anything because @atlaskit/css doesn't expose a styled API
|
|
42
|
+
'@emotion/core',
|
|
43
|
+
'@emotion/react',
|
|
44
|
+
'@emotion/styled',
|
|
45
|
+
];
|
|
46
|
+
|
|
20
47
|
export const externalRules: ExternalRuleMeta[] = [
|
|
21
48
|
{
|
|
22
49
|
name: '@atlaskit/design-system/consistent-css-prop-usage',
|
|
@@ -81,6 +108,9 @@ export const externalRules: ExternalRuleMeta[] = [
|
|
|
81
108
|
'https://atlassian.design/components/eslint-plugin-design-system/no-styled-tagged-template-expression/usage',
|
|
82
109
|
recommended: true,
|
|
83
110
|
severity: 'warn',
|
|
111
|
+
pluginConfig: {
|
|
112
|
+
importSources: noStyledTaggedTemplateExpressionImportSources,
|
|
113
|
+
},
|
|
84
114
|
},
|
|
85
115
|
},
|
|
86
116
|
{
|