@atlaskit/eslint-plugin-design-system 8.27.0 → 8.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +31 -29
- package/constellation/consistent-css-prop-usage/usage.mdx +193 -0
- package/constellation/ensure-design-token-usage/usage.mdx +72 -0
- package/constellation/ensure-design-token-usage-preview/usage.mdx +5 -0
- package/constellation/icon-label/usage.mdx +39 -0
- package/constellation/index/usage.mdx +31 -1508
- package/constellation/local-cx-xcss/usage.mdx +37 -0
- package/constellation/no-banned-imports/usage.mdx +17 -0
- package/constellation/no-css-tagged-template-expression/usage.mdx +66 -0
- package/constellation/no-deprecated-apis/usage.mdx +76 -0
- package/constellation/no-deprecated-design-token-usage/usage.mdx +27 -0
- package/constellation/no-deprecated-imports/usage.mdx +62 -0
- package/constellation/no-empty-styled-expression/usage.mdx +77 -0
- package/constellation/no-exported-css/usage.mdx +50 -0
- package/constellation/no-exported-keyframes/usage.mdx +50 -0
- package/constellation/no-invalid-css-map/usage.mdx +199 -0
- package/constellation/no-keyframes-tagged-template-expression/usage.mdx +76 -0
- package/constellation/no-margin/usage.mdx +20 -0
- package/constellation/no-nested-styles/usage.mdx +47 -0
- package/constellation/no-physical-properties/usage.mdx +53 -0
- package/constellation/no-styled-tagged-template-expression/usage.mdx +90 -0
- package/constellation/no-unsafe-design-token-usage/usage.mdx +49 -0
- package/constellation/no-unsafe-style-overrides/usage.mdx +49 -0
- package/constellation/no-unsupported-drag-and-drop-libraries/usage.mdx +17 -0
- package/constellation/prefer-primitives/usage.mdx +31 -0
- package/constellation/use-button-group-label/usage.mdx +58 -0
- package/constellation/use-drawer-label/usage.mdx +53 -0
- package/constellation/use-heading-level-in-spotlight-card/usage.mdx +20 -0
- package/constellation/use-href-in-link-item/usage.mdx +18 -0
- package/constellation/use-primitives/usage.mdx +77 -0
- package/constellation/use-visually-hidden/usage.mdx +34 -0
- package/dist/cjs/presets/all.codegen.js +3 -1
- package/dist/cjs/rules/index.codegen.js +5 -1
- package/dist/cjs/rules/no-css-tagged-template-expression/index.js +3 -2
- package/dist/cjs/rules/no-keyframes-tagged-template-expression/index.js +27 -0
- package/dist/cjs/rules/no-styled-tagged-template-expression/index.js +27 -0
- package/dist/cjs/rules/no-styled-tagged-template-expression/is-styled.js +53 -0
- package/dist/cjs/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/index.js +26 -6
- package/dist/cjs/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/to-arguments.js +28 -2
- package/dist/cjs/rules/utils/create-rule.js +7 -5
- package/dist/cjs/rules/utils/is-supported-import.js +7 -10
- package/dist/es2019/presets/all.codegen.js +3 -1
- package/dist/es2019/rules/index.codegen.js +5 -1
- package/dist/es2019/rules/no-css-tagged-template-expression/index.js +3 -2
- package/dist/es2019/rules/no-keyframes-tagged-template-expression/index.js +21 -0
- package/dist/es2019/rules/no-styled-tagged-template-expression/index.js +21 -0
- package/dist/es2019/rules/no-styled-tagged-template-expression/is-styled.js +45 -0
- package/dist/es2019/rules/utils/create-no-tagged-template-expression-rule/index.js +84 -0
- package/dist/es2019/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/to-arguments.js +28 -2
- package/dist/es2019/rules/utils/create-rule.js +7 -5
- package/dist/es2019/rules/utils/is-supported-import.js +7 -8
- package/dist/esm/presets/all.codegen.js +3 -1
- package/dist/esm/rules/index.codegen.js +5 -1
- package/dist/esm/rules/no-css-tagged-template-expression/index.js +3 -2
- package/dist/esm/rules/no-keyframes-tagged-template-expression/index.js +21 -0
- package/dist/esm/rules/no-styled-tagged-template-expression/index.js +21 -0
- package/dist/esm/rules/no-styled-tagged-template-expression/is-styled.js +47 -0
- package/dist/esm/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/index.js +25 -5
- package/dist/esm/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/to-arguments.js +28 -2
- package/dist/esm/rules/utils/create-rule.js +7 -5
- package/dist/esm/rules/utils/is-supported-import.js +7 -9
- package/dist/types/index.codegen.d.ts +2 -0
- package/dist/types/presets/all.codegen.d.ts +3 -1
- package/dist/types/rules/index.codegen.d.ts +2 -0
- package/dist/types/rules/no-keyframes-tagged-template-expression/index.d.ts +2 -0
- package/dist/types/rules/no-styled-tagged-template-expression/index.d.ts +2 -0
- package/dist/types/rules/no-styled-tagged-template-expression/is-styled.d.ts +7 -0
- package/dist/types/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/index.d.ts +3 -1
- package/dist/types/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/types.d.ts +3 -0
- package/dist/types/rules/utils/is-supported-import.d.ts +5 -5
- package/dist/types-ts4.5/index.codegen.d.ts +2 -0
- package/dist/types-ts4.5/presets/all.codegen.d.ts +3 -1
- package/dist/types-ts4.5/rules/index.codegen.d.ts +2 -0
- package/dist/types-ts4.5/rules/no-keyframes-tagged-template-expression/index.d.ts +2 -0
- package/dist/types-ts4.5/rules/no-styled-tagged-template-expression/index.d.ts +2 -0
- package/dist/types-ts4.5/rules/no-styled-tagged-template-expression/is-styled.d.ts +7 -0
- package/dist/types-ts4.5/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/index.d.ts +3 -1
- package/dist/types-ts4.5/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/types.d.ts +3 -0
- package/dist/types-ts4.5/rules/utils/is-supported-import.d.ts +5 -5
- package/package.json +1 -1
- package/dist/es2019/rules/no-css-tagged-template-expression/create-no-tagged-template-expression-rule/index.js +0 -62
- /package/dist/cjs/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/generate.js +0 -0
- /package/dist/cjs/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/get-tagged-template-expression-offset.js +0 -0
- /package/dist/cjs/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/types.js +0 -0
- /package/dist/es2019/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/generate.js +0 -0
- /package/dist/es2019/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/get-tagged-template-expression-offset.js +0 -0
- /package/dist/es2019/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/types.js +0 -0
- /package/dist/esm/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/generate.js +0 -0
- /package/dist/esm/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/get-tagged-template-expression-offset.js +0 -0
- /package/dist/esm/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/types.js +0 -0
- /package/dist/types/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/generate.d.ts +0 -0
- /package/dist/types/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/get-tagged-template-expression-offset.d.ts +0 -0
- /package/dist/types/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/to-arguments.d.ts +0 -0
- /package/dist/types-ts4.5/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/generate.d.ts +0 -0
- /package/dist/types-ts4.5/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/get-tagged-template-expression-offset.d.ts +0 -0
- /package/dist/types-ts4.5/rules/{no-css-tagged-template-expression → utils}/create-no-tagged-template-expression-rule/to-arguments.d.ts +0 -0
|
@@ -6,20 +6,20 @@ export declare const CSS_IN_JS_IMPORTS: {
|
|
|
6
6
|
readonly compiled: "@compiled/react";
|
|
7
7
|
readonly emotionReact: "@emotion/react";
|
|
8
8
|
readonly emotionCore: "@emotion/core";
|
|
9
|
+
readonly emotionStyled: "@emotion/styled";
|
|
9
10
|
readonly styledComponents: "styled-components";
|
|
10
11
|
readonly atlaskitCss: "@atlaskit/css";
|
|
11
12
|
readonly atlaskitPrimitives: "@atlaskit/primitives";
|
|
12
13
|
};
|
|
13
14
|
export type ImportSource = string;
|
|
14
15
|
export type SupportedNameChecker = (nodeToCheck: Callee, referencesInScope: Reference[], importSources: ImportSource[]) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* By default all known import sources are checked against.
|
|
18
|
+
*/
|
|
15
19
|
export declare const DEFAULT_IMPORT_SOURCES: ImportSource[];
|
|
16
20
|
/**
|
|
17
21
|
* Given the ESLint rule context, extract and parse the value of the importSources rule option.
|
|
18
|
-
* The importSources option is used to
|
|
19
|
-
* should apply to.
|
|
20
|
-
*
|
|
21
|
-
* Note that `@compiled/react` and `@atlaskit/css` are always included in importSources, regardless
|
|
22
|
-
* of what importSources is configured to by the user.
|
|
22
|
+
* The importSources option is used to override which libraries an ESLint rule applies to.
|
|
23
23
|
*
|
|
24
24
|
* @param context The rule context.
|
|
25
25
|
* @returns An array of strings representing what CSS-in-JS packages that should be checked, based
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/eslint-plugin-design-system",
|
|
3
3
|
"description": "The essential plugin for use with the Atlassian Design System.",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.28.0",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
// Original source from Compiled https://github.com/atlassian-labs/compiled/blob/master/packages/eslint-plugin/src/utils/create-no-tagged-template-expression-rule/index.ts
|
|
2
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
-
|
|
4
|
-
import { CSS_IN_JS_IMPORTS } from '../../utils/is-supported-import';
|
|
5
|
-
import { generate } from './generate';
|
|
6
|
-
import { getTaggedTemplateExpressionOffset } from './get-tagged-template-expression-offset';
|
|
7
|
-
import { toArguments } from './to-arguments';
|
|
8
|
-
const IMPORT_SOURCES = [CSS_IN_JS_IMPORTS.compiled, CSS_IN_JS_IMPORTS.emotionReact, CSS_IN_JS_IMPORTS.emotionCore, CSS_IN_JS_IMPORTS.styledComponents];
|
|
9
|
-
export const createNoTaggedTemplateExpressionRule = (isUsage, messageId) => context => ({
|
|
10
|
-
TaggedTemplateExpression(node) {
|
|
11
|
-
const {
|
|
12
|
-
references
|
|
13
|
-
} = context.getScope();
|
|
14
|
-
if (!isUsage(node.tag, references, IMPORT_SOURCES)) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
context.report({
|
|
18
|
-
messageId,
|
|
19
|
-
node,
|
|
20
|
-
*fix(fixer) {
|
|
21
|
-
const {
|
|
22
|
-
quasi
|
|
23
|
-
} = node;
|
|
24
|
-
const source = context.getSourceCode();
|
|
25
|
-
|
|
26
|
-
// TODO Eventually handle comments instead of skipping them
|
|
27
|
-
// Skip auto-fixing comments
|
|
28
|
-
if (quasi.quasis.map(q => q.value.raw).join('').match(/\/\*[\s\S]*\*\//g)) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Replace empty tagged template expression with the equivalent object call expression
|
|
33
|
-
if (!quasi.expressions.length && quasi.quasis.length === 1 && !quasi.quasis[0].value.raw.trim()) {
|
|
34
|
-
yield fixer.replaceText(quasi, '({})');
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const args = toArguments(source, quasi);
|
|
38
|
-
|
|
39
|
-
// Skip invalid CSS
|
|
40
|
-
if (args.length < 1) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const oldCode = source.getText(node);
|
|
44
|
-
// Remove quasi:
|
|
45
|
-
// styled.div<Props>`
|
|
46
|
-
// color: red;
|
|
47
|
-
// `
|
|
48
|
-
// becomes
|
|
49
|
-
// styled.div<Props>
|
|
50
|
-
const withoutQuasi = oldCode.replace(source.getText(quasi), '');
|
|
51
|
-
const newCode = withoutQuasi +
|
|
52
|
-
// Indent the arguments after the tagged template expression range
|
|
53
|
-
generate(args, getTaggedTemplateExpressionOffset(node));
|
|
54
|
-
if (oldCode === newCode) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
yield fixer.insertTextBefore(node, newCode);
|
|
58
|
-
yield fixer.remove(node);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|