@atlaskit/eslint-plugin-design-system 8.23.1 → 8.23.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 (48) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/ast-nodes/function-call.js +48 -0
  3. package/dist/cjs/ast-nodes/import.js +49 -0
  4. package/dist/cjs/ast-nodes/index.js +40 -0
  5. package/dist/cjs/ast-nodes/jsx-attribute.js +64 -0
  6. package/dist/cjs/ast-nodes/jsx-element.js +55 -0
  7. package/dist/cjs/ast-nodes/root.js +34 -0
  8. package/dist/cjs/rules/use-primitives/index.js +6 -76
  9. package/dist/cjs/rules/use-primitives/transformers/emotion-css/index.js +168 -0
  10. package/dist/cjs/rules/use-primitives/transformers/emotion-css/supported.js +52 -0
  11. package/dist/cjs/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +3 -0
  12. package/dist/es2019/ast-nodes/function-call.js +42 -0
  13. package/dist/es2019/ast-nodes/import.js +42 -0
  14. package/dist/es2019/ast-nodes/index.js +5 -0
  15. package/dist/es2019/ast-nodes/jsx-attribute.js +59 -0
  16. package/dist/es2019/ast-nodes/jsx-element.js +50 -0
  17. package/dist/es2019/ast-nodes/root.js +28 -0
  18. package/dist/es2019/rules/use-primitives/index.js +9 -79
  19. package/dist/es2019/rules/use-primitives/transformers/emotion-css/index.js +159 -0
  20. package/dist/es2019/rules/use-primitives/transformers/emotion-css/supported.js +46 -0
  21. package/dist/es2019/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +3 -0
  22. package/dist/esm/ast-nodes/function-call.js +42 -0
  23. package/dist/esm/ast-nodes/import.js +43 -0
  24. package/dist/esm/ast-nodes/index.js +5 -0
  25. package/dist/esm/ast-nodes/jsx-attribute.js +59 -0
  26. package/dist/esm/ast-nodes/jsx-element.js +50 -0
  27. package/dist/esm/ast-nodes/root.js +28 -0
  28. package/dist/esm/rules/use-primitives/index.js +9 -79
  29. package/dist/esm/rules/use-primitives/transformers/emotion-css/index.js +158 -0
  30. package/dist/esm/rules/use-primitives/transformers/emotion-css/supported.js +46 -0
  31. package/dist/esm/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +3 -0
  32. package/dist/types/ast-nodes/function-call.d.ts +21 -0
  33. package/dist/types/ast-nodes/import.d.ts +16 -0
  34. package/dist/types/ast-nodes/index.d.ts +5 -0
  35. package/dist/types/ast-nodes/jsx-attribute.d.ts +26 -0
  36. package/dist/types/ast-nodes/jsx-element.d.ts +21 -0
  37. package/dist/types/ast-nodes/root.d.ts +19 -0
  38. package/dist/types/rules/use-primitives/transformers/emotion-css/index.d.ts +35 -0
  39. package/dist/types/rules/use-primitives/transformers/emotion-css/supported.d.ts +9 -0
  40. package/dist/types-ts4.5/ast-nodes/function-call.d.ts +21 -0
  41. package/dist/types-ts4.5/ast-nodes/import.d.ts +16 -0
  42. package/dist/types-ts4.5/ast-nodes/index.d.ts +5 -0
  43. package/dist/types-ts4.5/ast-nodes/jsx-attribute.d.ts +26 -0
  44. package/dist/types-ts4.5/ast-nodes/jsx-element.d.ts +21 -0
  45. package/dist/types-ts4.5/ast-nodes/root.d.ts +19 -0
  46. package/dist/types-ts4.5/rules/use-primitives/transformers/emotion-css/index.d.ts +35 -0
  47. package/dist/types-ts4.5/rules/use-primitives/transformers/emotion-css/supported.d.ts +9 -0
  48. package/package.json +1 -1
@@ -0,0 +1,19 @@
1
+ /// <reference types="node" />
2
+ import type { Rule } from 'eslint';
3
+ import { Directive, ImportDeclaration, insertImportDeclaration, ModuleDeclaration, Statement } from 'eslint-codemod-utils';
4
+ type ImportData = Parameters<typeof insertImportDeclaration>[1];
5
+ export declare const Root: {
6
+ /**
7
+ * Note: This can return multiple ImportDeclarations for cases like:
8
+ * ```
9
+ * import { Stack } from '@atlaskit/primitives'
10
+ * import type { StackProps } from '@atlaskit/primitives'
11
+ * ```
12
+ */
13
+ findImportsByModule(root: (Directive | Statement | ModuleDeclaration)[], name: string): ImportDeclaration[];
14
+ insertImport(root: (Directive | Statement | ModuleDeclaration)[], data: {
15
+ module: string;
16
+ specifiers: ImportData;
17
+ }, fixer: Rule.RuleFixer): Rule.Fix;
18
+ };
19
+ export {};
@@ -0,0 +1,35 @@
1
+ import type { Rule } from 'eslint';
2
+ import { JSXElement } from 'eslint-codemod-utils';
3
+ import { RuleConfig } from '../../config';
4
+ interface MetaData {
5
+ context: Rule.RuleContext;
6
+ config: RuleConfig;
7
+ }
8
+ type FixFunction = (fixer: Rule.RuleFixer) => Rule.Fix[];
9
+ export declare const EmotionCSS: {
10
+ lint(node: Rule.Node, { context, config }: MetaData): void;
11
+ _check(node: Rule.Node, { context, config }: MetaData): boolean;
12
+ _fix(node: JSXElement, { context }: {
13
+ context: Rule.RuleContext;
14
+ }): FixFunction;
15
+ /**
16
+ * Check that every attribute in the JSXElement is something we support.
17
+ * We do this via a whitelist in `this.attributes`. The result is we exclude
18
+ * dangerous attrs like `id` and `style`.
19
+ */
20
+ _containsOnlySupportedAttributes(node: JSXElement): boolean;
21
+ /**
22
+ * Currently this is defined here because it's not very general purpose.
23
+ * If we were to move this to `ast-nodes`, half the implementation would be in `Root`,
24
+ * and the other half would be in `Import`.
25
+ *
26
+ * TODO: Refactor and move to `ast-nodes`
27
+ *
28
+ * Note: It does not handle default imports, namespace imports, or aliased imports.
29
+ */
30
+ _upsertImportDeclaration({ module, specifiers, }: {
31
+ module: string;
32
+ specifiers: string[];
33
+ }, context: Rule.RuleContext, fixer: Rule.RuleFixer): Rule.Fix | undefined;
34
+ };
35
+ export {};
@@ -0,0 +1,9 @@
1
+ export declare const elements: string[];
2
+ export declare const attributes: string[];
3
+ declare const spaceTokenMap: {
4
+ [key: string]: string;
5
+ };
6
+ export declare const styles: {
7
+ [key: string]: typeof spaceTokenMap;
8
+ };
9
+ 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": "8.23.1",
4
+ "version": "8.23.2",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
7
7
  "registry": "https://registry.npmjs.org/"