@atlaskit/eslint-plugin-design-system 13.40.3 → 13.40.4

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
+ ## 13.40.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`1f45f35f80c0a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1f45f35f80c0a) -
8
+ use-spotlight-package now triggers for specific import specifiers, and ignores modal related
9
+ specifiers.
10
+ - Updated dependencies
11
+
3
12
  ## 13.40.3
4
13
 
5
14
  ### Patch Changes
@@ -8,6 +8,13 @@ var _eslintCodemodUtils = require("eslint-codemod-utils");
8
8
  /* eslint-disable @repo/internal/react/require-jsdoc */
9
9
 
10
10
  var messageId = 'use-spotlight-package';
11
+ var BANNED_IMPORTS = [
12
+ // 'Modal',
13
+ 'Spotlight', 'SpotlightCard', 'SpotlightManager', 'SpotlightTarget', 'SpotlightTransition',
14
+ // 'modalButtonTheme',
15
+ 'spotlightButtonTheme', 'useSpotlight',
16
+ // 'ModalTransition',
17
+ 'SpotlightPulse'];
11
18
  var ImportDeclaration = exports.ImportDeclaration = {
12
19
  lint: function lint(node, _ref) {
13
20
  var context = _ref.context;
@@ -30,6 +37,24 @@ var ImportDeclaration = exports.ImportDeclaration = {
30
37
  ref: undefined
31
38
  };
32
39
  }
40
+ if (!node.specifiers) {
41
+ return {
42
+ success: false,
43
+ ref: undefined
44
+ };
45
+ }
46
+ var isViolation = node.specifiers.some(function (specifier) {
47
+ if (!(0, _eslintCodemodUtils.isNodeOfType)(specifier, 'ImportSpecifier')) {
48
+ return false;
49
+ }
50
+ return BANNED_IMPORTS.includes(specifier.imported.name);
51
+ });
52
+ if (!isViolation) {
53
+ return {
54
+ success: false,
55
+ ref: undefined
56
+ };
57
+ }
33
58
  return {
34
59
  success: true,
35
60
  ref: node
@@ -2,6 +2,13 @@
2
2
 
3
3
  import { isNodeOfType } from 'eslint-codemod-utils';
4
4
  const messageId = 'use-spotlight-package';
5
+ const BANNED_IMPORTS = [
6
+ // 'Modal',
7
+ 'Spotlight', 'SpotlightCard', 'SpotlightManager', 'SpotlightTarget', 'SpotlightTransition',
8
+ // 'modalButtonTheme',
9
+ 'spotlightButtonTheme', 'useSpotlight',
10
+ // 'ModalTransition',
11
+ 'SpotlightPulse'];
5
12
  export const ImportDeclaration = {
6
13
  lint(node, {
7
14
  context
@@ -26,6 +33,24 @@ export const ImportDeclaration = {
26
33
  ref: undefined
27
34
  };
28
35
  }
36
+ if (!node.specifiers) {
37
+ return {
38
+ success: false,
39
+ ref: undefined
40
+ };
41
+ }
42
+ const isViolation = node.specifiers.some(specifier => {
43
+ if (!isNodeOfType(specifier, 'ImportSpecifier')) {
44
+ return false;
45
+ }
46
+ return BANNED_IMPORTS.includes(specifier.imported.name);
47
+ });
48
+ if (!isViolation) {
49
+ return {
50
+ success: false,
51
+ ref: undefined
52
+ };
53
+ }
29
54
  return {
30
55
  success: true,
31
56
  ref: node
@@ -2,6 +2,13 @@
2
2
 
3
3
  import { isNodeOfType } from 'eslint-codemod-utils';
4
4
  var messageId = 'use-spotlight-package';
5
+ var BANNED_IMPORTS = [
6
+ // 'Modal',
7
+ 'Spotlight', 'SpotlightCard', 'SpotlightManager', 'SpotlightTarget', 'SpotlightTransition',
8
+ // 'modalButtonTheme',
9
+ 'spotlightButtonTheme', 'useSpotlight',
10
+ // 'ModalTransition',
11
+ 'SpotlightPulse'];
5
12
  export var ImportDeclaration = {
6
13
  lint: function lint(node, _ref) {
7
14
  var context = _ref.context;
@@ -24,6 +31,24 @@ export var ImportDeclaration = {
24
31
  ref: undefined
25
32
  };
26
33
  }
34
+ if (!node.specifiers) {
35
+ return {
36
+ success: false,
37
+ ref: undefined
38
+ };
39
+ }
40
+ var isViolation = node.specifiers.some(function (specifier) {
41
+ if (!isNodeOfType(specifier, 'ImportSpecifier')) {
42
+ return false;
43
+ }
44
+ return BANNED_IMPORTS.includes(specifier.imported.name);
45
+ });
46
+ if (!isViolation) {
47
+ return {
48
+ success: false,
49
+ ref: undefined
50
+ };
51
+ }
27
52
  return {
28
53
  success: true,
29
54
  ref: node
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": "13.40.3",
4
+ "version": "13.40.4",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {