@atlaskit/eslint-plugin-design-system 13.43.0 → 13.43.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/eslint-plugin-design-system
2
2
 
3
+ ## 13.43.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 13.43.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`08170da1fbf62`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/08170da1fbf62) -
14
+ Migrate spacing prop usages on icons to Flex wrapper
15
+ - [`08170da1fbf62`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/08170da1fbf62) -
16
+ Update codemod and eslint to handle different scenarios to migrate spacing props
17
+ - Updated dependencies
18
+
3
19
  ## 13.43.0
4
20
 
5
21
  ### Minor Changes
@@ -122,6 +122,7 @@ function upsertFlexImport(context, fixer) {
122
122
  return s.local.name;
123
123
  });
124
124
  specifiers.push('Flex');
125
+ specifiers.sort();
125
126
  return fixer.replaceText(decl, "import { ".concat(specifiers.join(', '), " } from '").concat(FLEX_IMPORT_MODULE, "';"));
126
127
  }
127
128
  var nonCompiledImports = findExactImports(FLEX_IMPORT_MODULE_NON_COMPILED);
@@ -135,6 +136,7 @@ function upsertFlexImport(context, fixer) {
135
136
  if (!_specifiers.includes('Flex')) {
136
137
  _specifiers.push('Flex');
137
138
  }
139
+ _specifiers.sort();
138
140
  return fixer.replaceText(_decl, "import { ".concat(_specifiers.join(', '), " } from '").concat(FLEX_IMPORT_MODULE, "';"));
139
141
  }
140
142
  return ast.Root.upsertNamedImportDeclaration({
@@ -165,11 +167,20 @@ function upsertCssMapImport(context, fixer) {
165
167
  }).map(function (s) {
166
168
  return s.local.name;
167
169
  });
168
- if (!hasCssMap) {
169
- specifiers.push('cssMap');
170
- }
170
+ specifiers.push('cssMap');
171
+ specifiers.sort();
171
172
  return fixer.replaceText(decl, "import { ".concat(specifiers.join(', '), " } from '").concat(CSS_IMPORT_MODULE, "';"));
172
173
  }
174
+
175
+ // If cssMap is already imported from another package (e.g. @compiled/react), don't add a duplicate
176
+ var cssMapAlreadyImported = root.some(function (node) {
177
+ return node.type === 'ImportDeclaration' && node.specifiers.some(function (s) {
178
+ return s.type === 'ImportSpecifier' && s.local.name === 'cssMap';
179
+ });
180
+ });
181
+ if (cssMapAlreadyImported) {
182
+ return undefined;
183
+ }
173
184
  return ast.Root.upsertNamedImportDeclaration({
174
185
  module: CSS_IMPORT_MODULE,
175
186
  specifiers: ['cssMap']
@@ -198,6 +209,7 @@ function upsertTokenImport(context, fixer) {
198
209
  return s.local.name;
199
210
  });
200
211
  specifiers.push('token');
212
+ specifiers.sort();
201
213
  return fixer.replaceText(decl, "import { ".concat(specifiers.join(', '), " } from '").concat(TOKEN_IMPORT_MODULE, "';"));
202
214
  }
203
215
  return ast.Root.upsertNamedImportDeclaration({
@@ -89,6 +89,7 @@ export function upsertFlexImport(context, fixer) {
89
89
  }
90
90
  const specifiers = decl.specifiers.filter(s => s.type === 'ImportSpecifier').map(s => s.local.name);
91
91
  specifiers.push('Flex');
92
+ specifiers.sort();
92
93
  return fixer.replaceText(decl, `import { ${specifiers.join(', ')} } from '${FLEX_IMPORT_MODULE}';`);
93
94
  }
94
95
  const nonCompiledImports = findExactImports(FLEX_IMPORT_MODULE_NON_COMPILED);
@@ -98,6 +99,7 @@ export function upsertFlexImport(context, fixer) {
98
99
  if (!specifiers.includes('Flex')) {
99
100
  specifiers.push('Flex');
100
101
  }
102
+ specifiers.sort();
101
103
  return fixer.replaceText(decl, `import { ${specifiers.join(', ')} } from '${FLEX_IMPORT_MODULE}';`);
102
104
  }
103
105
  return ast.Root.upsertNamedImportDeclaration({
@@ -122,11 +124,16 @@ export function upsertCssMapImport(context, fixer) {
122
124
  return undefined;
123
125
  }
124
126
  const specifiers = decl.specifiers.filter(s => s.type === 'ImportSpecifier').map(s => s.local.name);
125
- if (!hasCssMap) {
126
- specifiers.push('cssMap');
127
- }
127
+ specifiers.push('cssMap');
128
+ specifiers.sort();
128
129
  return fixer.replaceText(decl, `import { ${specifiers.join(', ')} } from '${CSS_IMPORT_MODULE}';`);
129
130
  }
131
+
132
+ // If cssMap is already imported from another package (e.g. @compiled/react), don't add a duplicate
133
+ const cssMapAlreadyImported = root.some(node => node.type === 'ImportDeclaration' && node.specifiers.some(s => s.type === 'ImportSpecifier' && s.local.name === 'cssMap'));
134
+ if (cssMapAlreadyImported) {
135
+ return undefined;
136
+ }
130
137
  return ast.Root.upsertNamedImportDeclaration({
131
138
  module: CSS_IMPORT_MODULE,
132
139
  specifiers: ['cssMap']
@@ -149,6 +156,7 @@ export function upsertTokenImport(context, fixer) {
149
156
  }
150
157
  const specifiers = decl.specifiers.filter(s => s.type === 'ImportSpecifier').map(s => s.local.name);
151
158
  specifiers.push('token');
159
+ specifiers.sort();
152
160
  return fixer.replaceText(decl, `import { ${specifiers.join(', ')} } from '${TOKEN_IMPORT_MODULE}';`);
153
161
  }
154
162
  return ast.Root.upsertNamedImportDeclaration({
@@ -104,6 +104,7 @@ export function upsertFlexImport(context, fixer) {
104
104
  return s.local.name;
105
105
  });
106
106
  specifiers.push('Flex');
107
+ specifiers.sort();
107
108
  return fixer.replaceText(decl, "import { ".concat(specifiers.join(', '), " } from '").concat(FLEX_IMPORT_MODULE, "';"));
108
109
  }
109
110
  var nonCompiledImports = findExactImports(FLEX_IMPORT_MODULE_NON_COMPILED);
@@ -117,6 +118,7 @@ export function upsertFlexImport(context, fixer) {
117
118
  if (!_specifiers.includes('Flex')) {
118
119
  _specifiers.push('Flex');
119
120
  }
121
+ _specifiers.sort();
120
122
  return fixer.replaceText(_decl, "import { ".concat(_specifiers.join(', '), " } from '").concat(FLEX_IMPORT_MODULE, "';"));
121
123
  }
122
124
  return ast.Root.upsertNamedImportDeclaration({
@@ -147,11 +149,20 @@ export function upsertCssMapImport(context, fixer) {
147
149
  }).map(function (s) {
148
150
  return s.local.name;
149
151
  });
150
- if (!hasCssMap) {
151
- specifiers.push('cssMap');
152
- }
152
+ specifiers.push('cssMap');
153
+ specifiers.sort();
153
154
  return fixer.replaceText(decl, "import { ".concat(specifiers.join(', '), " } from '").concat(CSS_IMPORT_MODULE, "';"));
154
155
  }
156
+
157
+ // If cssMap is already imported from another package (e.g. @compiled/react), don't add a duplicate
158
+ var cssMapAlreadyImported = root.some(function (node) {
159
+ return node.type === 'ImportDeclaration' && node.specifiers.some(function (s) {
160
+ return s.type === 'ImportSpecifier' && s.local.name === 'cssMap';
161
+ });
162
+ });
163
+ if (cssMapAlreadyImported) {
164
+ return undefined;
165
+ }
155
166
  return ast.Root.upsertNamedImportDeclaration({
156
167
  module: CSS_IMPORT_MODULE,
157
168
  specifiers: ['cssMap']
@@ -180,6 +191,7 @@ export function upsertTokenImport(context, fixer) {
180
191
  return s.local.name;
181
192
  });
182
193
  specifiers.push('token');
194
+ specifiers.sort();
183
195
  return fixer.replaceText(decl, "import { ".concat(specifiers.join(', '), " } from '").concat(TOKEN_IMPORT_MODULE, "';"));
184
196
  }
185
197
  return ast.Root.upsertNamedImportDeclaration({
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.43.0",
4
+ "version": "13.43.2",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@atlaskit/eslint-utils": "^2.0.0",
42
- "@atlaskit/icon": "^33.1.0",
42
+ "@atlaskit/icon": "^34.0.0",
43
43
  "@atlaskit/icon-lab": "^6.2.0",
44
44
  "@atlaskit/tokens": "^11.4.0",
45
45
  "@babel/runtime": "^7.0.0",