@atlaskit/eslint-plugin-ui-styling-standard 0.3.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 +12 -0
- package/README.md +18 -5
- package/build/tsconfig.json +2 -4
- package/constellation/consistent-css-prop-usage/usage.mdx +5 -0
- package/constellation/index/overview.mdx +29 -11
- package/constellation/local-cx-xcss/usage.mdx +37 -0
- package/constellation/no-css-tagged-template-expression/usage.mdx +5 -0
- package/constellation/no-empty-styled-expression/usage.mdx +5 -0
- package/constellation/no-exported-css/usage.mdx +5 -0
- package/constellation/no-exported-keyframes/usage.mdx +5 -0
- package/constellation/no-invalid-css-map/usage.mdx +5 -0
- package/constellation/no-js-xcss/usage.mdx +5 -0
- package/constellation/no-keyframes-tagged-template-expression/usage.mdx +5 -0
- package/constellation/no-styled-tagged-template-expression/usage.mdx +5 -0
- package/constellation/no-suppress-xcss/usage.mdx +25 -0
- package/dist/cjs/index.codegen.js +26 -0
- package/dist/cjs/index.js +12 -33
- package/dist/cjs/presets/all.codegen.js +39 -0
- package/dist/cjs/presets/recommended.codegen.js +39 -0
- package/dist/cjs/rules/external-rules.js +169 -0
- package/dist/cjs/rules/index.codegen.js +16 -0
- package/dist/cjs/rules/local-cx-xcss/index.js +51 -0
- package/dist/cjs/rules/utils/create-rule.js +43 -0
- package/dist/cjs/rules/utils/is-supported-import.js +98 -0
- package/dist/es2019/index.codegen.js +12 -0
- package/dist/es2019/index.js +1 -33
- package/dist/es2019/presets/all.codegen.js +33 -0
- package/dist/es2019/presets/recommended.codegen.js +33 -0
- package/dist/es2019/rules/external-rules.js +164 -0
- package/dist/es2019/rules/index.codegen.js +9 -0
- package/dist/es2019/rules/local-cx-xcss/index.js +45 -0
- package/dist/es2019/rules/utils/create-rule.js +33 -0
- package/dist/es2019/rules/utils/is-supported-import.js +87 -0
- package/dist/esm/index.codegen.js +12 -0
- package/dist/esm/index.js +1 -33
- package/dist/esm/presets/all.codegen.js +33 -0
- package/dist/esm/presets/recommended.codegen.js +33 -0
- package/dist/esm/rules/external-rules.js +164 -0
- package/dist/esm/rules/index.codegen.js +9 -0
- package/dist/esm/rules/local-cx-xcss/index.js +45 -0
- package/dist/esm/rules/utils/create-rule.js +35 -0
- package/dist/esm/rules/utils/is-supported-import.js +90 -0
- package/dist/types/index.codegen.d.ts +59 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/presets/all.codegen.d.ts +34 -0
- package/dist/types/presets/recommended.codegen.d.ts +34 -0
- package/dist/types/rules/external-rules.d.ts +11 -0
- package/dist/types/rules/index.codegen.d.ts +4 -0
- package/dist/types/rules/local-cx-xcss/index.d.ts +3 -0
- package/dist/types/rules/utils/create-rule.d.ts +64 -0
- package/dist/types/rules/utils/is-supported-import.d.ts +34 -0
- package/dist/types-ts4.5/index.codegen.d.ts +59 -0
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/presets/all.codegen.d.ts +34 -0
- package/dist/types-ts4.5/presets/recommended.codegen.d.ts +34 -0
- package/dist/types-ts4.5/rules/external-rules.d.ts +11 -0
- package/dist/types-ts4.5/rules/index.codegen.d.ts +4 -0
- package/dist/types-ts4.5/rules/local-cx-xcss/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/utils/create-rule.d.ts +64 -0
- package/dist/types-ts4.5/rules/utils/is-supported-import.d.ts +34 -0
- package/package.json +13 -4
- package/scripts/codegen.tsx +439 -0
- package/src/index.codegen.tsx +14 -0
- package/src/index.tsx +1 -51
- package/src/presets/all.codegen.tsx +78 -0
- package/src/presets/recommended.codegen.tsx +78 -0
- package/src/rules/TEMPLATE.md +29 -0
- package/src/rules/__tests__/utils/_tester.tsx +40 -0
- package/src/rules/external-rules.tsx +205 -0
- package/src/rules/index.codegen.tsx +10 -0
- package/src/rules/local-cx-xcss/README.md +35 -0
- package/src/rules/local-cx-xcss/__tests__/rule.test.tsx +102 -0
- package/src/rules/local-cx-xcss/index.tsx +69 -0
- package/src/rules/utils/create-rule.tsx +80 -0
- package/src/rules/utils/is-supported-import.tsx +130 -0
- package/tsconfig.app.json +5 -1
- package/tsconfig.dev.json +5 -1
- package/tsconfig.json +7 -6
- package/dist/types/src/index.d.ts +0 -29
- package/dist/types-ts4.5/src/index.d.ts +0 -29
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
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
|
+
|
|
9
|
+
## 0.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#75600](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75600) [`8875d9de2e5d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8875d9de2e5d) - Migrates the ESLint rule from `@atlaskit/design-system/local-cx-xcss` to `@atlaskit/ui-styling-standard/local-cx-xcss` and overhauls the codegen to enable better documentation and rule distribution.
|
|
14
|
+
|
|
3
15
|
## 0.3.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -8,8 +8,21 @@ Not intended for use outside the Atlassian frontend repository.
|
|
|
8
8
|
|
|
9
9
|
## Rules
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
|
15
|
-
|
|
|
11
|
+
<!-- START_RULE_TABLE_CODEGEN -->
|
|
12
|
+
<!-- @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen -->
|
|
13
|
+
|
|
14
|
+
| Rule | Description | Recommended | Fixable | Suggestions |
|
|
15
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- | ------- | ----------- |
|
|
16
|
+
| <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 | | |
|
|
17
|
+
| <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 | |
|
|
18
|
+
| <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 | |
|
|
19
|
+
| <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 | |
|
|
20
|
+
| <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 | |
|
|
21
|
+
| <a href="https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-suppress-xcss/usage">@compiled/no-suppress-xcss</a> | Disallows supressing type violations when using the xcss prop. | Yes | | |
|
|
22
|
+
| <a href="https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-js-xcss/usage">@compiled/no-js-xcss</a> | Disallows using xcss prop inside JavaScript files. | Yes | | |
|
|
23
|
+
| <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 | | |
|
|
24
|
+
| <a href="https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-exported-css/usage">@atlaskit/design-system/no-exported-css</a> | Forbid exporting `css` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable. | Yes | | |
|
|
25
|
+
| <a href="https://atlassian.design/components/eslint-plugin-ui-styling-standard/no-exported-keyframes/usage">@atlaskit/design-system/no-exported-keyframes</a> | Forbid exporting `keyframes` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable. | Yes | | |
|
|
26
|
+
| <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 | | |
|
|
27
|
+
|
|
28
|
+
<!-- END_RULE_TABLE_CODEGEN -->
|
package/build/tsconfig.json
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @atlaskit/design-system/consistent-css-prop-usage
|
|
2
|
+
|
|
3
|
+
Ensures consistency with all `css` and `xcss` prop usages.
|
|
4
|
+
|
|
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,10 +1,34 @@
|
|
|
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
|
+
|
|
7
|
+
## Rules
|
|
8
|
+
|
|
9
|
+
<!-- START_RULE_TABLE_CODEGEN -->
|
|
10
|
+
<!-- @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen -->
|
|
11
|
+
|
|
12
|
+
| Rule | Description | Recommended | Fixable | Suggestions |
|
|
13
|
+
| --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- | ------- | ----------- |
|
|
14
|
+
| <a href="local-cx-xcss/usage">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 | | |
|
|
15
|
+
| <a href="consistent-css-prop-usage/usage">@atlaskit/design-system/consistent-css-prop-usage</a> | Ensures consistency with `css` and `xcss` prop usages | Yes | Yes | |
|
|
16
|
+
| <a href="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 | |
|
|
17
|
+
| <a href="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 | |
|
|
18
|
+
| <a href="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 | |
|
|
19
|
+
| <a href="no-suppress-xcss/usage">@compiled/no-suppress-xcss</a> | Disallows supressing type violations when using the xcss prop. | Yes | | |
|
|
20
|
+
| <a href="no-js-xcss/usage">@compiled/no-js-xcss</a> | Disallows using xcss prop inside JavaScript files. | Yes | | |
|
|
21
|
+
| <a href="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 | | |
|
|
22
|
+
| <a href="no-exported-css/usage">@atlaskit/design-system/no-exported-css</a> | Forbid exporting `css` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable. | Yes | | |
|
|
23
|
+
| <a href="no-exported-keyframes/usage">@atlaskit/design-system/no-exported-keyframes</a> | Forbid exporting `keyframes` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable. | Yes | | |
|
|
24
|
+
| <a href="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 | | |
|
|
25
|
+
|
|
26
|
+
<!-- END_RULE_TABLE_CODEGEN -->
|
|
27
|
+
|
|
6
28
|
## Purpose of the UI Styling Standard
|
|
7
29
|
|
|
30
|
+
For Atlassians, refer to the [internal UI Styling Standard policy](https://go.atlassian.com/ui-styling-standard-policy).
|
|
31
|
+
|
|
8
32
|
To enforce scoped encapsulation, type safety, and deterministic behavior in styling code that is
|
|
9
33
|
present in other programming languages. This is a stepping stone to large performance improvements,
|
|
10
34
|
reduced visual regressions, and enables testing and maintainability at scale.
|
|
@@ -20,7 +44,7 @@ code migrations, and future advancements like generative AI.
|
|
|
20
44
|
- To reduce the amount of overall custom styling code written while supporting customization without without the need for hacks and technical debt.
|
|
21
45
|
- We aim to see a reduction of the “average styles per component”, reducing the effort to build and maintain UIs.
|
|
22
46
|
|
|
23
|
-
## Basic
|
|
47
|
+
## Basic principles
|
|
24
48
|
|
|
25
49
|
We want the styling ecosystem (CSS, CSS-in-JS, and parts of JSX) at Atlassian and the wider ecosystem
|
|
26
50
|
we support to be as mature as the other code we write, such as TypeScript/JavaScript, Java, Go, etc.
|
|
@@ -37,15 +61,9 @@ we support to be as mature as the other code we write, such as TypeScript/JavaSc
|
|
|
37
61
|
As the W3C CSS spec and wider industry grows, having our styling code meet these principles will mean we
|
|
38
62
|
can programatically evolve that a better future state.
|
|
39
63
|
|
|
40
|
-
## How we'll achieve this
|
|
41
|
-
|
|
42
|
-
Within Atlassian, most frontend code will have this enforced over time through ESLint rules and engineering standardization.
|
|
43
|
-
|
|
44
|
-
Refer to the eslint rules for more details: _documentation coming soon_
|
|
45
|
-
|
|
46
64
|
## Examples
|
|
47
65
|
|
|
48
|
-
|
|
66
|
+
Refer to the [eslint rules](#rules) for more in-depth examples.
|
|
49
67
|
|
|
50
68
|
### Incorrect code
|
|
51
69
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# local-cx-xcss
|
|
2
|
+
|
|
3
|
+
This rule ensures the `cx()` function is only used within the `xcss` prop. This aids tracking what styles are applied to a jsx element.
|
|
4
|
+
|
|
5
|
+
The `cx` function is checked only if it is imported from `@compiled/react` or `@atlaskit/css`.
|
|
6
|
+
|
|
7
|
+
Passing arguments to the `cx()` function is how you compose styles (combine more than one set of styles together) with XCSS. This is a workaround for the more conventional array syntax (e.g. [in Emotion](https://emotion.sh/docs/composition)) `<div xcss={[style1, style2]} />` not giving robust enough type checking.
|
|
8
|
+
|
|
9
|
+
## Examples
|
|
10
|
+
|
|
11
|
+
### Incorrect
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import { cx, cssMap } from '@compiled/react';
|
|
15
|
+
|
|
16
|
+
const styles = cssMap({
|
|
17
|
+
text: { color: 'red' },
|
|
18
|
+
bg: { background: 'blue' },
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const joinedStyles = cx(styles.text, styles.bg);
|
|
22
|
+
|
|
23
|
+
<Button xcss={joinedStyles} />;
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Correct
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
import { cx, cssMap } from '@compiled/react';
|
|
30
|
+
|
|
31
|
+
const styles = cssMap({
|
|
32
|
+
text: { color: 'red' },
|
|
33
|
+
bg: { background: 'blue' },
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
<Button xcss={cx(styles.text, styles.bg)} />;
|
|
37
|
+
```
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @atlaskit/design-system/no-css-tagged-template-expression
|
|
2
|
+
|
|
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
|
+
|
|
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.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @atlaskit/design-system/no-empty-styled-expression
|
|
2
|
+
|
|
3
|
+
Forbids any styled expression to be used when passing empty arguments to styled.div() (or other JSX elements).
|
|
4
|
+
|
|
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.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @atlaskit/design-system/no-exported-css
|
|
2
|
+
|
|
3
|
+
Forbid exporting `css` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable.
|
|
4
|
+
|
|
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.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @atlaskit/design-system/no-exported-keyframes
|
|
2
|
+
|
|
3
|
+
Forbid exporting `keyframes` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable.
|
|
4
|
+
|
|
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.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @atlaskit/design-system/no-invalid-css-map
|
|
2
|
+
|
|
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
|
+
|
|
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.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @atlaskit/design-system/no-keyframes-tagged-template-expression
|
|
2
|
+
|
|
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
|
+
|
|
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.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# @atlaskit/design-system/no-styled-tagged-template-expression
|
|
2
|
+
|
|
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
|
+
|
|
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.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @compiled/no-suppress-xcss
|
|
2
|
+
|
|
3
|
+
Disallows supressing type violations when using the xcss prop. Supressing type violations will cause incidents and unexpected behaviour when code changes in the future.
|
|
4
|
+
|
|
5
|
+
Components that use xcss prop have explicitly declared what styles they should and should not accept, consumers must adhere to this API.
|
|
6
|
+
|
|
7
|
+
## Incorrect
|
|
8
|
+
|
|
9
|
+
Do not suppress type violations; if the value doesn't match the type, fix the value or expect breaking changes in the future.
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
// @ts-expect-error
|
|
13
|
+
<Button xcss={{ fill: '#fff' }} />
|
|
14
|
+
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
<Button xcss={{ fill: 'var(--ds-text)' }} />
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Correct
|
|
20
|
+
|
|
21
|
+
You should never have a type error.
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
<Button xcss={{ color: 'var(--ds-text)' }} />
|
|
25
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.configs = void 0;
|
|
8
|
+
Object.defineProperty(exports, "rules", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _index.default;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
var _all = _interopRequireDefault(require("./presets/all.codegen"));
|
|
15
|
+
var _recommended = _interopRequireDefault(require("./presets/recommended.codegen"));
|
|
16
|
+
var _index = _interopRequireDefault(require("./rules/index.codegen"));
|
|
17
|
+
/**
|
|
18
|
+
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
19
|
+
* @codegen <<SignedSource::3fd41935576c9346ca1f1e0c787a0a48>>
|
|
20
|
+
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
var configs = exports.configs = {
|
|
24
|
+
all: _all.default,
|
|
25
|
+
recommended: _recommended.default
|
|
26
|
+
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,37 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
recommended: {
|
|
11
|
-
plugins: ['@atlaskit/ui-styling-standard', '@atlaskit/design-system', '@compiled'],
|
|
12
|
-
rules: {
|
|
13
|
-
'@atlaskit/design-system/consistent-css-prop-usage': ['warn', {
|
|
14
|
-
// When passing a css prop to a React component, we don't know whether the component
|
|
15
|
-
// is Emotion or Compiled. Hence it is not safe to run autofixes like wrapping it in
|
|
16
|
-
// a `css` function call.
|
|
17
|
-
excludeReactComponents: true
|
|
18
|
-
}],
|
|
19
|
-
'@atlaskit/design-system/local-cx-xcss': 'warn',
|
|
20
|
-
'@atlaskit/design-system/no-css-tagged-template-expression': 'warn',
|
|
21
|
-
'@atlaskit/design-system/no-keyframes-tagged-template-expression': 'warn',
|
|
22
|
-
'@atlaskit/design-system/no-styled-tagged-template-expression': 'warn',
|
|
23
|
-
'@compiled/no-suppress-xcss': 'error',
|
|
24
|
-
'@compiled/no-js-xcss': 'error',
|
|
25
|
-
'@atlaskit/design-system/no-empty-styled-expression': ['warn', {
|
|
26
|
-
importSources: importSources
|
|
27
|
-
}],
|
|
28
|
-
'@atlaskit/design-system/no-exported-css': ['warn', {
|
|
29
|
-
importSources: importSources
|
|
30
|
-
}],
|
|
31
|
-
'@atlaskit/design-system/no-exported-keyframes': ['warn', {
|
|
32
|
-
importSources: importSources
|
|
33
|
-
}],
|
|
34
|
-
'@atlaskit/design-system/no-invalid-css-map': ['warn', {
|
|
35
|
-
allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
|
|
36
|
-
}]
|
|
37
|
-
}
|
|
6
|
+
Object.defineProperty(exports, "configs", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _index.configs;
|
|
38
10
|
}
|
|
39
|
-
};
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "rules", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _index.rules;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _index = require("./index.codegen");
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
9
|
+
* @codegen <<SignedSource::9869b1757ca915f74b471fe04f72e5ea>>
|
|
10
|
+
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
11
|
+
*/
|
|
12
|
+
var _default = exports.default = {
|
|
13
|
+
plugins: ['@atlaskit/ui-styling-standard', '@atlaskit/design-system', '@compiled'],
|
|
14
|
+
rules: {
|
|
15
|
+
'@atlaskit/ui-styling-standard/local-cx-xcss': 'warn',
|
|
16
|
+
'@atlaskit/design-system/consistent-css-prop-usage': ['warn', {
|
|
17
|
+
excludeReactComponents: true
|
|
18
|
+
}],
|
|
19
|
+
'@atlaskit/design-system/no-css-tagged-template-expression': 'warn',
|
|
20
|
+
'@atlaskit/design-system/no-keyframes-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
|
+
}],
|
|
24
|
+
'@compiled/no-suppress-xcss': 'warn',
|
|
25
|
+
'@compiled/no-js-xcss': 'warn',
|
|
26
|
+
'@atlaskit/design-system/no-empty-styled-expression': ['warn', {
|
|
27
|
+
importSources: ['@compiled/react', '@atlaskit/css', '@emotion/core', '@emotion/react', '@emotion/styled', 'styled-components']
|
|
28
|
+
}],
|
|
29
|
+
'@atlaskit/design-system/no-exported-css': ['warn', {
|
|
30
|
+
importSources: ['@compiled/react', '@atlaskit/css', '@emotion/core', '@emotion/react', '@emotion/styled', 'styled-components']
|
|
31
|
+
}],
|
|
32
|
+
'@atlaskit/design-system/no-exported-keyframes': ['warn', {
|
|
33
|
+
importSources: ['@compiled/react', '@atlaskit/css', '@emotion/core', '@emotion/react', '@emotion/styled', 'styled-components']
|
|
34
|
+
}],
|
|
35
|
+
'@atlaskit/design-system/no-invalid-css-map': ['warn', {
|
|
36
|
+
allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
|
|
37
|
+
}]
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
9
|
+
* @codegen <<SignedSource::9869b1757ca915f74b471fe04f72e5ea>>
|
|
10
|
+
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
11
|
+
*/
|
|
12
|
+
var _default = exports.default = {
|
|
13
|
+
plugins: ['@atlaskit/ui-styling-standard', '@atlaskit/design-system', '@compiled'],
|
|
14
|
+
rules: {
|
|
15
|
+
'@atlaskit/ui-styling-standard/local-cx-xcss': 'warn',
|
|
16
|
+
'@atlaskit/design-system/consistent-css-prop-usage': ['warn', {
|
|
17
|
+
excludeReactComponents: true
|
|
18
|
+
}],
|
|
19
|
+
'@atlaskit/design-system/no-css-tagged-template-expression': 'warn',
|
|
20
|
+
'@atlaskit/design-system/no-keyframes-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
|
+
}],
|
|
24
|
+
'@compiled/no-suppress-xcss': 'warn',
|
|
25
|
+
'@compiled/no-js-xcss': 'warn',
|
|
26
|
+
'@atlaskit/design-system/no-empty-styled-expression': ['warn', {
|
|
27
|
+
importSources: ['@compiled/react', '@atlaskit/css', '@emotion/core', '@emotion/react', '@emotion/styled', 'styled-components']
|
|
28
|
+
}],
|
|
29
|
+
'@atlaskit/design-system/no-exported-css': ['warn', {
|
|
30
|
+
importSources: ['@compiled/react', '@atlaskit/css', '@emotion/core', '@emotion/react', '@emotion/styled', 'styled-components']
|
|
31
|
+
}],
|
|
32
|
+
'@atlaskit/design-system/no-exported-keyframes': ['warn', {
|
|
33
|
+
importSources: ['@compiled/react', '@atlaskit/css', '@emotion/core', '@emotion/react', '@emotion/styled', 'styled-components']
|
|
34
|
+
}],
|
|
35
|
+
'@atlaskit/design-system/no-invalid-css-map': ['warn', {
|
|
36
|
+
allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
|
|
37
|
+
}]
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.externalRules = void 0;
|
|
7
|
+
var _createRule = require("./utils/create-rule");
|
|
8
|
+
/** External rules must be scoped, have a display name, and external urls. */
|
|
9
|
+
|
|
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'];
|
|
34
|
+
var externalRules = exports.externalRules = [{
|
|
35
|
+
name: '@atlaskit/design-system/consistent-css-prop-usage',
|
|
36
|
+
displayName: 'consistent-css-prop-usage',
|
|
37
|
+
isExternal: true,
|
|
38
|
+
fixable: 'code',
|
|
39
|
+
docs: {
|
|
40
|
+
description: 'Ensures consistency with `css` and `xcss` prop usages',
|
|
41
|
+
url: (0, _createRule.getRuleUrl)('consistent-css-prop-usage'),
|
|
42
|
+
externalUrl: 'https://atlassian.design/components/eslint-plugin-design-system/consistent-css-prop-usage/usage',
|
|
43
|
+
recommended: true,
|
|
44
|
+
severity: 'warn',
|
|
45
|
+
pluginConfig: {
|
|
46
|
+
// When passing a css prop to a React component, we don't know whether the component
|
|
47
|
+
// is Emotion or Compiled. Hence it is not safe to run autofixes like wrapping it in
|
|
48
|
+
// a `css` function call.
|
|
49
|
+
excludeReactComponents: true
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
name: '@atlaskit/design-system/no-css-tagged-template-expression',
|
|
54
|
+
displayName: 'no-css-tagged-template-expression',
|
|
55
|
+
isExternal: true,
|
|
56
|
+
fixable: 'code',
|
|
57
|
+
docs: {
|
|
58
|
+
description: 'Disallows any `css` tagged template expressions that originate from Emotion, Styled Components or Compiled',
|
|
59
|
+
url: (0, _createRule.getRuleUrl)('no-css-tagged-template-expression'),
|
|
60
|
+
externalUrl: 'https://atlassian.design/components/eslint-plugin-design-system/no-css-tagged-template-expression/usage',
|
|
61
|
+
recommended: true,
|
|
62
|
+
severity: 'warn'
|
|
63
|
+
}
|
|
64
|
+
}, {
|
|
65
|
+
name: '@atlaskit/design-system/no-keyframes-tagged-template-expression',
|
|
66
|
+
displayName: 'no-keyframes-tagged-template-expression',
|
|
67
|
+
isExternal: true,
|
|
68
|
+
fixable: 'code',
|
|
69
|
+
docs: {
|
|
70
|
+
description: 'Disallows any `keyframe` tagged template expressions that originate from Emotion, Styled Components or Compiled',
|
|
71
|
+
url: (0, _createRule.getRuleUrl)('no-keyframes-tagged-template-expression'),
|
|
72
|
+
externalUrl: 'https://atlassian.design/components/eslint-plugin-design-system/no-keyframes-tagged-template-expression/usage',
|
|
73
|
+
recommended: true,
|
|
74
|
+
severity: 'warn'
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
name: '@atlaskit/design-system/no-styled-tagged-template-expression',
|
|
78
|
+
displayName: 'no-styled-tagged-template-expression',
|
|
79
|
+
isExternal: true,
|
|
80
|
+
fixable: 'code',
|
|
81
|
+
docs: {
|
|
82
|
+
description: 'Disallows any `styled` tagged template expressions that originate from Emotion, Styled Components or Compiled',
|
|
83
|
+
url: (0, _createRule.getRuleUrl)('no-styled-tagged-template-expression'),
|
|
84
|
+
externalUrl: 'https://atlassian.design/components/eslint-plugin-design-system/no-styled-tagged-template-expression/usage',
|
|
85
|
+
recommended: true,
|
|
86
|
+
severity: 'warn',
|
|
87
|
+
pluginConfig: {
|
|
88
|
+
importSources: noStyledTaggedTemplateExpressionImportSources
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
name: '@compiled/no-suppress-xcss',
|
|
93
|
+
displayName: 'no-suppress-xcss',
|
|
94
|
+
isExternal: true,
|
|
95
|
+
docs: {
|
|
96
|
+
description: 'Disallows supressing type violations when using the xcss prop.',
|
|
97
|
+
url: (0, _createRule.getRuleUrl)('no-suppress-xcss'),
|
|
98
|
+
externalUrl: 'https://github.com/atlassian-labs/compiled/tree/master/packages/eslint-plugin/src/rules/no-suppress-xcss',
|
|
99
|
+
recommended: true,
|
|
100
|
+
severity: 'warn'
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
name: '@compiled/no-js-xcss',
|
|
104
|
+
displayName: 'no-js-xcss',
|
|
105
|
+
isExternal: true,
|
|
106
|
+
docs: {
|
|
107
|
+
description: 'Disallows using xcss prop inside JavaScript files.',
|
|
108
|
+
url: (0, _createRule.getRuleUrl)('no-js-xcss'),
|
|
109
|
+
externalUrl: 'https://github.com/atlassian-labs/compiled/tree/master/packages/eslint-plugin/src/rules/no-js-xcss',
|
|
110
|
+
recommended: true,
|
|
111
|
+
severity: 'warn'
|
|
112
|
+
}
|
|
113
|
+
}, {
|
|
114
|
+
name: '@atlaskit/design-system/no-empty-styled-expression',
|
|
115
|
+
displayName: 'no-empty-styled-expression',
|
|
116
|
+
isExternal: true,
|
|
117
|
+
docs: {
|
|
118
|
+
description: 'Forbids any styled expression to be used when passing empty arguments to styled.div() (or other JSX elements).',
|
|
119
|
+
url: (0, _createRule.getRuleUrl)('no-empty-styled-expression'),
|
|
120
|
+
externalUrl: 'https://atlassian.design/components/eslint-plugin-design-system/no-empty-styled-expression/usage',
|
|
121
|
+
recommended: true,
|
|
122
|
+
severity: 'warn',
|
|
123
|
+
pluginConfig: {
|
|
124
|
+
importSources: importSources
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}, {
|
|
128
|
+
name: '@atlaskit/design-system/no-exported-css',
|
|
129
|
+
displayName: 'no-exported-css',
|
|
130
|
+
isExternal: true,
|
|
131
|
+
docs: {
|
|
132
|
+
description: 'Forbid exporting `css` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable.',
|
|
133
|
+
url: (0, _createRule.getRuleUrl)('no-exported-css'),
|
|
134
|
+
externalUrl: 'https://atlassian.design/components/eslint-plugin-design-system/no-exported-css/usage',
|
|
135
|
+
recommended: true,
|
|
136
|
+
severity: 'warn',
|
|
137
|
+
pluginConfig: {
|
|
138
|
+
importSources: importSources
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}, {
|
|
142
|
+
name: '@atlaskit/design-system/no-exported-keyframes',
|
|
143
|
+
displayName: 'no-exported-keyframes',
|
|
144
|
+
isExternal: true,
|
|
145
|
+
docs: {
|
|
146
|
+
description: 'Forbid exporting `keyframes` function calls. Exporting `css` function calls can result in unexpected behaviour at runtime, and is not statically analysable.',
|
|
147
|
+
url: (0, _createRule.getRuleUrl)('no-exported-keyframes'),
|
|
148
|
+
externalUrl: 'https://atlassian.design/components/eslint-plugin-design-system/no-exported-keyframes/usage',
|
|
149
|
+
recommended: true,
|
|
150
|
+
severity: 'warn',
|
|
151
|
+
pluginConfig: {
|
|
152
|
+
importSources: importSources
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}, {
|
|
156
|
+
name: '@atlaskit/design-system/no-invalid-css-map',
|
|
157
|
+
displayName: 'no-invalid-css-map',
|
|
158
|
+
isExternal: true,
|
|
159
|
+
docs: {
|
|
160
|
+
description: "Checks the validity of a CSS map created through cssMap. This is intended to be used alongside TypeScript's type-checking.",
|
|
161
|
+
url: (0, _createRule.getRuleUrl)('no-invalid-css-map'),
|
|
162
|
+
externalUrl: 'https://atlassian.design/components/eslint-plugin-design-system/no-invalid-css-map/usage',
|
|
163
|
+
recommended: true,
|
|
164
|
+
severity: 'warn',
|
|
165
|
+
pluginConfig: {
|
|
166
|
+
allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _localCxXcss = _interopRequireDefault(require("./local-cx-xcss"));
|
|
9
|
+
/**
|
|
10
|
+
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
11
|
+
* @codegen <<SignedSource::f907e3f7ab0b7145dcb8318732ae1fec>>
|
|
12
|
+
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
13
|
+
*/
|
|
14
|
+
var _default = exports.default = {
|
|
15
|
+
'local-cx-xcss': _localCxXcss.default
|
|
16
|
+
};
|