@atlaskit/eslint-plugin-design-system 9.2.5 → 9.3.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.
Files changed (95) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +1 -0
  3. package/constellation/index/usage.mdx +1 -0
  4. package/constellation/use-heading/usage.mdx +28 -0
  5. package/dist/cjs/ast-nodes/root.js +32 -0
  6. package/dist/cjs/presets/all.codegen.js +2 -1
  7. package/dist/cjs/rules/index.codegen.js +3 -1
  8. package/dist/cjs/rules/use-heading/config/index.js +15 -0
  9. package/dist/cjs/rules/use-heading/index.js +39 -0
  10. package/dist/cjs/rules/use-heading/transformers/common.js +19 -0
  11. package/dist/cjs/rules/use-heading/transformers/index.js +12 -0
  12. package/dist/cjs/rules/use-heading/transformers/native-elements.js +99 -0
  13. package/dist/cjs/rules/use-primitives/transformers/compiled-styled/index.js +1 -2
  14. package/dist/cjs/rules/use-primitives/transformers/emotion-css/index.js +1 -2
  15. package/dist/cjs/rules/use-primitives-text/transformers/emphasis-elements.js +1 -2
  16. package/dist/cjs/rules/use-primitives-text/transformers/paragraph-elements.js +2 -3
  17. package/dist/cjs/rules/use-primitives-text/transformers/span-elements.js +1 -2
  18. package/dist/cjs/rules/use-primitives-text/transformers/strong-elements.js +1 -2
  19. package/dist/cjs/rules/use-tokens-space/transformers/style-property/index.js +1 -2
  20. package/dist/cjs/rules/utils/create-no-tagged-template-expression-rule/index.js +5 -7
  21. package/dist/cjs/rules/utils/create-rule.js +4 -7
  22. package/dist/es2019/ast-nodes/root.js +34 -0
  23. package/dist/es2019/presets/all.codegen.js +2 -1
  24. package/dist/es2019/rules/index.codegen.js +3 -1
  25. package/dist/es2019/rules/use-heading/config/index.js +9 -0
  26. package/dist/es2019/rules/use-heading/index.js +33 -0
  27. package/dist/es2019/rules/use-heading/transformers/common.js +9 -0
  28. package/dist/es2019/rules/use-heading/transformers/index.js +1 -0
  29. package/dist/es2019/rules/use-heading/transformers/native-elements.js +89 -0
  30. package/dist/es2019/rules/use-primitives/transformers/compiled-styled/index.js +1 -2
  31. package/dist/es2019/rules/use-primitives/transformers/emotion-css/index.js +1 -2
  32. package/dist/es2019/rules/use-primitives-text/transformers/emphasis-elements.js +1 -2
  33. package/dist/es2019/rules/use-primitives-text/transformers/paragraph-elements.js +2 -3
  34. package/dist/es2019/rules/use-primitives-text/transformers/span-elements.js +1 -2
  35. package/dist/es2019/rules/use-primitives-text/transformers/strong-elements.js +1 -2
  36. package/dist/es2019/rules/use-tokens-space/transformers/style-property/index.js +1 -2
  37. package/dist/es2019/rules/utils/create-no-tagged-template-expression-rule/index.js +21 -9
  38. package/dist/es2019/rules/utils/create-rule.js +4 -6
  39. package/dist/esm/ast-nodes/root.js +32 -0
  40. package/dist/esm/presets/all.codegen.js +2 -1
  41. package/dist/esm/rules/index.codegen.js +3 -1
  42. package/dist/esm/rules/use-heading/config/index.js +9 -0
  43. package/dist/esm/rules/use-heading/index.js +33 -0
  44. package/dist/esm/rules/use-heading/transformers/common.js +9 -0
  45. package/dist/esm/rules/use-heading/transformers/index.js +1 -0
  46. package/dist/esm/rules/use-heading/transformers/native-elements.js +89 -0
  47. package/dist/esm/rules/use-primitives/transformers/compiled-styled/index.js +1 -2
  48. package/dist/esm/rules/use-primitives/transformers/emotion-css/index.js +1 -2
  49. package/dist/esm/rules/use-primitives-text/transformers/emphasis-elements.js +1 -2
  50. package/dist/esm/rules/use-primitives-text/transformers/paragraph-elements.js +2 -3
  51. package/dist/esm/rules/use-primitives-text/transformers/span-elements.js +1 -2
  52. package/dist/esm/rules/use-primitives-text/transformers/strong-elements.js +1 -2
  53. package/dist/esm/rules/use-tokens-space/transformers/style-property/index.js +1 -2
  54. package/dist/esm/rules/utils/create-no-tagged-template-expression-rule/index.js +6 -8
  55. package/dist/esm/rules/utils/create-rule.js +4 -6
  56. package/dist/types/ast-nodes/jsx-element.d.ts +2 -2
  57. package/dist/types/ast-nodes/root.d.ts +8 -0
  58. package/dist/types/index.codegen.d.ts +1 -0
  59. package/dist/types/presets/all.codegen.d.ts +2 -1
  60. package/dist/types/rules/ensure-design-token-usage/rule-meta.d.ts +1 -1
  61. package/dist/types/rules/index.codegen.d.ts +1 -0
  62. package/dist/types/rules/use-heading/config/index.d.ts +6 -0
  63. package/dist/types/rules/use-heading/index.d.ts +3 -0
  64. package/dist/types/rules/use-heading/transformers/common.d.ts +9 -0
  65. package/dist/types/rules/use-heading/transformers/index.d.ts +1 -0
  66. package/dist/types/rules/use-heading/transformers/native-elements.d.ts +18 -0
  67. package/dist/types/rules/utils/create-rule.d.ts +1 -37
  68. package/dist/types-ts4.5/ast-nodes/jsx-element.d.ts +2 -2
  69. package/dist/types-ts4.5/ast-nodes/root.d.ts +8 -0
  70. package/dist/types-ts4.5/index.codegen.d.ts +1 -0
  71. package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
  72. package/dist/types-ts4.5/rules/ensure-design-token-usage/rule-meta.d.ts +1 -1
  73. package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
  74. package/dist/types-ts4.5/rules/use-heading/config/index.d.ts +6 -0
  75. package/dist/types-ts4.5/rules/use-heading/index.d.ts +3 -0
  76. package/dist/types-ts4.5/rules/use-heading/transformers/common.d.ts +9 -0
  77. package/dist/types-ts4.5/rules/use-heading/transformers/index.d.ts +1 -0
  78. package/dist/types-ts4.5/rules/use-heading/transformers/native-elements.d.ts +18 -0
  79. package/dist/types-ts4.5/rules/utils/create-rule.d.ts +1 -37
  80. package/package.json +2 -2
  81. package/dist/cjs/rules/use-primitives/transformers/compiled-styled/upsert-import-declaration.js +0 -37
  82. package/dist/cjs/rules/use-primitives/transformers/emotion-css/upsert-import-declaration.js +0 -37
  83. package/dist/cjs/rules/use-tokens-space/transformers/style-property/upsert-import-declaration.js +0 -37
  84. package/dist/es2019/rules/use-primitives/transformers/compiled-styled/upsert-import-declaration.js +0 -30
  85. package/dist/es2019/rules/use-primitives/transformers/emotion-css/upsert-import-declaration.js +0 -30
  86. package/dist/es2019/rules/use-tokens-space/transformers/style-property/upsert-import-declaration.js +0 -30
  87. package/dist/esm/rules/use-primitives/transformers/compiled-styled/upsert-import-declaration.js +0 -29
  88. package/dist/esm/rules/use-primitives/transformers/emotion-css/upsert-import-declaration.js +0 -29
  89. package/dist/esm/rules/use-tokens-space/transformers/style-property/upsert-import-declaration.js +0 -29
  90. package/dist/types/rules/use-primitives/transformers/compiled-styled/upsert-import-declaration.d.ts +0 -14
  91. package/dist/types/rules/use-primitives/transformers/emotion-css/upsert-import-declaration.d.ts +0 -14
  92. package/dist/types/rules/use-tokens-space/transformers/style-property/upsert-import-declaration.d.ts +0 -14
  93. package/dist/types-ts4.5/rules/use-primitives/transformers/compiled-styled/upsert-import-declaration.d.ts +0 -14
  94. package/dist/types-ts4.5/rules/use-primitives/transformers/emotion-css/upsert-import-declaration.d.ts +0 -14
  95. package/dist/types-ts4.5/rules/use-tokens-space/transformers/style-property/upsert-import-declaration.d.ts +0 -14
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- var _typeof = require("@babel/runtime/helpers/typeof");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.upsertImportDeclaration = void 0;
8
- var ast = _interopRequireWildcard(require("../../../../ast-nodes"));
9
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
10
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
- /**
12
- * Currently this is defined here because it's not very general purpose.
13
- * If we were to move this to `ast-nodes`, half the implementation would be in `Root`,
14
- * and the other half would be in `Import`.
15
- *
16
- * TODO: Refactor and move to `ast-nodes`
17
- *
18
- * Note: It does not handle default imports, namespace imports, or aliased imports.
19
- */
20
- var upsertImportDeclaration = exports.upsertImportDeclaration = function upsertImportDeclaration(_ref, context, fixer) {
21
- var module = _ref.module,
22
- specifiers = _ref.specifiers;
23
- // Find any imports that match the packageName
24
- var root = context.getSourceCode().ast.body;
25
- var importDeclarations = ast.Root.findImportsByModule(root, module);
26
-
27
- // The import doesn't exist yet, we can just insert a whole new one
28
- if (importDeclarations.length === 0) {
29
- return ast.Root.insertImport(root, {
30
- module: module,
31
- specifiers: specifiers
32
- }, fixer);
33
- }
34
-
35
- // The import exists so, modify the existing one
36
- return ast.Import.insertNamedSpecifiers(importDeclarations[0], specifiers, fixer);
37
- };
@@ -1,30 +0,0 @@
1
- import * as ast from '../../../../ast-nodes';
2
-
3
- /**
4
- * Currently this is defined here because it's not very general purpose.
5
- * If we were to move this to `ast-nodes`, half the implementation would be in `Root`,
6
- * and the other half would be in `Import`.
7
- *
8
- * TODO: Refactor and move to `ast-nodes`
9
- *
10
- * Note: It does not handle default imports, namespace imports, or aliased imports.
11
- */
12
- export const upsertImportDeclaration = ({
13
- module,
14
- specifiers
15
- }, context, fixer) => {
16
- // Find any imports that match the packageName
17
- const root = context.getSourceCode().ast.body;
18
- const importDeclarations = ast.Root.findImportsByModule(root, module);
19
-
20
- // The import doesn't exist yet, we can just insert a whole new one
21
- if (importDeclarations.length === 0) {
22
- return ast.Root.insertImport(root, {
23
- module,
24
- specifiers
25
- }, fixer);
26
- }
27
-
28
- // The import exists so, modify the existing one
29
- return ast.Import.insertNamedSpecifiers(importDeclarations[0], specifiers, fixer);
30
- };
@@ -1,30 +0,0 @@
1
- import * as ast from '../../../../ast-nodes';
2
-
3
- /**
4
- * Currently this is defined here because it's not very general purpose.
5
- * If we were to move this to `ast-nodes`, half the implementation would be in `Root`,
6
- * and the other half would be in `Import`.
7
- *
8
- * TODO: Refactor and move to `ast-nodes`
9
- *
10
- * Note: It does not handle default imports, namespace imports, or aliased imports.
11
- */
12
- export const upsertImportDeclaration = ({
13
- module,
14
- specifiers
15
- }, context, fixer) => {
16
- // Find any imports that match the packageName
17
- const root = context.getSourceCode().ast.body;
18
- const importDeclarations = ast.Root.findImportsByModule(root, module);
19
-
20
- // The import doesn't exist yet, we can just insert a whole new one
21
- if (importDeclarations.length === 0) {
22
- return ast.Root.insertImport(root, {
23
- module,
24
- specifiers
25
- }, fixer);
26
- }
27
-
28
- // The import exists so, modify the existing one
29
- return ast.Import.insertNamedSpecifiers(importDeclarations[0], specifiers, fixer);
30
- };
@@ -1,30 +0,0 @@
1
- import * as ast from '../../../../ast-nodes';
2
-
3
- /**
4
- * Currently this is defined here because it's not very general purpose.
5
- * If we were to move this to `ast-nodes`, half the implementation would be in `Root`,
6
- * and the other half would be in `Import`.
7
- *
8
- * TODO: Refactor and move to `ast-nodes`
9
- *
10
- * Note: It does not handle default imports, namespace imports, or aliased imports.
11
- */
12
- export const upsertImportDeclaration = ({
13
- module,
14
- specifiers
15
- }, context, fixer) => {
16
- // Find any imports that match the packageName
17
- const root = context.getSourceCode().ast.body;
18
- const importDeclarations = ast.Root.findImportsByModule(root, module);
19
-
20
- // The import doesn't exist yet, we can just insert a whole new one
21
- if (importDeclarations.length === 0) {
22
- return ast.Root.insertImport(root, {
23
- module,
24
- specifiers
25
- }, fixer);
26
- }
27
-
28
- // The import exists so, modify the existing one
29
- return ast.Import.insertNamedSpecifiers(importDeclarations[0], specifiers, fixer);
30
- };
@@ -1,29 +0,0 @@
1
- import * as ast from '../../../../ast-nodes';
2
-
3
- /**
4
- * Currently this is defined here because it's not very general purpose.
5
- * If we were to move this to `ast-nodes`, half the implementation would be in `Root`,
6
- * and the other half would be in `Import`.
7
- *
8
- * TODO: Refactor and move to `ast-nodes`
9
- *
10
- * Note: It does not handle default imports, namespace imports, or aliased imports.
11
- */
12
- export var upsertImportDeclaration = function upsertImportDeclaration(_ref, context, fixer) {
13
- var module = _ref.module,
14
- specifiers = _ref.specifiers;
15
- // Find any imports that match the packageName
16
- var root = context.getSourceCode().ast.body;
17
- var importDeclarations = ast.Root.findImportsByModule(root, module);
18
-
19
- // The import doesn't exist yet, we can just insert a whole new one
20
- if (importDeclarations.length === 0) {
21
- return ast.Root.insertImport(root, {
22
- module: module,
23
- specifiers: specifiers
24
- }, fixer);
25
- }
26
-
27
- // The import exists so, modify the existing one
28
- return ast.Import.insertNamedSpecifiers(importDeclarations[0], specifiers, fixer);
29
- };
@@ -1,29 +0,0 @@
1
- import * as ast from '../../../../ast-nodes';
2
-
3
- /**
4
- * Currently this is defined here because it's not very general purpose.
5
- * If we were to move this to `ast-nodes`, half the implementation would be in `Root`,
6
- * and the other half would be in `Import`.
7
- *
8
- * TODO: Refactor and move to `ast-nodes`
9
- *
10
- * Note: It does not handle default imports, namespace imports, or aliased imports.
11
- */
12
- export var upsertImportDeclaration = function upsertImportDeclaration(_ref, context, fixer) {
13
- var module = _ref.module,
14
- specifiers = _ref.specifiers;
15
- // Find any imports that match the packageName
16
- var root = context.getSourceCode().ast.body;
17
- var importDeclarations = ast.Root.findImportsByModule(root, module);
18
-
19
- // The import doesn't exist yet, we can just insert a whole new one
20
- if (importDeclarations.length === 0) {
21
- return ast.Root.insertImport(root, {
22
- module: module,
23
- specifiers: specifiers
24
- }, fixer);
25
- }
26
-
27
- // The import exists so, modify the existing one
28
- return ast.Import.insertNamedSpecifiers(importDeclarations[0], specifiers, fixer);
29
- };
@@ -1,29 +0,0 @@
1
- import * as ast from '../../../../ast-nodes';
2
-
3
- /**
4
- * Currently this is defined here because it's not very general purpose.
5
- * If we were to move this to `ast-nodes`, half the implementation would be in `Root`,
6
- * and the other half would be in `Import`.
7
- *
8
- * TODO: Refactor and move to `ast-nodes`
9
- *
10
- * Note: It does not handle default imports, namespace imports, or aliased imports.
11
- */
12
- export var upsertImportDeclaration = function upsertImportDeclaration(_ref, context, fixer) {
13
- var module = _ref.module,
14
- specifiers = _ref.specifiers;
15
- // Find any imports that match the packageName
16
- var root = context.getSourceCode().ast.body;
17
- var importDeclarations = ast.Root.findImportsByModule(root, module);
18
-
19
- // The import doesn't exist yet, we can just insert a whole new one
20
- if (importDeclarations.length === 0) {
21
- return ast.Root.insertImport(root, {
22
- module: module,
23
- specifiers: specifiers
24
- }, fixer);
25
- }
26
-
27
- // The import exists so, modify the existing one
28
- return ast.Import.insertNamedSpecifiers(importDeclarations[0], specifiers, fixer);
29
- };
@@ -1,14 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- /**
3
- * Currently this is defined here because it's not very general purpose.
4
- * If we were to move this to `ast-nodes`, half the implementation would be in `Root`,
5
- * and the other half would be in `Import`.
6
- *
7
- * TODO: Refactor and move to `ast-nodes`
8
- *
9
- * Note: It does not handle default imports, namespace imports, or aliased imports.
10
- */
11
- export declare const upsertImportDeclaration: ({ module, specifiers, }: {
12
- module: string;
13
- specifiers: string[];
14
- }, context: Rule.RuleContext, fixer: Rule.RuleFixer) => Rule.Fix | undefined;
@@ -1,14 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- /**
3
- * Currently this is defined here because it's not very general purpose.
4
- * If we were to move this to `ast-nodes`, half the implementation would be in `Root`,
5
- * and the other half would be in `Import`.
6
- *
7
- * TODO: Refactor and move to `ast-nodes`
8
- *
9
- * Note: It does not handle default imports, namespace imports, or aliased imports.
10
- */
11
- export declare const upsertImportDeclaration: ({ module, specifiers, }: {
12
- module: string;
13
- specifiers: string[];
14
- }, context: Rule.RuleContext, fixer: Rule.RuleFixer) => Rule.Fix | undefined;
@@ -1,14 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- /**
3
- * Currently this is defined here because it's not very general purpose.
4
- * If we were to move this to `ast-nodes`, half the implementation would be in `Root`,
5
- * and the other half would be in `Import`.
6
- *
7
- * TODO: Refactor and move to `ast-nodes`
8
- *
9
- * Note: It does not handle default imports, namespace imports, or aliased imports.
10
- */
11
- export declare const upsertImportDeclaration: ({ module, specifiers, }: {
12
- module: string;
13
- specifiers: string[];
14
- }, context: Rule.RuleContext, fixer: Rule.RuleFixer) => Rule.Fix | undefined;
@@ -1,14 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- /**
3
- * Currently this is defined here because it's not very general purpose.
4
- * If we were to move this to `ast-nodes`, half the implementation would be in `Root`,
5
- * and the other half would be in `Import`.
6
- *
7
- * TODO: Refactor and move to `ast-nodes`
8
- *
9
- * Note: It does not handle default imports, namespace imports, or aliased imports.
10
- */
11
- export declare const upsertImportDeclaration: ({ module, specifiers, }: {
12
- module: string;
13
- specifiers: string[];
14
- }, context: Rule.RuleContext, fixer: Rule.RuleFixer) => Rule.Fix | undefined;
@@ -1,14 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- /**
3
- * Currently this is defined here because it's not very general purpose.
4
- * If we were to move this to `ast-nodes`, half the implementation would be in `Root`,
5
- * and the other half would be in `Import`.
6
- *
7
- * TODO: Refactor and move to `ast-nodes`
8
- *
9
- * Note: It does not handle default imports, namespace imports, or aliased imports.
10
- */
11
- export declare const upsertImportDeclaration: ({ module, specifiers, }: {
12
- module: string;
13
- specifiers: string[];
14
- }, context: Rule.RuleContext, fixer: Rule.RuleFixer) => Rule.Fix | undefined;
@@ -1,14 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- /**
3
- * Currently this is defined here because it's not very general purpose.
4
- * If we were to move this to `ast-nodes`, half the implementation would be in `Root`,
5
- * and the other half would be in `Import`.
6
- *
7
- * TODO: Refactor and move to `ast-nodes`
8
- *
9
- * Note: It does not handle default imports, namespace imports, or aliased imports.
10
- */
11
- export declare const upsertImportDeclaration: ({ module, specifiers, }: {
12
- module: string;
13
- specifiers: string[];
14
- }, context: Rule.RuleContext, fixer: Rule.RuleFixer) => Rule.Fix | undefined;