@atlaskit/eslint-plugin-design-system 5.3.1 → 5.3.2

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/version.json +1 -1
  3. package/dist/es2019/version.json +1 -1
  4. package/dist/esm/version.json +1 -1
  5. package/dist/types-ts4.5/index.codegen.d.ts +32 -0
  6. package/dist/types-ts4.5/index.d.ts +2 -0
  7. package/dist/types-ts4.5/presets/all.codegen.d.ts +22 -0
  8. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +19 -0
  9. package/dist/types-ts4.5/rules/ensure-design-token-usage/index.d.ts +3 -0
  10. package/dist/types-ts4.5/rules/ensure-design-token-usage-spacing/index.d.ts +9 -0
  11. package/dist/types-ts4.5/rules/ensure-design-token-usage-spacing/utils.d.ts +166 -0
  12. package/dist/types-ts4.5/rules/icon-label/index.d.ts +2 -0
  13. package/dist/types-ts4.5/rules/index.codegen.d.ts +27 -0
  14. package/dist/types-ts4.5/rules/no-banned-imports/index.d.ts +2 -0
  15. package/dist/types-ts4.5/rules/no-banned-imports/paths.d.ts +4 -0
  16. package/dist/types-ts4.5/rules/no-deprecated-apis/helpers/filter-actionable-deprecations.d.ts +1 -0
  17. package/dist/types-ts4.5/rules/no-deprecated-apis/helpers/validate-deprecated-apis-config.d.ts +2 -0
  18. package/dist/types-ts4.5/rules/no-deprecated-apis/index.d.ts +10 -0
  19. package/dist/types-ts4.5/rules/no-deprecated-design-token-usage/index.d.ts +3 -0
  20. package/dist/types-ts4.5/rules/no-deprecated-imports/index.d.ts +37 -0
  21. package/dist/types-ts4.5/rules/no-margin/index.d.ts +3 -0
  22. package/dist/types-ts4.5/rules/no-unsafe-design-token-usage/index.d.ts +3 -0
  23. package/dist/types-ts4.5/rules/use-primitives/index.d.ts +2 -0
  24. package/dist/types-ts4.5/rules/use-primitives/types.d.ts +3 -0
  25. package/dist/types-ts4.5/rules/use-primitives/utils.d.ts +7 -0
  26. package/dist/types-ts4.5/rules/use-visually-hidden/constants.d.ts +3 -0
  27. package/dist/types-ts4.5/rules/use-visually-hidden/fix-jsx.d.ts +3 -0
  28. package/dist/types-ts4.5/rules/use-visually-hidden/fix-vanilla.d.ts +3 -0
  29. package/dist/types-ts4.5/rules/use-visually-hidden/index.d.ts +3 -0
  30. package/dist/types-ts4.5/rules/use-visually-hidden/utils.d.ts +35 -0
  31. package/dist/types-ts4.5/rules/utils/create-rule.d.ts +48 -0
  32. package/dist/types-ts4.5/rules/utils/get-deprecated-config.d.ts +2 -0
  33. package/dist/types-ts4.5/rules/utils/get-import-node-by-source.d.ts +8 -0
  34. package/dist/types-ts4.5/rules/utils/get-is-exception.d.ts +2 -0
  35. package/dist/types-ts4.5/rules/utils/is-color.d.ts +5 -0
  36. package/dist/types-ts4.5/rules/utils/is-elevation.d.ts +5 -0
  37. package/dist/types-ts4.5/rules/utils/is-node.d.ts +10 -0
  38. package/dist/types-ts4.5/rules/utils/is-token.d.ts +1 -0
  39. package/dist/types-ts4.5/rules/utils/jsx.d.ts +2 -0
  40. package/dist/types-ts4.5/rules/utils/types.d.ts +22 -0
  41. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/eslint-plugin-design-system
2
2
 
3
+ ## 5.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
8
+
3
9
  ## 5.3.1
4
10
 
5
11
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/eslint-plugin-design-system",
3
- "version": "5.3.1",
3
+ "version": "5.3.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/eslint-plugin-design-system",
3
- "version": "5.3.1",
3
+ "version": "5.3.2",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/eslint-plugin-design-system",
3
- "version": "5.3.1",
3
+ "version": "5.3.2",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,32 @@
1
+ export { default as rules } from './rules/index.codegen';
2
+ export declare const configs: {
3
+ all: {
4
+ plugins: string[];
5
+ rules: {
6
+ '@atlaskit/design-system/ensure-design-token-usage': string;
7
+ '@atlaskit/design-system/ensure-design-token-usage-spacing': string;
8
+ '@atlaskit/design-system/icon-label': string;
9
+ '@atlaskit/design-system/no-banned-imports': string;
10
+ '@atlaskit/design-system/no-deprecated-apis': string;
11
+ '@atlaskit/design-system/no-deprecated-design-token-usage': string;
12
+ '@atlaskit/design-system/no-deprecated-imports': string;
13
+ '@atlaskit/design-system/no-margin': string;
14
+ '@atlaskit/design-system/no-unsafe-design-token-usage': string;
15
+ '@atlaskit/design-system/use-primitives': string;
16
+ '@atlaskit/design-system/use-visually-hidden': string;
17
+ };
18
+ };
19
+ recommended: {
20
+ plugins: string[];
21
+ rules: {
22
+ '@atlaskit/design-system/ensure-design-token-usage': string;
23
+ '@atlaskit/design-system/icon-label': string;
24
+ '@atlaskit/design-system/no-banned-imports': string;
25
+ '@atlaskit/design-system/no-deprecated-apis': string;
26
+ '@atlaskit/design-system/no-deprecated-design-token-usage': string;
27
+ '@atlaskit/design-system/no-deprecated-imports': string;
28
+ '@atlaskit/design-system/no-unsafe-design-token-usage': string;
29
+ '@atlaskit/design-system/use-visually-hidden': string;
30
+ };
31
+ };
32
+ };
@@ -0,0 +1,2 @@
1
+ export { configs, rules } from './index.codegen';
2
+ export { filterActionableDeprecations } from './rules/no-deprecated-apis/helpers/filter-actionable-deprecations';
@@ -0,0 +1,22 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ * @codegen <<SignedSource::3f9b973d6350522de7bd32f13c58ce56>>
4
+ * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
+ */
6
+ declare const _default: {
7
+ plugins: string[];
8
+ rules: {
9
+ '@atlaskit/design-system/ensure-design-token-usage': string;
10
+ '@atlaskit/design-system/ensure-design-token-usage-spacing': string;
11
+ '@atlaskit/design-system/icon-label': string;
12
+ '@atlaskit/design-system/no-banned-imports': string;
13
+ '@atlaskit/design-system/no-deprecated-apis': string;
14
+ '@atlaskit/design-system/no-deprecated-design-token-usage': string;
15
+ '@atlaskit/design-system/no-deprecated-imports': string;
16
+ '@atlaskit/design-system/no-margin': string;
17
+ '@atlaskit/design-system/no-unsafe-design-token-usage': string;
18
+ '@atlaskit/design-system/use-primitives': string;
19
+ '@atlaskit/design-system/use-visually-hidden': string;
20
+ };
21
+ };
22
+ export default _default;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ * @codegen <<SignedSource::b3d2f24d8d37a87fc2bbd964dfdcb87c>>
4
+ * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
+ */
6
+ declare const _default: {
7
+ plugins: string[];
8
+ rules: {
9
+ '@atlaskit/design-system/ensure-design-token-usage': string;
10
+ '@atlaskit/design-system/icon-label': string;
11
+ '@atlaskit/design-system/no-banned-imports': string;
12
+ '@atlaskit/design-system/no-deprecated-apis': string;
13
+ '@atlaskit/design-system/no-deprecated-design-token-usage': string;
14
+ '@atlaskit/design-system/no-deprecated-imports': string;
15
+ '@atlaskit/design-system/no-unsafe-design-token-usage': string;
16
+ '@atlaskit/design-system/use-visually-hidden': string;
17
+ };
18
+ };
19
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ declare const rule: Rule.RuleModule;
3
+ export default rule;
@@ -0,0 +1,9 @@
1
+ type Addon = 'spacing' | 'typography' | 'shape';
2
+ type RuleConfig = {
3
+ addons: Addon[];
4
+ applyImport?: boolean;
5
+ };
6
+ declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noRawSpacingValues" | "autofixesPossible", [
7
+ RuleConfig
8
+ ], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
9
+ export default rule;
@@ -0,0 +1,166 @@
1
+ import type { Rule, Scope } from 'eslint';
2
+ import { EslintNode, TaggedTemplateExpression } from 'eslint-codemod-utils';
3
+ export type ProcessedCSSLines = [
4
+ string,
5
+ string
6
+ ][];
7
+ export type TargetOptions = ('spacing' | 'typography' | 'shape')[];
8
+ /**
9
+ * Currently we have a wide range of experimental spacing tokens that we are testing.
10
+ * We only want transforms to apply to the stable scale values, not the rest.
11
+ * This could be removed in the future.
12
+ */
13
+ export declare const onlyScaleTokens: ({
14
+ attributes: {
15
+ group: string;
16
+ state: string;
17
+ introduced: string;
18
+ pixelValue: string;
19
+ description: string;
20
+ suggest?: undefined;
21
+ };
22
+ value: string;
23
+ filePath: string;
24
+ isSource: boolean;
25
+ original: {
26
+ attributes: {
27
+ group: string;
28
+ state: string;
29
+ introduced: string;
30
+ pixelValue: string;
31
+ description: string;
32
+ suggest?: undefined;
33
+ };
34
+ value: string;
35
+ };
36
+ name: string;
37
+ path: string[];
38
+ cleanName: string;
39
+ } | {
40
+ attributes: {
41
+ group: string;
42
+ state: string;
43
+ suggest: string[];
44
+ introduced: string;
45
+ pixelValue: string;
46
+ description: string;
47
+ };
48
+ value: string;
49
+ filePath: string;
50
+ isSource: boolean;
51
+ original: {
52
+ attributes: {
53
+ group: string;
54
+ state: string;
55
+ suggest: string[];
56
+ introduced: string;
57
+ pixelValue: string;
58
+ description: string;
59
+ };
60
+ value: string;
61
+ };
62
+ name: string;
63
+ path: string[];
64
+ cleanName: string;
65
+ })[];
66
+ export declare const spacingValueToToken: {
67
+ [k: string]: string;
68
+ };
69
+ export declare const typographyValueToToken: {
70
+ [k: string]: any;
71
+ };
72
+ export declare function findIdentifierInParentScope({ scope, identifierName, }: {
73
+ scope: Scope.Scope;
74
+ identifierName: string;
75
+ }): Scope.Variable | null;
76
+ export declare function insertTokensImport(fixer: Rule.RuleFixer): Rule.Fix;
77
+ export declare const isSpacingProperty: (propertyName: string) => boolean;
78
+ export declare const isTypographyProperty: (propertyName: string) => boolean;
79
+ /**
80
+ * Accomplishes split str by whitespace but preserves expressions in between ${...}
81
+ * even if they might have whitepaces or nested brackets
82
+ * @param str
83
+ * @returns string[]
84
+ * @example
85
+ * Regex has two parts, first attempts to capture anything in between `${...}` in a capture group
86
+ * Whilst allowing nested brackets and non empty characters leading or traling wrapping expression e.g `${gridSize}`, `-${gridSize}px`
87
+ * second part is a white space delimiter
88
+ * For input `-${gridSize / 2}px ${token(...)} 18px -> [`-${gridSize / 2}px`, `${token(...)}`, `18px`]
89
+ */
90
+ export declare const splitShorthandValues: (str: string) => string[];
91
+ export declare const getValueFromShorthand: (str: unknown) => any[];
92
+ export declare const getValue: (node: EslintNode, context: Rule.RuleContext) => string | number | any[] | null | undefined;
93
+ export declare const getRawExpression: (node: EslintNode, context: Rule.RuleContext) => string | null;
94
+ export declare const emToPixels: <T extends unknown>(value: T, fontSize: number | null | undefined) => number | T | null;
95
+ export declare const removePixelSuffix: (value: string | number) => string | number;
96
+ export declare const isValidSpacingValue: (value: string | number | boolean | RegExp | null | undefined | any[] | bigint, fontSize?: number | null | undefined) => boolean;
97
+ export declare const isCalc: (value: string | number | boolean | RegExp | null | undefined | any[] | bigint) => boolean;
98
+ export declare const isZero: (value: string | number | boolean | RegExp | null | undefined | any[] | bigint) => boolean;
99
+ export declare const isAuto: (value: string | number | boolean | RegExp | null | undefined | any[] | bigint) => boolean;
100
+ export declare const convertHyphenatedNameToCamelCase: (prop: string) => string;
101
+ /**
102
+ * @param node
103
+ * @returns The furthest parent node that is on the same line as the input node
104
+ */
105
+ export declare const findParentNodeForLine: (node: Rule.Node) => Rule.Node;
106
+ /**
107
+ * Returns a boolean that signals wether the current property is revelant under the current configuration
108
+ * @param propertyName camelCase CSS property
109
+ * @param targetOptions Array containing the types of properties that should be included in the rule
110
+ * @example
111
+ * ```
112
+ * propertyName: padding, targetOptions: ['spacing']
113
+ * propertyName: fontWeight, targetOptions: ['spacing', 'typography']
114
+ * ```
115
+ */
116
+ export declare function shouldAnalyzeProperty(propertyName: string, targetOptions: TargetOptions): boolean;
117
+ /**
118
+ * Function that removes JS comments from a string of code,
119
+ * sometimes makers will have single or multiline comments in their tagged template literals styles, this can mess with our parsing logic
120
+ */
121
+ export declare function cleanComments(str: string): string;
122
+ /**
123
+ * Returns an array of tuples representing a processed css within `TaggedTemplateExpression` node.
124
+ * each element of the array is a tuple `[string, string]`,
125
+ * where the first element is the processed css line with computed values
126
+ * and the second element of the tuple is the original css line from source
127
+ * @param node TaggedTemplateExpression node
128
+ * @param context Rule.RuleContext
129
+ * @example
130
+ * ```
131
+ * `[['padding: 8', 'padding: ${gridSize()}'], ['margin: 6', 'margin: 6px' ]]`
132
+ * ```
133
+ */
134
+ export declare function processCssNode(node: TaggedTemplateExpression & Rule.NodeParentExtension, context: Rule.RuleContext): ProcessedCSSLines | undefined;
135
+ /**
136
+ * Returns a token node for a given value including fallbacks.
137
+ * @param propertyName camelCase CSS property
138
+ * @param value string representing pixel value, or font family, or number representing font weight
139
+ * @example
140
+ * ```
141
+ * propertyName: padding, value: '8px' => token('space.100', '8px')
142
+ * propertyName: fontWeight, value: 400 => token('font.weight.regular', '400')
143
+ * ```
144
+ */
145
+ export declare function getTokenNodeForValue(propertyName: string, value: string): import("eslint-codemod-utils").StringableASTNode<import("estree").SimpleCallExpression>;
146
+ export declare function getFontSizeValueInScope(cssProperties: ProcessedCSSLines): number | undefined;
147
+ /**
148
+ * Attempts to remove all non-essential words & characters from a style block.
149
+ * Including selectors and queries
150
+ * Adapted from ensure-design-token-usage
151
+ * @param styleString string of css properties
152
+ */
153
+ export declare function splitCssProperties(styleString: string): string[];
154
+ /**
155
+ * returns wether the current string is a token value
156
+ * @param originalVaue string representing a css property value e.g 1em, 12px
157
+ */
158
+ export declare function isTokenValueString(originalValue: string): boolean;
159
+ export declare function findTokenNameByPropertyValue(propertyName: string, value: string): string | undefined;
160
+ /**
161
+ * Returns a string with token expression corresponding to input parameters
162
+ * if no token found for the pair the function returns undefined
163
+ * @param propertyName string camelCased css property
164
+ * @param value the computed value e.g '8px' -> '8'
165
+ */
166
+ export declare function getTokenReplacement(propertyName: string, value: string): string | undefined;
@@ -0,0 +1,2 @@
1
+ declare const rule: import("eslint").Rule.RuleModule;
2
+ export default rule;
@@ -0,0 +1,27 @@
1
+ declare const _default: {
2
+ 'ensure-design-token-usage': import("eslint").Rule.RuleModule;
3
+ 'ensure-design-token-usage-spacing': import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noRawSpacingValues" | "autofixesPossible", [
4
+ {
5
+ addons: ("spacing" | "typography" | "shape")[];
6
+ applyImport?: boolean | undefined;
7
+ }
8
+ ], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
9
+ 'icon-label': import("eslint").Rule.RuleModule;
10
+ 'no-banned-imports': import("eslint").Rule.RuleModule;
11
+ 'no-deprecated-apis': import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<string, [
12
+ {
13
+ deprecatedConfig: import("./utils/types").DeprecatedConfig;
14
+ }
15
+ ], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
16
+ 'no-deprecated-design-token-usage': import("eslint").Rule.RuleModule;
17
+ 'no-deprecated-imports': import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<string, [
18
+ {
19
+ deprecatedConfig: import("./utils/types").DeprecatedConfig;
20
+ }
21
+ ], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
22
+ 'no-margin': import("eslint").Rule.RuleModule;
23
+ 'no-unsafe-design-token-usage': import("eslint").Rule.RuleModule;
24
+ 'use-primitives': import("eslint").Rule.RuleModule;
25
+ 'use-visually-hidden': import("eslint").Rule.RuleModule;
26
+ };
27
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const rule: import("eslint").Rule.RuleModule;
2
+ export default rule;
@@ -0,0 +1,4 @@
1
+ export declare const restrictedPaths: {
2
+ path: string;
3
+ message: string;
4
+ }[];
@@ -0,0 +1 @@
1
+ export declare const filterActionableDeprecations: (originalDeprecatedConfig: string, rootPackageJson: string) => string;
@@ -0,0 +1,2 @@
1
+ import type { DeprecatedJSXAttributeConfig } from '../../../../src/rules/utils/types';
2
+ export declare const getValidatedConfig: (originalDeprecatedConfig: string) => DeprecatedJSXAttributeConfig;
@@ -0,0 +1,10 @@
1
+ import { TSESLint } from '@typescript-eslint/utils';
2
+ import { DeprecatedConfig } from '../utils/types';
3
+ export declare const noDeprecatedJSXAttributeMessageId = "noDeprecatedJSXAttributes";
4
+ export declare const name = "no-deprecated-apis";
5
+ declare const rule: TSESLint.RuleModule<string, [
6
+ {
7
+ deprecatedConfig: DeprecatedConfig;
8
+ }
9
+ ], TSESLint.RuleListener>;
10
+ export default rule;
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ declare const rule: Rule.RuleModule;
3
+ export default rule;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Forked from original `no-restricted-imports` although the source has been substantially changed.
3
+ *
4
+ * To ensure compliance the license from eslint has been included and the original attribution.
5
+ * @author Guy Ellis
6
+ *
7
+ * Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ * of this software and associated documentation files (the "Software"), to deal
11
+ * in the Software without restriction, including without limitation the rights
12
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ * copies of the Software, and to permit persons to whom the Software is
14
+ * furnished to do so, subject to the following conditions:
15
+ *
16
+ * The above copyright notice and this permission notice shall be included in
17
+ * all copies or substantial portions of the Software.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ * THE SOFTWARE.
26
+ */
27
+ import { TSESLint } from '@typescript-eslint/utils';
28
+ import { DeprecatedConfig } from '../utils/types';
29
+ export declare const name = "no-deprecated-imports";
30
+ export declare const importNameWithCustomMessageId = "importNameWithCustomMessage";
31
+ export declare const pathWithCustomMessageId = "pathWithCustomMessage";
32
+ declare const rule: TSESLint.RuleModule<string, [
33
+ {
34
+ deprecatedConfig: DeprecatedConfig;
35
+ }
36
+ ], TSESLint.RuleListener>;
37
+ export default rule;
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ declare const rule: Rule.RuleModule;
3
+ export default rule;
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ declare const rule: Rule.RuleModule;
3
+ export default rule;
@@ -0,0 +1,2 @@
1
+ declare const rule: import("eslint").Rule.RuleModule;
2
+ export default rule;
@@ -0,0 +1,3 @@
1
+ export type Configuration = {
2
+ exclude?: string | string[];
3
+ };
@@ -0,0 +1,7 @@
1
+ import type { Rule, Scope } from 'eslint';
2
+ import { EslintNode, JSXElement } from 'eslint-codemod-utils';
3
+ export declare const shouldSuggestBox: (node: JSXElement) => boolean;
4
+ export declare const shouldSuggestInline: (node: JSXElement, context: Rule.RuleContext) => boolean;
5
+ export declare const shouldSuggestStack: (node: JSXElement, context: Rule.RuleContext) => boolean;
6
+ export declare const shouldSuggestText: (node: JSXElement | undefined, scope: Scope.Scope) => boolean;
7
+ export declare const primitiveFixer: (node: EslintNode, nodeName: string, context: Rule.RuleContext) => (fixer: Rule.RuleFixer) => Rule.Fix[];
@@ -0,0 +1,3 @@
1
+ export declare const IMPORT_NAME = "AKVisuallyHidden";
2
+ export declare const VISUALLY_HIDDEN_SOURCE = "@atlaskit/visually-hidden";
3
+ export declare const VISUALLY_HIDDEN_IMPORT: string;
@@ -0,0 +1,3 @@
1
+ import type { Rule, SourceCode } from 'eslint';
2
+ declare const _default: (source: SourceCode, node: Rule.Node) => (fixer: Rule.RuleFixer) => Rule.Fix[];
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { Rule, SourceCode } from 'eslint';
2
+ declare const _default: (source: SourceCode, node: Rule.Node) => (fixer: Rule.RuleFixer) => Rule.Fix[];
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ declare const rule: Rule.RuleModule;
3
+ export default rule;
@@ -0,0 +1,35 @@
1
+ import type { SourceCode } from 'eslint';
2
+ import { ObjectExpression } from 'eslint-codemod-utils';
3
+ declare const referenceObject: {
4
+ width: string;
5
+ height: string;
6
+ padding: string;
7
+ position: string;
8
+ border: string;
9
+ clip: string;
10
+ overflow: string;
11
+ whiteSpace: string;
12
+ };
13
+ type KeyValue = {
14
+ key: string;
15
+ value: string;
16
+ };
17
+ export type ReferenceObject = typeof referenceObject;
18
+ /**
19
+ * Returns the first import in the esprima AST.
20
+ */
21
+ export declare const getFirstImport: (source: SourceCode) => import("estree").ModuleDeclaration | import("estree").Statement | import("estree").Directive | undefined;
22
+ /**
23
+ * Takes a template literal and returns [key, value] array of the css properties
24
+ */
25
+ export declare const makeTemplateLiteralIntoEntries: (templateString: string) => string[][];
26
+ /**
27
+ * Given a node, translate the node into css key-value pairs and
28
+ * compare the output to the reference styles required to make a
29
+ * visually hidden element.
30
+ *
31
+ * @returns {number} A fraction between 0-1 depending on the object's likeness.
32
+ */
33
+ export declare const getObjectLikeness: (node: ObjectExpression) => number;
34
+ export declare const countMatchingKeyValues: (styleEntries: KeyValue[]) => number;
35
+ export {};
@@ -0,0 +1,48 @@
1
+ import { ESLintUtils } from '@typescript-eslint/utils';
2
+ import type { Rule } from 'eslint';
3
+ /**
4
+ * We are moving to our own small abstraction to create a lint rule that we have the power
5
+ * to change and mold to our own needs.
6
+ *
7
+ * @see createLintRule
8
+ *
9
+ * @private
10
+ * @deprecated
11
+ */
12
+ export declare const createRule: <TOptions extends readonly unknown[], TMessageIds extends string, TRuleListener extends import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener = import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>({ name, meta, ...rule }: Readonly<ESLintUtils.RuleWithMetaAndName<TOptions, TMessageIds, TRuleListener>>) => import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<TMessageIds, TOptions, TRuleListener>;
13
+ export interface LintRule extends Omit<Rule.RuleModule, 'meta'> {
14
+ /**
15
+ * Including this for backwards compat moving from the typescript-eslint util.
16
+ */
17
+ name?: never;
18
+ meta: LintRuleMeta;
19
+ }
20
+ export interface LintRuleMeta extends Omit<Rule.RuleMetaData, 'docs'> {
21
+ /**
22
+ * Name of the rule.
23
+ * Must match the folder it is in exactly else build will throw.
24
+ */
25
+ name: string;
26
+ docs: {
27
+ /**
28
+ * Short description of what this rule does.
29
+ */
30
+ description: string;
31
+ /**
32
+ * If this rule should be in the recommended preset or not.
33
+ * Set to `false` to exclude it from the recommended preset.
34
+ */
35
+ recommended: boolean;
36
+ /**
37
+ * The severity level to be applied to this rule.
38
+ * When setting to `"error"` it will mean releasing a breaking change.
39
+ */
40
+ severity: 'error' | 'warn';
41
+ };
42
+ }
43
+ /**
44
+ * Tiny wrapped over the ESLint rule module type that ensures
45
+ * there is a docs link to our ESLint plugin documentation page,
46
+ * as well as improving type support.
47
+ */
48
+ export declare const createLintRule: (rule: LintRule) => Rule.RuleModule;
@@ -0,0 +1,2 @@
1
+ import type { DeprecatedCategories, DeprecatedConfig } from './types';
2
+ export declare const getConfig: (specifier: DeprecatedCategories) => DeprecatedConfig;
@@ -0,0 +1,8 @@
1
+ import type { SourceCode } from 'eslint';
2
+ import type { ImportDeclaration } from 'eslint-codemod-utils';
3
+ /**
4
+ * @param {SourceCode} source The eslint source
5
+ * @param {string} path The path specified to find
6
+ * @returns {ImportDeclaration}
7
+ */
8
+ export declare const getImportedNodeBySource: (source: SourceCode, path: string) => ImportDeclaration | undefined;
@@ -0,0 +1,2 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const getIsException: (exceptions?: string[]) => (node: Rule.Node) => boolean;
@@ -0,0 +1,5 @@
1
+ export declare const isLegacyColor: (value: string) => boolean;
2
+ export declare const isLegacyNamedColor: (value: string) => boolean;
3
+ export declare const includesHardCodedColor: (raw: string) => boolean;
4
+ export declare const isHardCodedColor: (value: string) => boolean;
5
+ export declare const isColorCssPropertyName: (value: string) => boolean;
@@ -0,0 +1,5 @@
1
+ import tokens from '@atlaskit/tokens/token-names';
2
+ export declare const isLegacyElevation: (name: string) => false | {
3
+ background: keyof typeof tokens;
4
+ shadow: keyof typeof tokens;
5
+ };
@@ -0,0 +1,10 @@
1
+ import type { Rule } from 'eslint';
2
+ import { CallExpression, EslintNode, Expression, TaggedTemplateExpression } from 'eslint-codemod-utils';
3
+ export declare const isDecendantOfGlobalToken: (node: EslintNode) => boolean;
4
+ export declare const isDecendantOfType: (node: Rule.Node, type: Rule.Node['type'], skipNode?: boolean) => boolean;
5
+ export declare const isPropertyKey: (node: Rule.Node) => boolean;
6
+ export declare const isDecendantOfStyleJsxAttribute: (node: Rule.Node) => boolean;
7
+ export declare const isStyledTemplateNode: (node?: Expression | null) => node is TaggedTemplateExpression;
8
+ export declare const isStyledObjectNode: (node?: Expression | null) => node is CallExpression;
9
+ export declare const isDecendantOfStyleBlock: (node: Rule.Node) => boolean;
10
+ export declare const isChildOfType: (node: Rule.Node, type: Rule.Node['type']) => boolean;
@@ -0,0 +1 @@
1
+ export declare const isToken: (value: string, tokens: Record<string, string>) => string | undefined;
@@ -0,0 +1,2 @@
1
+ import type { JSXAttribute, JSXElement } from 'eslint-codemod-utils';
2
+ export declare function findProp(jsx: JSXElement, propName: string): JSXAttribute | undefined;
@@ -0,0 +1,22 @@
1
+ export type DeprecatedCategories = 'jsxAttributes' | 'imports';
2
+ export type DeprecatedConfig = DeprecatedJSXAttributeConfig | DeprecatedImportConfig;
3
+ export type DeprecatedJSXAttributeConfig = {
4
+ [key: string]: DeprecatedJSXAttributeConfigEntry[];
5
+ };
6
+ export type DeprecatedJSXAttributeConfigEntry = {
7
+ moduleSpecifier: string;
8
+ namedSpecifiers?: string[];
9
+ actionableVersion?: string;
10
+ };
11
+ export type DeprecatedImportConfig = {
12
+ [key: string]: DeprecatedImportConfigEntry;
13
+ };
14
+ export type DeprecatedImportConfigEntry = {
15
+ message?: string;
16
+ importSpecifiers?: {
17
+ importName: string;
18
+ message: string;
19
+ }[];
20
+ };
21
+ export declare const isDeprecatedImportConfig: (config: DeprecatedImportConfig | DeprecatedJSXAttributeConfig) => config is DeprecatedImportConfig;
22
+ export declare const isDeprecatedJSXAttributeConfig: (config: DeprecatedImportConfig | DeprecatedJSXAttributeConfig) => config is DeprecatedJSXAttributeConfig;
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": "5.3.1",
4
+ "version": "5.3.2",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
7
7
  "registry": "https://registry.npmjs.org/"