@atlaskit/eslint-plugin-design-system 10.12.5 → 10.14.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 +30 -0
- package/README.md +3 -3
- package/dist/cjs/presets/all.codegen.js +4 -5
- package/dist/cjs/presets/recommended.codegen.js +4 -5
- package/dist/cjs/rules/no-empty-styled-expression/index.js +1 -2
- package/dist/cjs/rules/no-exported-css/index.js +1 -2
- package/dist/cjs/rules/no-exported-keyframes/index.js +1 -2
- package/dist/cjs/rules/no-invalid-css-map/index.js +4 -1
- package/dist/cjs/rules/no-legacy-icons/helpers.js +3 -3
- package/dist/cjs/rules/use-heading/config/index.js +2 -1
- package/dist/cjs/rules/use-heading/transformers/native-elements.js +61 -31
- package/dist/cjs/rules/use-primitives-text/config/index.js +2 -1
- package/dist/cjs/rules/use-primitives-text/transformers/emphasis-elements.js +48 -26
- package/dist/cjs/rules/use-primitives-text/transformers/paragraph-elements.js +62 -51
- package/dist/cjs/rules/use-primitives-text/transformers/span-elements.js +56 -32
- package/dist/cjs/rules/use-primitives-text/transformers/strong-elements.js +48 -26
- package/dist/es2019/presets/all.codegen.js +4 -5
- package/dist/es2019/presets/recommended.codegen.js +4 -5
- package/dist/es2019/rules/no-empty-styled-expression/index.js +1 -2
- package/dist/es2019/rules/no-exported-css/index.js +1 -2
- package/dist/es2019/rules/no-exported-keyframes/index.js +1 -2
- package/dist/es2019/rules/no-invalid-css-map/index.js +4 -1
- package/dist/es2019/rules/no-legacy-icons/helpers.js +3 -3
- package/dist/es2019/rules/use-heading/config/index.js +2 -1
- package/dist/es2019/rules/use-heading/transformers/native-elements.js +60 -29
- package/dist/es2019/rules/use-primitives-text/config/index.js +2 -1
- package/dist/es2019/rules/use-primitives-text/transformers/emphasis-elements.js +47 -24
- package/dist/es2019/rules/use-primitives-text/transformers/paragraph-elements.js +63 -52
- package/dist/es2019/rules/use-primitives-text/transformers/span-elements.js +55 -30
- package/dist/es2019/rules/use-primitives-text/transformers/strong-elements.js +47 -24
- package/dist/esm/presets/all.codegen.js +4 -5
- package/dist/esm/presets/recommended.codegen.js +4 -5
- package/dist/esm/rules/no-empty-styled-expression/index.js +1 -2
- package/dist/esm/rules/no-exported-css/index.js +1 -2
- package/dist/esm/rules/no-exported-keyframes/index.js +1 -2
- package/dist/esm/rules/no-invalid-css-map/index.js +4 -1
- package/dist/esm/rules/no-legacy-icons/helpers.js +3 -3
- package/dist/esm/rules/use-heading/config/index.js +2 -1
- package/dist/esm/rules/use-heading/transformers/native-elements.js +61 -31
- package/dist/esm/rules/use-primitives-text/config/index.js +2 -1
- package/dist/esm/rules/use-primitives-text/transformers/emphasis-elements.js +48 -26
- package/dist/esm/rules/use-primitives-text/transformers/paragraph-elements.js +62 -51
- package/dist/esm/rules/use-primitives-text/transformers/span-elements.js +56 -32
- package/dist/esm/rules/use-primitives-text/transformers/strong-elements.js +48 -26
- package/dist/types/index.codegen.d.ts +6 -8
- package/dist/types/presets/all.codegen.d.ts +4 -5
- package/dist/types/presets/recommended.codegen.d.ts +4 -5
- package/dist/types/rules/ensure-design-token-usage/rule-meta.d.ts +43 -2
- package/dist/types/rules/no-legacy-icons/helpers.d.ts +13 -1
- package/dist/types/rules/use-heading/config/index.d.ts +2 -1
- package/dist/types/rules/use-heading/transformers/native-elements.d.ts +5 -1
- package/dist/types/rules/use-primitives-text/config/index.d.ts +1 -0
- package/dist/types/rules/use-primitives-text/transformers/emphasis-elements.d.ts +6 -1
- package/dist/types/rules/use-primitives-text/transformers/paragraph-elements.d.ts +1 -0
- package/dist/types/rules/use-primitives-text/transformers/span-elements.d.ts +6 -1
- package/dist/types/rules/use-primitives-text/transformers/strong-elements.d.ts +6 -1
- package/dist/types-ts4.5/index.codegen.d.ts +6 -8
- package/dist/types-ts4.5/presets/all.codegen.d.ts +4 -5
- package/dist/types-ts4.5/presets/recommended.codegen.d.ts +4 -5
- package/dist/types-ts4.5/rules/ensure-design-token-usage/rule-meta.d.ts +43 -2
- package/dist/types-ts4.5/rules/no-legacy-icons/helpers.d.ts +13 -1
- package/dist/types-ts4.5/rules/use-heading/config/index.d.ts +2 -1
- package/dist/types-ts4.5/rules/use-heading/transformers/native-elements.d.ts +5 -1
- package/dist/types-ts4.5/rules/use-primitives-text/config/index.d.ts +1 -0
- package/dist/types-ts4.5/rules/use-primitives-text/transformers/emphasis-elements.d.ts +6 -1
- package/dist/types-ts4.5/rules/use-primitives-text/transformers/paragraph-elements.d.ts +1 -0
- package/dist/types-ts4.5/rules/use-primitives-text/transformers/span-elements.d.ts +6 -1
- package/dist/types-ts4.5/rules/use-primitives-text/transformers/strong-elements.d.ts +6 -1
- package/package.json +2 -2
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
2
|
import { type JSXElement } from 'eslint-codemod-utils';
|
|
3
3
|
import { type MetaData } from './common';
|
|
4
|
+
type CheckResult = {
|
|
5
|
+
success: boolean;
|
|
6
|
+
autoFixable?: boolean;
|
|
7
|
+
};
|
|
4
8
|
export declare const EmphasisElements: {
|
|
5
9
|
lint(node: Rule.Node, { context, config }: MetaData): void;
|
|
6
|
-
_check(node: JSXElement, { context, config }: MetaData):
|
|
10
|
+
_check(node: JSXElement, { context, config }: MetaData): CheckResult;
|
|
7
11
|
_fix(node: JSXElement, { context, config }: MetaData): Rule.ReportFixer;
|
|
8
12
|
};
|
|
13
|
+
export {};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
2
|
import { type JSXElement } from 'eslint-codemod-utils';
|
|
3
3
|
import { type MetaData } from './common';
|
|
4
|
+
type CheckResult = {
|
|
5
|
+
success: boolean;
|
|
6
|
+
autoFixable?: boolean;
|
|
7
|
+
};
|
|
4
8
|
export declare const SpanElements: {
|
|
5
9
|
lint(node: Rule.Node, { context, config }: MetaData): void;
|
|
6
|
-
_check(node: JSXElement, { context, config }: MetaData):
|
|
10
|
+
_check(node: JSXElement, { context, config }: MetaData): CheckResult;
|
|
7
11
|
_fix(node: JSXElement, { context, config }: MetaData): Rule.ReportFixer;
|
|
8
12
|
};
|
|
13
|
+
export {};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
2
|
import { type JSXElement } from 'eslint-codemod-utils';
|
|
3
3
|
import { type MetaData } from './common';
|
|
4
|
+
type CheckResult = {
|
|
5
|
+
success: boolean;
|
|
6
|
+
autoFixable?: boolean;
|
|
7
|
+
};
|
|
4
8
|
export declare const StrongElements: {
|
|
5
9
|
lint(node: Rule.Node, { context, config }: MetaData): void;
|
|
6
|
-
_check(node: JSXElement, { context, config }: MetaData):
|
|
10
|
+
_check(node: JSXElement, { context, config }: MetaData): CheckResult;
|
|
7
11
|
_fix(node: JSXElement, { context, config }: MetaData): Rule.ReportFixer;
|
|
8
12
|
};
|
|
13
|
+
export {};
|
|
@@ -14,12 +14,11 @@ export declare const configs: {
|
|
|
14
14
|
'@atlaskit/design-system/no-deprecated-design-token-usage': string;
|
|
15
15
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
16
16
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': string;
|
|
17
|
-
'@atlaskit/design-system/no-empty-styled-expression': string;
|
|
18
|
-
'@atlaskit/design-system/no-exported-css': string;
|
|
19
|
-
'@atlaskit/design-system/no-exported-keyframes': string;
|
|
20
17
|
'@atlaskit/design-system/no-html-anchor': string;
|
|
21
18
|
'@atlaskit/design-system/no-html-button': string;
|
|
22
|
-
'@atlaskit/design-system/no-invalid-css-map': string
|
|
19
|
+
'@atlaskit/design-system/no-invalid-css-map': (string | {
|
|
20
|
+
allowedFunctionCalls: string[][];
|
|
21
|
+
})[];
|
|
23
22
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': string;
|
|
24
23
|
'@atlaskit/design-system/no-legacy-icons': string;
|
|
25
24
|
'@atlaskit/design-system/no-margin': string;
|
|
@@ -57,12 +56,11 @@ export declare const configs: {
|
|
|
57
56
|
'@atlaskit/design-system/no-deprecated-design-token-usage': string;
|
|
58
57
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
59
58
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': string;
|
|
60
|
-
'@atlaskit/design-system/no-empty-styled-expression': string;
|
|
61
|
-
'@atlaskit/design-system/no-exported-css': string;
|
|
62
|
-
'@atlaskit/design-system/no-exported-keyframes': string;
|
|
63
59
|
'@atlaskit/design-system/no-html-anchor': string;
|
|
64
60
|
'@atlaskit/design-system/no-html-button': string;
|
|
65
|
-
'@atlaskit/design-system/no-invalid-css-map': string
|
|
61
|
+
'@atlaskit/design-system/no-invalid-css-map': (string | {
|
|
62
|
+
allowedFunctionCalls: string[][];
|
|
63
|
+
})[];
|
|
66
64
|
'@atlaskit/design-system/no-nested-styles': string;
|
|
67
65
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
68
66
|
'@atlaskit/design-system/no-unsafe-style-overrides': 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::b6947ac630ea512fe3f4e3f44abb6783>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -17,12 +17,11 @@ declare const _default: {
|
|
|
17
17
|
'@atlaskit/design-system/no-deprecated-design-token-usage': string;
|
|
18
18
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
19
19
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': string;
|
|
20
|
-
'@atlaskit/design-system/no-empty-styled-expression': string;
|
|
21
|
-
'@atlaskit/design-system/no-exported-css': string;
|
|
22
|
-
'@atlaskit/design-system/no-exported-keyframes': string;
|
|
23
20
|
'@atlaskit/design-system/no-html-anchor': string;
|
|
24
21
|
'@atlaskit/design-system/no-html-button': string;
|
|
25
|
-
'@atlaskit/design-system/no-invalid-css-map': string
|
|
22
|
+
'@atlaskit/design-system/no-invalid-css-map': (string | {
|
|
23
|
+
allowedFunctionCalls: string[][];
|
|
24
|
+
})[];
|
|
26
25
|
'@atlaskit/design-system/no-keyframes-tagged-template-expression': string;
|
|
27
26
|
'@atlaskit/design-system/no-legacy-icons': string;
|
|
28
27
|
'@atlaskit/design-system/no-margin': 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::9b6bccf688f4ee18dd0d49dbce48e475>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -14,12 +14,11 @@ declare const _default: {
|
|
|
14
14
|
'@atlaskit/design-system/no-deprecated-design-token-usage': string;
|
|
15
15
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
16
16
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': string;
|
|
17
|
-
'@atlaskit/design-system/no-empty-styled-expression': string;
|
|
18
|
-
'@atlaskit/design-system/no-exported-css': string;
|
|
19
|
-
'@atlaskit/design-system/no-exported-keyframes': string;
|
|
20
17
|
'@atlaskit/design-system/no-html-anchor': string;
|
|
21
18
|
'@atlaskit/design-system/no-html-button': string;
|
|
22
|
-
'@atlaskit/design-system/no-invalid-css-map': string
|
|
19
|
+
'@atlaskit/design-system/no-invalid-css-map': (string | {
|
|
20
|
+
allowedFunctionCalls: string[][];
|
|
21
|
+
})[];
|
|
23
22
|
'@atlaskit/design-system/no-nested-styles': string;
|
|
24
23
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
25
24
|
'@atlaskit/design-system/no-unsafe-style-overrides': string;
|
|
@@ -1,3 +1,44 @@
|
|
|
1
|
-
import type
|
|
2
|
-
declare const ruleMeta:
|
|
1
|
+
import { type Domains } from './types';
|
|
2
|
+
declare const ruleMeta: {
|
|
3
|
+
readonly name: "ensure-design-token-usage";
|
|
4
|
+
readonly hasSuggestions: true;
|
|
5
|
+
readonly schema: {
|
|
6
|
+
readonly type: "array";
|
|
7
|
+
readonly items: {
|
|
8
|
+
readonly type: "object";
|
|
9
|
+
readonly properties: {
|
|
10
|
+
readonly applyImport: {
|
|
11
|
+
readonly type: "boolean";
|
|
12
|
+
};
|
|
13
|
+
readonly shouldEnforceFallbacks: {
|
|
14
|
+
readonly type: "boolean";
|
|
15
|
+
};
|
|
16
|
+
readonly domains: {
|
|
17
|
+
readonly type: "array";
|
|
18
|
+
readonly items: {
|
|
19
|
+
readonly enum: Domains;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
readonly exceptions: {
|
|
23
|
+
readonly type: "array";
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
readonly type: "problem";
|
|
29
|
+
readonly fixable: "code";
|
|
30
|
+
readonly docs: {
|
|
31
|
+
readonly description: "Enforces usage of design tokens rather than hard-coded values.";
|
|
32
|
+
readonly recommended: true;
|
|
33
|
+
readonly severity: "error";
|
|
34
|
+
};
|
|
35
|
+
readonly messages: {
|
|
36
|
+
readonly noRawRadiusValues: "The use of shape tokens is preferred over the direct application of border properties.\n\n@meta <<{{payload}}>>";
|
|
37
|
+
readonly noRawSpacingValues: "The use of spacing primitives or tokens is preferred over the direct application of spacing properties.\n\n@meta <<{{payload}}>>";
|
|
38
|
+
readonly autofixesPossible: "Automated corrections available for spacing values. Apply autofix to replace values with appropriate tokens";
|
|
39
|
+
readonly noCalcUsage: "The use of space tokens is preferred over using the CSS calc function. If using a value that is not aligned to the spacing scale, consider aligning to the scale and using tokens instead.";
|
|
40
|
+
readonly hardCodedColor: "Colors can be sourced from the global theme using the token function.";
|
|
41
|
+
readonly legacyElevation: "Elevations can be sourced from the global theme using the token function made of both a background and shadow. Use \"card\" for card elevations, and \"overlay\" for anything else that should appear elevated.";
|
|
42
|
+
};
|
|
43
|
+
};
|
|
3
44
|
export default ruleMeta;
|
|
@@ -32,7 +32,19 @@ export declare const isSize: (size: any) => size is "small" | "medium" | "large"
|
|
|
32
32
|
* @param iconPackage The name of the legacy icon package
|
|
33
33
|
* @returns The migration map object for the legacy icon or null if not found
|
|
34
34
|
*/
|
|
35
|
-
export declare const getMigrationMapObject: (iconPackage: string) =>
|
|
35
|
+
export declare const getMigrationMapObject: (iconPackage: string) => {
|
|
36
|
+
newIcon?: {
|
|
37
|
+
name: string;
|
|
38
|
+
type: string;
|
|
39
|
+
package: string;
|
|
40
|
+
} | undefined;
|
|
41
|
+
additionalIcons?: {
|
|
42
|
+
name: string;
|
|
43
|
+
type: string;
|
|
44
|
+
package: string;
|
|
45
|
+
}[] | undefined;
|
|
46
|
+
sizeGuidance: Record<import("@atlaskit/icon").Size, IconMigrationSizeGuidance>;
|
|
47
|
+
} | null;
|
|
36
48
|
export declare const getUpcomingIcons: (iconPackage: string) => {
|
|
37
49
|
sizeGuidance: Record<Size, IconMigrationSizeGuidance>;
|
|
38
50
|
} | null;
|
|
@@ -2,7 +2,8 @@ type Pattern = 'native-elements';
|
|
|
2
2
|
export interface RuleConfig {
|
|
3
3
|
failSilently: boolean;
|
|
4
4
|
patterns: Pattern[];
|
|
5
|
-
enableUnsafeAutofix:
|
|
5
|
+
enableUnsafeAutofix: boolean;
|
|
6
|
+
enableUnsafeReport: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare const getConfig: (overrides: Partial<RuleConfig>) => RuleConfig;
|
|
8
9
|
export {};
|
|
@@ -10,9 +10,13 @@ interface ValidHeadingElement extends JSXElement {
|
|
|
10
10
|
};
|
|
11
11
|
} & JSXOpeningElement;
|
|
12
12
|
}
|
|
13
|
+
type CheckResult = {
|
|
14
|
+
success: boolean;
|
|
15
|
+
autoFixable?: boolean;
|
|
16
|
+
};
|
|
13
17
|
export declare const NativeElements: {
|
|
14
18
|
lint(node: Rule.Node, { context, config }: MetaData): void;
|
|
15
|
-
_check(node: Rule.Node, { config }: MetaData):
|
|
19
|
+
_check(node: Rule.Node, { config }: MetaData): CheckResult;
|
|
16
20
|
_fix(node: ValidHeadingElement, { context }: MetaData): Rule.ReportFixer;
|
|
17
21
|
};
|
|
18
22
|
export {};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
2
|
import { type JSXElement } from 'eslint-codemod-utils';
|
|
3
3
|
import { type MetaData } from './common';
|
|
4
|
+
type CheckResult = {
|
|
5
|
+
success: boolean;
|
|
6
|
+
autoFixable?: boolean;
|
|
7
|
+
};
|
|
4
8
|
export declare const EmphasisElements: {
|
|
5
9
|
lint(node: Rule.Node, { context, config }: MetaData): void;
|
|
6
|
-
_check(node: JSXElement, { context, config }: MetaData):
|
|
10
|
+
_check(node: JSXElement, { context, config }: MetaData): CheckResult;
|
|
7
11
|
_fix(node: JSXElement, { context, config }: MetaData): Rule.ReportFixer;
|
|
8
12
|
};
|
|
13
|
+
export {};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
2
|
import { type JSXElement } from 'eslint-codemod-utils';
|
|
3
3
|
import { type MetaData } from './common';
|
|
4
|
+
type CheckResult = {
|
|
5
|
+
success: boolean;
|
|
6
|
+
autoFixable?: boolean;
|
|
7
|
+
};
|
|
4
8
|
export declare const SpanElements: {
|
|
5
9
|
lint(node: Rule.Node, { context, config }: MetaData): void;
|
|
6
|
-
_check(node: JSXElement, { context, config }: MetaData):
|
|
10
|
+
_check(node: JSXElement, { context, config }: MetaData): CheckResult;
|
|
7
11
|
_fix(node: JSXElement, { context, config }: MetaData): Rule.ReportFixer;
|
|
8
12
|
};
|
|
13
|
+
export {};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
2
|
import { type JSXElement } from 'eslint-codemod-utils';
|
|
3
3
|
import { type MetaData } from './common';
|
|
4
|
+
type CheckResult = {
|
|
5
|
+
success: boolean;
|
|
6
|
+
autoFixable?: boolean;
|
|
7
|
+
};
|
|
4
8
|
export declare const StrongElements: {
|
|
5
9
|
lint(node: Rule.Node, { context, config }: MetaData): void;
|
|
6
|
-
_check(node: JSXElement, { context, config }: MetaData):
|
|
10
|
+
_check(node: JSXElement, { context, config }: MetaData): CheckResult;
|
|
7
11
|
_fix(node: JSXElement, { context, config }: MetaData): Rule.ReportFixer;
|
|
8
12
|
};
|
|
13
|
+
export {};
|
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": "10.
|
|
4
|
+
"version": "10.14.0",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"publishConfig": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@atlaskit/eslint-utils": "^1.6.0",
|
|
45
|
-
"@atlaskit/icon": "^22.
|
|
45
|
+
"@atlaskit/icon": "^22.11.0",
|
|
46
46
|
"@atlaskit/tokens": "*",
|
|
47
47
|
"@babel/runtime": "^7.0.0",
|
|
48
48
|
"@typescript-eslint/utils": "^5.48.1",
|