@atlaskit/eslint-plugin-design-system 8.17.0 → 8.18.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 +1 -0
- package/constellation/index/usage.mdx +22 -0
- package/dist/cjs/presets/all.codegen.js +2 -1
- package/dist/cjs/presets/recommended.codegen.js +2 -1
- package/dist/cjs/rules/index.codegen.js +3 -1
- package/dist/cjs/rules/use-heading-level-in-spotlight-card/index.js +63 -0
- package/dist/cjs/rules/use-href-in-link-item/index.js +2 -1
- package/dist/cjs/rules/use-href-in-link-item/utils.js +1 -25
- package/dist/cjs/rules/use-primitives/index.js +40 -35
- package/dist/cjs/rules/use-primitives/transformers/css-to-xcss.js +10 -3
- package/dist/cjs/rules/use-primitives/transformers/index.js +8 -1
- package/dist/cjs/rules/use-primitives/transformers/styled-component-to-primitive.js +68 -0
- package/dist/cjs/rules/use-primitives/utils/convert-ast-object-expression-to-js-object.js +16 -0
- package/dist/cjs/rules/use-primitives/utils/find-valid-jsx-usage-to-transform.js +39 -0
- package/dist/cjs/rules/use-primitives/utils/find-valid-styled-component-call.js +52 -0
- package/dist/cjs/rules/use-primitives/utils/index.js +21 -0
- package/dist/cjs/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +38 -0
- package/dist/cjs/rules/use-primitives/utils/is-valid-tag-name.js +2 -2
- package/dist/cjs/rules/use-primitives/utils/update-jsx-element-name.js +1 -1
- package/dist/cjs/rules/utils/get-import-name.js +30 -0
- package/dist/es2019/presets/all.codegen.js +2 -1
- package/dist/es2019/presets/recommended.codegen.js +2 -1
- package/dist/es2019/rules/index.codegen.js +3 -1
- package/dist/es2019/rules/use-heading-level-in-spotlight-card/index.js +49 -0
- package/dist/es2019/rules/use-href-in-link-item/index.js +3 -2
- package/dist/es2019/rules/use-href-in-link-item/utils.js +0 -24
- package/dist/es2019/rules/use-primitives/index.js +41 -37
- package/dist/es2019/rules/use-primitives/transformers/css-to-xcss.js +9 -6
- package/dist/es2019/rules/use-primitives/transformers/index.js +2 -1
- package/dist/es2019/rules/use-primitives/transformers/styled-component-to-primitive.js +59 -0
- package/dist/es2019/rules/use-primitives/utils/convert-ast-object-expression-to-js-object.js +14 -0
- package/dist/es2019/rules/use-primitives/utils/find-valid-jsx-usage-to-transform.js +32 -0
- package/dist/es2019/rules/use-primitives/utils/find-valid-styled-component-call.js +47 -0
- package/dist/es2019/rules/use-primitives/utils/index.js +3 -0
- package/dist/es2019/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +32 -0
- package/dist/es2019/rules/use-primitives/utils/is-valid-tag-name.js +1 -1
- package/dist/es2019/rules/use-primitives/utils/update-jsx-element-name.js +1 -1
- package/dist/es2019/rules/utils/get-import-name.js +24 -0
- package/dist/esm/presets/all.codegen.js +2 -1
- package/dist/esm/presets/recommended.codegen.js +2 -1
- package/dist/esm/rules/index.codegen.js +3 -1
- package/dist/esm/rules/use-heading-level-in-spotlight-card/index.js +57 -0
- package/dist/esm/rules/use-href-in-link-item/index.js +3 -2
- package/dist/esm/rules/use-href-in-link-item/utils.js +0 -24
- package/dist/esm/rules/use-primitives/index.js +41 -37
- package/dist/esm/rules/use-primitives/transformers/css-to-xcss.js +9 -2
- package/dist/esm/rules/use-primitives/transformers/index.js +2 -1
- package/dist/esm/rules/use-primitives/transformers/styled-component-to-primitive.js +61 -0
- package/dist/esm/rules/use-primitives/utils/convert-ast-object-expression-to-js-object.js +16 -0
- package/dist/esm/rules/use-primitives/utils/find-valid-jsx-usage-to-transform.js +34 -0
- package/dist/esm/rules/use-primitives/utils/find-valid-styled-component-call.js +47 -0
- package/dist/esm/rules/use-primitives/utils/index.js +3 -0
- package/dist/esm/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +32 -0
- package/dist/esm/rules/use-primitives/utils/is-valid-tag-name.js +1 -1
- package/dist/esm/rules/use-primitives/utils/update-jsx-element-name.js +1 -1
- package/dist/esm/rules/utils/get-import-name.js +24 -0
- package/dist/types/index.codegen.d.ts +2 -0
- package/dist/types/presets/all.codegen.d.ts +2 -1
- package/dist/types/presets/recommended.codegen.d.ts +2 -1
- package/dist/types/rules/index.codegen.d.ts +1 -0
- package/dist/types/rules/use-heading-level-in-spotlight-card/index.d.ts +4 -0
- package/dist/types/rules/use-href-in-link-item/utils.d.ts +0 -1
- package/dist/types/rules/use-primitives/transformers/css-to-xcss.d.ts +2 -1
- package/dist/types/rules/use-primitives/transformers/index.d.ts +1 -0
- package/dist/types/rules/use-primitives/transformers/styled-component-to-primitive.d.ts +13 -0
- package/dist/types/rules/use-primitives/utils/convert-ast-object-expression-to-js-object.d.ts +1 -1
- package/dist/types/rules/use-primitives/utils/find-valid-jsx-usage-to-transform.d.ts +7 -0
- package/dist/types/rules/use-primitives/utils/find-valid-styled-component-call.d.ts +7 -0
- package/dist/types/rules/use-primitives/utils/index.d.ts +3 -0
- package/dist/types/rules/use-primitives/utils/is-valid-css-properties-to-transform.d.ts +3 -0
- package/dist/types/rules/use-primitives/utils/is-valid-tag-name.d.ts +1 -0
- package/dist/types/rules/use-primitives/utils/update-jsx-element-name.d.ts +1 -1
- package/dist/types/rules/utils/get-import-name.d.ts +2 -0
- package/dist/types-ts4.5/index.codegen.d.ts +2 -0
- package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
- package/dist/types-ts4.5/presets/recommended.codegen.d.ts +2 -1
- package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
- package/dist/types-ts4.5/rules/use-heading-level-in-spotlight-card/index.d.ts +4 -0
- package/dist/types-ts4.5/rules/use-href-in-link-item/utils.d.ts +0 -1
- package/dist/types-ts4.5/rules/use-primitives/transformers/css-to-xcss.d.ts +2 -1
- package/dist/types-ts4.5/rules/use-primitives/transformers/index.d.ts +1 -0
- package/dist/types-ts4.5/rules/use-primitives/transformers/styled-component-to-primitive.d.ts +13 -0
- package/dist/types-ts4.5/rules/use-primitives/utils/convert-ast-object-expression-to-js-object.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-primitives/utils/find-valid-jsx-usage-to-transform.d.ts +7 -0
- package/dist/types-ts4.5/rules/use-primitives/utils/find-valid-styled-component-call.d.ts +7 -0
- package/dist/types-ts4.5/rules/use-primitives/utils/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/use-primitives/utils/is-valid-css-properties-to-transform.d.ts +3 -0
- package/dist/types-ts4.5/rules/use-primitives/utils/is-valid-tag-name.d.ts +1 -0
- package/dist/types-ts4.5/rules/use-primitives/utils/update-jsx-element-name.d.ts +1 -1
- package/dist/types-ts4.5/rules/utils/get-import-name.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import { JSXOpeningElement, VariableDeclarator } from 'eslint-codemod-utils';
|
|
3
|
+
type StylesRef = VariableDeclarator & Rule.NodeParentExtension;
|
|
4
|
+
type JSXRef = JSXOpeningElement & Rule.NodeParentExtension;
|
|
5
|
+
/**
|
|
6
|
+
* All required validation steps have been taken care of before this
|
|
7
|
+
* transformer is called, so it just goes ahead providing all necessary fixes
|
|
8
|
+
*/
|
|
9
|
+
export declare const styledComponentToPrimitive: ({ stylesRef, jsxRef, }: {
|
|
10
|
+
stylesRef: StylesRef;
|
|
11
|
+
jsxRef: JSXRef;
|
|
12
|
+
}, context: Rule.RuleContext) => (fixer: Rule.RuleFixer) => Rule.Fix[];
|
|
13
|
+
export {};
|
package/dist/types/rules/use-primitives/utils/convert-ast-object-expression-to-js-object.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export type CSSPropStyleObject = {
|
|
|
6
6
|
/**
|
|
7
7
|
* Note: Not recursive. Only handles top level key/value pairs
|
|
8
8
|
*/
|
|
9
|
-
export declare const convertASTObjectExpressionToJSObject: (styles: ObjectExpression & Partial<Rule.NodeParentExtension>) => CSSPropStyleObject;
|
|
9
|
+
export declare const convertASTObjectExpressionToJSObject: (styles: ObjectExpression & Partial<Rule.NodeParentExtension>) => CSSPropStyleObject | false;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Rule, Scope } from 'eslint';
|
|
2
|
+
import { JSXOpeningElement } from 'eslint-codemod-utils';
|
|
3
|
+
/**
|
|
4
|
+
* Given a component name finds its JSX usages and performs some
|
|
5
|
+
* additional validations to ensure transformation can be done correctly
|
|
6
|
+
*/
|
|
7
|
+
export declare const findValidJsxUsageToTransform: (componentName: string, scope: Scope.Scope) => (JSXOpeningElement & Rule.NodeParentExtension) | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import { type VariableDeclarator } from 'eslint-codemod-utils';
|
|
3
|
+
/**
|
|
4
|
+
* returns a variable reference if preconditions are favourable for
|
|
5
|
+
* the transformation to proceed, undefined otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare const findValidStyledComponentCall: (node: Rule.Node) => (VariableDeclarator & Rule.NodeParentExtension) | undefined;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export { containsOnlySupportedAttrs } from './contains-only-supported-attrs';
|
|
2
2
|
export { convertASTObjectExpressionToJSObject } from './convert-ast-object-expression-to-js-object';
|
|
3
|
+
export { findValidJsxUsageToTransform } from './find-valid-jsx-usage-to-transform';
|
|
4
|
+
export { findValidStyledComponentCall } from './find-valid-styled-component-call';
|
|
3
5
|
export { getAttributeValueIdentifier } from './get-attribute-value-identifier';
|
|
4
6
|
export { getFunctionArgumentAtPos } from './get-function-argument-at-pos';
|
|
5
7
|
export { getJSXAttributeByName } from './get-jsx-attribute-by-name';
|
|
6
8
|
export { getVariableDefinitionValue } from './get-variable-definition-value';
|
|
7
9
|
export { getVariableUsagesCount } from './get-variable-usage-count';
|
|
8
10
|
export { isFunctionNamed } from './is-function-named';
|
|
11
|
+
export { isValidCssPropertiesToTransform } from './is-valid-css-properties-to-transform';
|
|
9
12
|
export { isValidTagName } from './is-valid-tag-name';
|
|
10
13
|
export { updateJSXAttributeByName } from './update-jsx-attribute-by-name';
|
|
11
14
|
export { updateJSXElementName } from './update-jsx-element-name';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
2
|
import { JSXElement } from 'eslint-codemod-utils';
|
|
3
|
-
export declare const updateJSXElementName: (node: JSXElement, newName: string, fixer: Rule.RuleFixer) => (Rule.Fix |
|
|
3
|
+
export declare const updateJSXElementName: (node: JSXElement, newName: string, fixer: Rule.RuleFixer) => (Rule.Fix | undefined)[];
|
|
@@ -19,6 +19,7 @@ export declare const configs: {
|
|
|
19
19
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': string;
|
|
20
20
|
'@atlaskit/design-system/prefer-primitives': string;
|
|
21
21
|
'@atlaskit/design-system/use-drawer-label': string;
|
|
22
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
22
23
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
23
24
|
'@atlaskit/design-system/use-primitives': string;
|
|
24
25
|
'@atlaskit/design-system/use-visually-hidden': string;
|
|
@@ -38,6 +39,7 @@ export declare const configs: {
|
|
|
38
39
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
39
40
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': string;
|
|
40
41
|
'@atlaskit/design-system/use-drawer-label': string;
|
|
42
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
41
43
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
42
44
|
'@atlaskit/design-system/use-visually-hidden': string;
|
|
43
45
|
};
|
|
@@ -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::37a857efd0971ab26170d5f1f526279b>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -22,6 +22,7 @@ declare const _default: {
|
|
|
22
22
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': string;
|
|
23
23
|
'@atlaskit/design-system/prefer-primitives': string;
|
|
24
24
|
'@atlaskit/design-system/use-drawer-label': string;
|
|
25
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
25
26
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
26
27
|
'@atlaskit/design-system/use-primitives': string;
|
|
27
28
|
'@atlaskit/design-system/use-visually-hidden': 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::b3bce8efb2db1fed84370af608ca0d4c>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -17,6 +17,7 @@ declare const _default: {
|
|
|
17
17
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
18
18
|
'@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': string;
|
|
19
19
|
'@atlaskit/design-system/use-drawer-label': string;
|
|
20
|
+
'@atlaskit/design-system/use-heading-level-in-spotlight-card': string;
|
|
20
21
|
'@atlaskit/design-system/use-href-in-link-item': string;
|
|
21
22
|
'@atlaskit/design-system/use-visually-hidden': string;
|
|
22
23
|
};
|
|
@@ -23,6 +23,7 @@ declare const _default: {
|
|
|
23
23
|
'no-unsupported-drag-and-drop-libraries': import("eslint").Rule.RuleModule;
|
|
24
24
|
'prefer-primitives': import("eslint").Rule.RuleModule;
|
|
25
25
|
'use-drawer-label': import("eslint").Rule.RuleModule;
|
|
26
|
+
'use-heading-level-in-spotlight-card': import("eslint").Rule.RuleModule;
|
|
26
27
|
'use-href-in-link-item': import("eslint").Rule.RuleModule;
|
|
27
28
|
'use-primitives': import("eslint").Rule.RuleModule;
|
|
28
29
|
'use-visually-hidden': import("eslint").Rule.RuleModule;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Rule, Scope } from 'eslint';
|
|
2
2
|
import { ImportDeclaration, JSXAttribute } from 'eslint-codemod-utils';
|
|
3
|
-
export declare const getLinkItemImportName: (scope: Scope.Scope) => string | null;
|
|
4
3
|
export declare const hrefHasInvalidValue: (scope: Scope.Scope, href: JSXAttribute | undefined) => boolean;
|
|
5
4
|
export declare const hasImportOfName: (node: ImportDeclaration, name: string) => boolean;
|
|
6
5
|
export declare const insertButtonItemDefaultImport: (fixer: Rule.RuleFixer, node: ImportDeclaration) => Rule.Fix;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { JSXElement } from 'eslint-codemod-utils';
|
|
2
|
+
import { JSXElement, ObjectExpression } from 'eslint-codemod-utils';
|
|
3
3
|
export declare const cssToXcssTransformer: (node: JSXElement, context: Rule.RuleContext, fixer: Rule.RuleFixer) => (Rule.Fix | undefined)[];
|
|
4
|
+
export declare const styledObjectToXcssTokens: (styles: ObjectExpression & Partial<Rule.NodeParentExtension>, fixer: Rule.RuleFixer) => (Rule.Fix | undefined)[];
|
|
4
5
|
export declare const spaceTokenMap: {
|
|
5
6
|
[key: string]: string;
|
|
6
7
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import { JSXOpeningElement, VariableDeclarator } from 'eslint-codemod-utils';
|
|
3
|
+
type StylesRef = VariableDeclarator & Rule.NodeParentExtension;
|
|
4
|
+
type JSXRef = JSXOpeningElement & Rule.NodeParentExtension;
|
|
5
|
+
/**
|
|
6
|
+
* All required validation steps have been taken care of before this
|
|
7
|
+
* transformer is called, so it just goes ahead providing all necessary fixes
|
|
8
|
+
*/
|
|
9
|
+
export declare const styledComponentToPrimitive: ({ stylesRef, jsxRef, }: {
|
|
10
|
+
stylesRef: StylesRef;
|
|
11
|
+
jsxRef: JSXRef;
|
|
12
|
+
}, context: Rule.RuleContext) => (fixer: Rule.RuleFixer) => Rule.Fix[];
|
|
13
|
+
export {};
|
package/dist/types-ts4.5/rules/use-primitives/utils/convert-ast-object-expression-to-js-object.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export type CSSPropStyleObject = {
|
|
|
6
6
|
/**
|
|
7
7
|
* Note: Not recursive. Only handles top level key/value pairs
|
|
8
8
|
*/
|
|
9
|
-
export declare const convertASTObjectExpressionToJSObject: (styles: ObjectExpression & Partial<Rule.NodeParentExtension>) => CSSPropStyleObject;
|
|
9
|
+
export declare const convertASTObjectExpressionToJSObject: (styles: ObjectExpression & Partial<Rule.NodeParentExtension>) => CSSPropStyleObject | false;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Rule, Scope } from 'eslint';
|
|
2
|
+
import { JSXOpeningElement } from 'eslint-codemod-utils';
|
|
3
|
+
/**
|
|
4
|
+
* Given a component name finds its JSX usages and performs some
|
|
5
|
+
* additional validations to ensure transformation can be done correctly
|
|
6
|
+
*/
|
|
7
|
+
export declare const findValidJsxUsageToTransform: (componentName: string, scope: Scope.Scope) => (JSXOpeningElement & Rule.NodeParentExtension) | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import { type VariableDeclarator } from 'eslint-codemod-utils';
|
|
3
|
+
/**
|
|
4
|
+
* returns a variable reference if preconditions are favourable for
|
|
5
|
+
* the transformation to proceed, undefined otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare const findValidStyledComponentCall: (node: Rule.Node) => (VariableDeclarator & Rule.NodeParentExtension) | undefined;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export { containsOnlySupportedAttrs } from './contains-only-supported-attrs';
|
|
2
2
|
export { convertASTObjectExpressionToJSObject } from './convert-ast-object-expression-to-js-object';
|
|
3
|
+
export { findValidJsxUsageToTransform } from './find-valid-jsx-usage-to-transform';
|
|
4
|
+
export { findValidStyledComponentCall } from './find-valid-styled-component-call';
|
|
3
5
|
export { getAttributeValueIdentifier } from './get-attribute-value-identifier';
|
|
4
6
|
export { getFunctionArgumentAtPos } from './get-function-argument-at-pos';
|
|
5
7
|
export { getJSXAttributeByName } from './get-jsx-attribute-by-name';
|
|
6
8
|
export { getVariableDefinitionValue } from './get-variable-definition-value';
|
|
7
9
|
export { getVariableUsagesCount } from './get-variable-usage-count';
|
|
8
10
|
export { isFunctionNamed } from './is-function-named';
|
|
11
|
+
export { isValidCssPropertiesToTransform } from './is-valid-css-properties-to-transform';
|
|
9
12
|
export { isValidTagName } from './is-valid-tag-name';
|
|
10
13
|
export { updateJSXAttributeByName } from './update-jsx-attribute-by-name';
|
|
11
14
|
export { updateJSXElementName } from './update-jsx-element-name';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
2
|
import { JSXElement } from 'eslint-codemod-utils';
|
|
3
|
-
export declare const updateJSXElementName: (node: JSXElement, newName: string, fixer: Rule.RuleFixer) => (Rule.Fix |
|
|
3
|
+
export declare const updateJSXElementName: (node: JSXElement, newName: string, fixer: Rule.RuleFixer) => (Rule.Fix | undefined)[];
|
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.18.1",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"registry": "https://registry.npmjs.org/"
|