@atlaskit/eslint-plugin-design-system 11.8.4 → 11.9.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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/eslint-plugin-design-system
2
2
 
3
+ ## 11.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#108380](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/108380)
8
+ [`14e491279e7ae`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/14e491279e7ae) -
9
+ Fix `ensure-design-token-usage` to allow tokens for all Primitives, not just the root
10
+ `@atlaskit/primitives` entrypoint.
11
+
3
12
  ## 11.8.4
4
13
 
5
14
  ### Patch Changes
@@ -24,7 +24,10 @@ var Root = exports.Root = {
24
24
  if (!(0, _eslintCodemodUtils.isNodeOfType)(node, 'ImportDeclaration')) {
25
25
  return false;
26
26
  }
27
- if (!(0, _eslintCodemodUtils.hasImportDeclaration)(node, name)) {
27
+ var names = typeof name === 'string' ? [name] : name;
28
+ if (!names.some(function (name) {
29
+ return (0, _eslintCodemodUtils.hasImportDeclaration)(node, name);
30
+ })) {
28
31
  return false;
29
32
  }
30
33
  return true;
@@ -20,7 +20,7 @@ var _index = require("./rules/index.codegen");
20
20
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
21
21
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
22
22
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
23
- * @codegen <<SignedSource::7b3946fe240316f4de0c226615b90f53>>
23
+ * @codegen <<SignedSource::1ca7a384145f3bf3577ede9b88907a52>>
24
24
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
25
25
  */
26
26
  // this uses require because not all node versions this package supports use the same import assertions/attributes
@@ -62,7 +62,7 @@ var isDecendantOfPrimitive = exports.isDecendantOfPrimitive = function isDecenda
62
62
  if ((0, _eslintCodemodUtils.isNodeOfType)(node, 'JSXElement')) {
63
63
  // @ts-ignore
64
64
  if (primitivesToCheck.includes(node.openingElement.name.name)) {
65
- var importDeclaration = _astNodes.Root.findImportsByModule((0, _contextCompat.getSourceCode)(context).ast.body, '@atlaskit/primitives');
65
+ var importDeclaration = _astNodes.Root.findImportsByModule((0, _contextCompat.getSourceCode)(context).ast.body, ['@atlaskit/primitives', '@atlaskit/primitives/box', '@atlaskit/primitives/text', '@atlaskit/primitives/compiled']);
66
66
  if (importDeclaration.length) {
67
67
  return true;
68
68
  }
@@ -18,7 +18,8 @@ export const Root = {
18
18
  if (!isNodeOfType(node, 'ImportDeclaration')) {
19
19
  return false;
20
20
  }
21
- if (!hasImportDeclaration(node, name)) {
21
+ let names = typeof name === 'string' ? [name] : name;
22
+ if (!names.some(name => hasImportDeclaration(node, name))) {
22
23
  return false;
23
24
  }
24
25
  return true;
@@ -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::7b3946fe240316f4de0c226615b90f53>>
3
+ * @codegen <<SignedSource::1ca7a384145f3bf3577ede9b88907a52>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
 
@@ -21,7 +21,7 @@ const meta = {
21
21
  name,
22
22
  version
23
23
  };
24
- const plugin = {
24
+ export const plugin = {
25
25
  meta,
26
26
  rules,
27
27
  configs: {
@@ -48,5 +48,5 @@ const plugin = {
48
48
  }
49
49
  };
50
50
  const configs = plugin.configs;
51
- export { configs, meta, plugin, rules };
51
+ export { configs, meta, rules };
52
52
  export default plugin;
@@ -55,7 +55,7 @@ export const isDecendantOfPrimitive = (node, context) => {
55
55
  if (isNodeOfType(node, 'JSXElement')) {
56
56
  // @ts-ignore
57
57
  if (primitivesToCheck.includes(node.openingElement.name.name)) {
58
- const importDeclaration = Root.findImportsByModule(getSourceCode(context).ast.body, '@atlaskit/primitives');
58
+ const importDeclaration = Root.findImportsByModule(getSourceCode(context).ast.body, ['@atlaskit/primitives', '@atlaskit/primitives/box', '@atlaskit/primitives/text', '@atlaskit/primitives/compiled']);
59
59
  if (importDeclaration.length) {
60
60
  return true;
61
61
  }
@@ -18,7 +18,10 @@ export var Root = {
18
18
  if (!isNodeOfType(node, 'ImportDeclaration')) {
19
19
  return false;
20
20
  }
21
- if (!hasImportDeclaration(node, name)) {
21
+ var names = typeof name === 'string' ? [name] : name;
22
+ if (!names.some(function (name) {
23
+ return hasImportDeclaration(node, name);
24
+ })) {
22
25
  return false;
23
26
  }
24
27
  return true;
@@ -3,7 +3,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  /**
5
5
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
6
- * @codegen <<SignedSource::7b3946fe240316f4de0c226615b90f53>>
6
+ * @codegen <<SignedSource::1ca7a384145f3bf3577ede9b88907a52>>
7
7
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
8
8
  */
9
9
 
@@ -22,7 +22,7 @@ var meta = {
22
22
  name: name,
23
23
  version: version
24
24
  };
25
- var plugin = {
25
+ export var plugin = {
26
26
  meta: meta,
27
27
  rules: rules,
28
28
  configs: {
@@ -45,5 +45,5 @@ var plugin = {
45
45
  }
46
46
  };
47
47
  var configs = plugin.configs;
48
- export { configs, meta, plugin, rules };
48
+ export { configs, meta, rules };
49
49
  export default plugin;
@@ -56,7 +56,7 @@ export var isDecendantOfPrimitive = function isDecendantOfPrimitive(node, contex
56
56
  if (isNodeOfType(node, 'JSXElement')) {
57
57
  // @ts-ignore
58
58
  if (primitivesToCheck.includes(node.openingElement.name.name)) {
59
- var importDeclaration = Root.findImportsByModule(getSourceCode(context).ast.body, '@atlaskit/primitives');
59
+ var importDeclaration = Root.findImportsByModule(getSourceCode(context).ast.body, ['@atlaskit/primitives', '@atlaskit/primitives/box', '@atlaskit/primitives/text', '@atlaskit/primitives/compiled']);
60
60
  if (importDeclaration.length) {
61
61
  return true;
62
62
  }
@@ -10,7 +10,7 @@ export declare const Root: {
10
10
  * import type { StackProps } from '@atlaskit/primitives'
11
11
  * ```
12
12
  */
13
- findImportsByModule(root: (Directive | Statement | ModuleDeclaration)[], name: string): ImportDeclaration[];
13
+ findImportsByModule(root: (Directive | Statement | ModuleDeclaration)[], name: string | string[]): ImportDeclaration[];
14
14
  insertImport(root: (Directive | Statement | ModuleDeclaration)[], data: {
15
15
  module: string;
16
16
  specifiers: ImportData;
@@ -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::7b3946fe240316f4de0c226615b90f53>>
3
+ * @codegen <<SignedSource::1ca7a384145f3bf3577ede9b88907a52>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  import type { ESLint } from 'eslint';
@@ -9,7 +9,7 @@ declare const meta: {
9
9
  name: string;
10
10
  version: string;
11
11
  };
12
- declare const plugin: {
12
+ export declare const plugin: {
13
13
  meta: {
14
14
  name: string;
15
15
  version: string;
@@ -420,5 +420,5 @@ declare const configs: {
420
420
  };
421
421
  };
422
422
  };
423
- export { configs, meta, plugin, rules };
423
+ export { configs, meta, rules };
424
424
  export default plugin;
@@ -10,7 +10,7 @@ export declare const Root: {
10
10
  * import type { StackProps } from '@atlaskit/primitives'
11
11
  * ```
12
12
  */
13
- findImportsByModule(root: (Directive | Statement | ModuleDeclaration)[], name: string): ImportDeclaration[];
13
+ findImportsByModule(root: (Directive | Statement | ModuleDeclaration)[], name: string | string[]): ImportDeclaration[];
14
14
  insertImport(root: (Directive | Statement | ModuleDeclaration)[], data: {
15
15
  module: string;
16
16
  specifiers: ImportData;
@@ -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::7b3946fe240316f4de0c226615b90f53>>
3
+ * @codegen <<SignedSource::1ca7a384145f3bf3577ede9b88907a52>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
5
5
  */
6
6
  import type { ESLint } from 'eslint';
@@ -9,7 +9,7 @@ declare const meta: {
9
9
  name: string;
10
10
  version: string;
11
11
  };
12
- declare const plugin: {
12
+ export declare const plugin: {
13
13
  meta: {
14
14
  name: string;
15
15
  version: string;
@@ -444,5 +444,5 @@ declare const configs: {
444
444
  };
445
445
  };
446
446
  };
447
- export { configs, meta, plugin, rules };
447
+ export { configs, meta, rules };
448
448
  export default plugin;
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": "11.8.4",
4
+ "version": "11.9.0",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "devDependencies": {
60
60
  "@af/formatting": "*",
61
- "@atlaskit/ds-lib": "^3.3.0",
61
+ "@atlaskit/ds-lib": "^3.4.0",
62
62
  "@atlaskit/theme": "^14.0.0",
63
63
  "@atlassian/codegen": "*",
64
64
  "@atlassian/eslint-utils": "^0.5.0",