@atlaskit/eslint-plugin-design-system 10.12.4 → 10.13.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 +24 -0
- package/dist/cjs/rules/no-legacy-icons/checks.js +90 -44
- package/dist/cjs/rules/no-legacy-icons/helpers.js +44 -12
- package/dist/cjs/rules/no-legacy-icons/index.js +5 -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/rules/no-legacy-icons/checks.js +75 -33
- package/dist/es2019/rules/no-legacy-icons/helpers.js +43 -11
- package/dist/es2019/rules/no-legacy-icons/index.js +5 -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/rules/no-legacy-icons/checks.js +91 -45
- package/dist/esm/rules/no-legacy-icons/helpers.js +43 -11
- package/dist/esm/rules/no-legacy-icons/index.js +5 -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/rules/no-legacy-icons/checks.d.ts +4 -1
- package/dist/types/rules/no-legacy-icons/helpers.d.ts +21 -14
- 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/rules/no-legacy-icons/checks.d.ts +4 -1
- package/dist/types-ts4.5/rules/no-legacy-icons/helpers.d.ts +21 -14
- 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,13 +1,16 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
2
|
import { type CallExpression, type ExportDefaultDeclaration, type ExportNamedDeclaration, type Identifier, type ImportDeclaration, type VariableDeclaration } from 'eslint-codemod-utils';
|
|
3
|
-
|
|
3
|
+
type ReturnObject = {
|
|
4
4
|
checkImportDeclarations: (node: ImportDeclaration & Rule.NodeParentExtension) => void;
|
|
5
5
|
checkVariableDeclarations: (node: VariableDeclaration & Rule.NodeParentExtension) => void;
|
|
6
6
|
checkExportDefaultDeclaration: (node: ExportDefaultDeclaration & Rule.NodeParentExtension) => void;
|
|
7
7
|
checkExportNamedVariables: (node: ExportNamedDeclaration & Rule.NodeParentExtension) => void;
|
|
8
8
|
checkArrayOrMap: (node: Identifier) => void;
|
|
9
9
|
checkIconAsProp: (node: Identifier) => void;
|
|
10
|
+
checkIconReference: (node: Identifier & Rule.NodeParentExtension) => void;
|
|
10
11
|
checkJSXElement: (node: Rule.Node) => void;
|
|
11
12
|
checkCallExpression: (node: CallExpression & Rule.NodeParentExtension) => void;
|
|
12
13
|
throwErrors: () => void;
|
|
13
14
|
};
|
|
15
|
+
export declare const createChecks: (context: Rule.RuleContext) => ReturnObject;
|
|
16
|
+
export {};
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
2
|
import { type JSXAttribute, type Node } from 'eslint-codemod-utils';
|
|
3
3
|
import { type IconMigrationSizeGuidance } from '@atlaskit/icon/UNSAFE_migration-map';
|
|
4
|
-
export type
|
|
5
|
-
export type
|
|
4
|
+
export type IconMigrationError = Rule.ReportDescriptor;
|
|
5
|
+
export type RangeList = {
|
|
6
|
+
start: number;
|
|
7
|
+
end: number;
|
|
8
|
+
}[];
|
|
9
|
+
export type ErrorListManual = {
|
|
6
10
|
[loc: string]: {
|
|
7
|
-
errors:
|
|
11
|
+
errors: IconMigrationError[];
|
|
8
12
|
iconName: string;
|
|
9
13
|
importSource: string;
|
|
10
14
|
};
|
|
11
15
|
};
|
|
12
|
-
export type
|
|
13
|
-
[loc: string]:
|
|
16
|
+
export type ErrorListAuto = {
|
|
17
|
+
[loc: string]: IconMigrationError;
|
|
14
18
|
};
|
|
15
|
-
export type
|
|
19
|
+
export type GuidanceList = {
|
|
16
20
|
[loc: string]: string;
|
|
17
21
|
};
|
|
18
22
|
declare const sizes: readonly [
|
|
@@ -47,14 +51,15 @@ export declare const createGuidance: (iconPackage: string, insideNewButton?: boo
|
|
|
47
51
|
*/
|
|
48
52
|
export declare const canMigrateColor: (color: string) => boolean;
|
|
49
53
|
export declare const locToString: (node: Node) => string;
|
|
50
|
-
export declare const createCantMigrateReExportError: (node: Node, packageName: string, exportName: string, errors:
|
|
51
|
-
export declare const
|
|
52
|
-
export declare const
|
|
53
|
-
export declare const
|
|
54
|
-
export declare const
|
|
55
|
-
export declare const
|
|
56
|
-
export declare const
|
|
57
|
-
export declare const
|
|
54
|
+
export declare const createCantMigrateReExportError: (node: Node, packageName: string, exportName: string, errors: ErrorListManual) => void;
|
|
55
|
+
export declare const createCantMigrateIdentifierMapOrArrayError: (node: Node, packageName: string, exportName: string, errors: ErrorListManual) => void;
|
|
56
|
+
export declare const createCantMigrateIdentifierError: (node: Node, packageName: string, exportName: string, errors: ErrorListManual) => void;
|
|
57
|
+
export declare const createCantFindSuitableReplacementError: (node: Node, importSource: string, iconName: string, errors: ErrorListManual, sizeIssue?: boolean) => void;
|
|
58
|
+
export declare const createCantMigrateFunctionUnknownError: (node: Node, importSource: string, iconName: string, errors: ErrorListManual) => void;
|
|
59
|
+
export declare const createCantMigrateColorError: (node: Node, colorValue: string, errors: ErrorListManual, importSource: string, iconName: string) => void;
|
|
60
|
+
export declare const createCantMigrateSpreadPropsError: (node: Node, missingProps: string[], errors: ErrorListManual, importSource: string, iconName: string) => void;
|
|
61
|
+
export declare const createCantMigrateSizeUnknown: (node: Node, errors: ErrorListManual, importSource: string, iconName: string) => void;
|
|
62
|
+
export declare const createAutoMigrationError: (node: Node, importSource: string, iconName: string, errors: ErrorListAuto) => void;
|
|
58
63
|
export declare const getLiteralStringValue: (value: any) => string | undefined;
|
|
59
64
|
export declare const createHelpers: (context: Rule.RuleContext) => {
|
|
60
65
|
/**
|
|
@@ -64,4 +69,6 @@ export declare const createHelpers: (context: Rule.RuleContext) => {
|
|
|
64
69
|
getTokenCallValue: (value: any) => string | undefined;
|
|
65
70
|
getConfigFlag: (key: string, defaultValue: boolean) => boolean;
|
|
66
71
|
};
|
|
72
|
+
export declare const addToListOfRanges: (node: Node, sortedListOfRangesForErrors: RangeList) => void;
|
|
73
|
+
export declare const isInRangeList: (node: Node, sortedListOfRangesForErrors: RangeList) => boolean;
|
|
67
74
|
export {};
|
|
@@ -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.13.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",
|