@atlaskit/eslint-plugin-ui-styling-standard 1.6.4 → 2.1.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/compass.yml +38 -0
  3. package/dist/cjs/rules/no-nested-selectors/index.js +2 -1
  4. package/dist/cjs/rules/no-unsafe-selectors/lint-selector.js +9 -9
  5. package/dist/cjs/rules/use-compiled/index.js +24 -24
  6. package/dist/esm/rules/no-nested-selectors/index.js +2 -1
  7. package/dist/esm/rules/no-unsafe-selectors/lint-selector.js +9 -9
  8. package/dist/esm/rules/use-compiled/index.js +24 -24
  9. package/package.json +6 -18
  10. package/dist/types-ts4.5/index.codegen.d.ts +0 -11
  11. package/dist/types-ts4.5/index.d.ts +0 -1
  12. package/dist/types-ts4.5/presets/all-flat.codegen.d.ts +0 -8
  13. package/dist/types-ts4.5/presets/all.codegen.d.ts +0 -8
  14. package/dist/types-ts4.5/presets/recommended-flat.codegen.d.ts +0 -8
  15. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +0 -8
  16. package/dist/types-ts4.5/rules/atlaskit-theme/index.d.ts +0 -3
  17. package/dist/types-ts4.5/rules/convert-props-syntax/index.d.ts +0 -3
  18. package/dist/types-ts4.5/rules/enforce-style-prop/index.d.ts +0 -3
  19. package/dist/types-ts4.5/rules/external-rules.d.ts +0 -13
  20. package/dist/types-ts4.5/rules/index.codegen.d.ts +0 -7
  21. package/dist/types-ts4.5/rules/local-cx-xcss/index.d.ts +0 -3
  22. package/dist/types-ts4.5/rules/no-array-arguments/index.d.ts +0 -2
  23. package/dist/types-ts4.5/rules/no-classname-prop/index.d.ts +0 -2
  24. package/dist/types-ts4.5/rules/no-container-queries/index.d.ts +0 -2
  25. package/dist/types-ts4.5/rules/no-dynamic-styles/index.d.ts +0 -2
  26. package/dist/types-ts4.5/rules/no-exported-styles/index.d.ts +0 -2
  27. package/dist/types-ts4.5/rules/no-global-styles/index.d.ts +0 -2
  28. package/dist/types-ts4.5/rules/no-important-styles/index.d.ts +0 -2
  29. package/dist/types-ts4.5/rules/no-imported-style-values/index.d.ts +0 -3
  30. package/dist/types-ts4.5/rules/no-nested-selectors/index.d.ts +0 -2
  31. package/dist/types-ts4.5/rules/no-styled/index.d.ts +0 -2
  32. package/dist/types-ts4.5/rules/no-unsafe-selectors/constants.d.ts +0 -99
  33. package/dist/types-ts4.5/rules/no-unsafe-selectors/get-source-location-from-range.d.ts +0 -7
  34. package/dist/types-ts4.5/rules/no-unsafe-selectors/index.d.ts +0 -3
  35. package/dist/types-ts4.5/rules/no-unsafe-selectors/lint-selector.d.ts +0 -14
  36. package/dist/types-ts4.5/rules/no-unsafe-selectors/source-position-utils.d.ts +0 -21
  37. package/dist/types-ts4.5/rules/no-unsafe-selectors/walk-css-map.d.ts +0 -23
  38. package/dist/types-ts4.5/rules/no-unsafe-values/index.d.ts +0 -2
  39. package/dist/types-ts4.5/rules/no-unsafe-values/messages.d.ts +0 -13
  40. package/dist/types-ts4.5/rules/no-unsafe-values/utils.d.ts +0 -28
  41. package/dist/types-ts4.5/rules/no-unused-cssmap-properties/index.d.ts +0 -3
  42. package/dist/types-ts4.5/rules/use-compiled/index.d.ts +0 -3
  43. package/dist/types-ts4.5/rules/use-compiled/is-import-default-specifier.d.ts +0 -2
  44. package/dist/types-ts4.5/rules/use-compiled/is-import-namespace-specifier.d.ts +0 -2
  45. package/dist/types-ts4.5/rules/use-compiled/is-import-specifier.d.ts +0 -2
  46. package/dist/types-ts4.5/rules/use-compiled/is-safe-css.d.ts +0 -2
  47. package/dist/types-ts4.5/rules/use-compiled/is-safe-keyframes.d.ts +0 -2
  48. package/dist/types-ts4.5/rules/use-compiled/is-safe-property.d.ts +0 -2
  49. package/dist/types-ts4.5/rules/use-compiled/is-safe-style-argument.d.ts +0 -5
  50. package/dist/types-ts4.5/rules/use-compiled/is-safe-style-object.d.ts +0 -2
  51. package/dist/types-ts4.5/rules/use-compiled/is-safe-styled.d.ts +0 -2
  52. package/dist/types-ts4.5/rules/use-compiled/is-safe-usage.d.ts +0 -7
  53. package/dist/types-ts4.5/rules/use-compiled/utils.d.ts +0 -6
  54. package/dist/types-ts4.5/rules/utils/create-rule-with-typed-config.d.ts +0 -18
  55. package/dist/types-ts4.5/rules/utils/create-rule.d.ts +0 -9
  56. package/dist/types-ts4.5/rules/utils/get-rule-url.d.ts +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @atlaskit/eslint-plugin-ui-styling-standard
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`2f56c78f969b8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2f56c78f969b8) -
8
+ Update i18n NPM package versions for teamwork-graph (Group 16)
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
14
+ ## 2.0.0
15
+
16
+ ### Major Changes
17
+
18
+ - [`f2dc9097319f0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f2dc9097319f0) - ###
19
+ Dropped support for _legacy_ Typescript 4 types. **Typescript 5 is now the new minimum**.
20
+
21
+ Removes the `typesVersions` property and `dist/types-ts4.5` directory from the dist.
22
+
23
+ Types are now exclusively via the `"types": "dist/types/index.d.ts"` property.
24
+
25
+ ```diff
26
+ - "typesVersions": {
27
+ - ">=4.5 <4.9": {
28
+ - "*": [
29
+ - "dist/types-ts4.5/*",
30
+ - "dist/types-ts4.5/index.d.ts"
31
+ - ]
32
+ - }
33
+ - },
34
+ ```
35
+
36
+ ### Patch Changes
37
+
38
+ - Updated dependencies
39
+
3
40
  ## 1.6.4
4
41
 
5
42
  ### Patch Changes
package/compass.yml ADDED
@@ -0,0 +1,38 @@
1
+ configVersion: 1
2
+ id: ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:component/c5751cc6-3513-4070-9deb-af31e86aed34/c9215c91-700d-4278-91b8-cef79dddb393
3
+ name: '@atlaskit/eslint-plugin-ui-styling-standard'
4
+ ownerId: ari:cloud:identity::team/be19136e-6275-419f-be0c-fcee844b8684 # Design System Engineers
5
+ labels:
6
+ - platform-code
7
+ - platform-afm
8
+ typeId: OTHER
9
+ fields:
10
+ tier: 4
11
+ lifecycle: Active
12
+ isMonorepoProject: true
13
+ links:
14
+ - name: Root Repository
15
+ type: REPOSITORY
16
+ url: https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master
17
+ - name: Slack Channel
18
+ type: CHAT_CHANNEL
19
+ url: https://atlassian.enterprise.slack.com/archives/CFJ9DU39U # #help-design-system
20
+ - name: Eslint Plugin Ui Styling Standard
21
+ type: REPOSITORY
22
+ url: https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/design-system/eslint-plugin-ui-styling-standard
23
+ customFields:
24
+ - name: Department
25
+ type: text
26
+ value: Eng - Design System Fundamentals
27
+ - name: Technical Owner
28
+ type: user
29
+ value: ari:cloud:identity::user/557058:86a9b692-7997-49cb-9984-080801b1de91 # Jared Crowe
30
+ - name: Required Reviewers Opt In
31
+ type: boolean
32
+ value: true
33
+ - name: Reviewer Selection Mechanism
34
+ type: text
35
+ value: random(3)
36
+ - name: Required Reviewer Approvals
37
+ type: number
38
+ value: 1
@@ -13,6 +13,7 @@ var _schema = require("@atlaskit/eslint-utils/schema");
13
13
  var _walkStyleProperties = require("@atlaskit/eslint-utils/walk-style-properties");
14
14
  var _createRuleWithTypedConfig = require("../utils/create-rule-with-typed-config");
15
15
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
16
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
16
17
  var getCssSelector = function getCssSelector(key) {
17
18
  if (key.type === 'Literal' && typeof key.value === 'string') {
18
19
  return key.value;
@@ -30,7 +31,7 @@ var getCssSelector = function getCssSelector(key) {
30
31
  function isAllowedSelector(selector) {
31
32
  var _selector$nodes = (0, _toArray2.default)(selector.nodes),
32
33
  head = _selector$nodes[0],
33
- tail = _selector$nodes.slice(1);
34
+ tail = _arrayLikeToArray(_selector$nodes).slice(1);
34
35
 
35
36
  // The first node must be a nesting selector (`&`) or pseudo-selector.
36
37
  var isHeadAllowed = (0, _postcssSelectorParser.isNesting)(head) || (0, _postcssSelectorParser.isPseudo)(head);
@@ -49,12 +49,12 @@ function checkNoAmbiguousPseudos(_ref) {
49
49
  loc: loc,
50
50
  messageId: 'no-ambiguous-pseudos',
51
51
  fix: /*#__PURE__*/_regenerator.default.mark(function fix(fixer) {
52
- return _regenerator.default.wrap(function fix$(_context) {
52
+ return _regenerator.default.wrap(function (_context) {
53
53
  while (1) switch (_context.prev = _context.next) {
54
54
  case 0:
55
- _context.next = 2;
55
+ _context.next = 1;
56
56
  return fixer.insertTextBeforeRange(range, '&');
57
- case 2:
57
+ case 1:
58
58
  case "end":
59
59
  return _context.stop();
60
60
  }
@@ -68,12 +68,12 @@ function checkNoAmbiguousPseudos(_ref) {
68
68
  suggest: [{
69
69
  messageId: 'insert-nesting-selector',
70
70
  fix: /*#__PURE__*/_regenerator.default.mark(function fix(fixer) {
71
- return _regenerator.default.wrap(function fix$(_context2) {
71
+ return _regenerator.default.wrap(function (_context2) {
72
72
  while (1) switch (_context2.prev = _context2.next) {
73
73
  case 0:
74
- _context2.next = 2;
74
+ _context2.next = 1;
75
75
  return fixer.insertTextBeforeRange(range, '&');
76
- case 2:
76
+ case 1:
77
77
  case "end":
78
78
  return _context2.stop();
79
79
  }
@@ -138,12 +138,12 @@ function checkNoLegacyPseudoElementSyntax(_ref3) {
138
138
  loc: loc,
139
139
  messageId: 'no-legacy-pseudo-element-syntax',
140
140
  fix: /*#__PURE__*/_regenerator.default.mark(function fix(fixer) {
141
- return _regenerator.default.wrap(function fix$(_context3) {
141
+ return _regenerator.default.wrap(function (_context3) {
142
142
  while (1) switch (_context3.prev = _context3.next) {
143
143
  case 0:
144
- _context3.next = 2;
144
+ _context3.next = 1;
145
145
  return fixer.insertTextBeforeRange(range, ':');
146
- case 2:
146
+ case 1:
147
147
  case "end":
148
148
  return _context3.stop();
149
149
  }
@@ -83,15 +83,15 @@ var rule = (0, _createRule.createLintRule)({
83
83
  fix: /*#__PURE__*/_regenerator.default.mark(function fix(fixer) {
84
84
  var _context$sourceCode;
85
85
  var importDeclarations, hasEmotionImport, hasCompiledImport;
86
- return _regenerator.default.wrap(function fix$(_context) {
86
+ return _regenerator.default.wrap(function (_context) {
87
87
  while (1) switch (_context.prev = _context.next) {
88
88
  case 0:
89
89
  if (config.canAutoFix) {
90
- _context.next = 2;
90
+ _context.next = 1;
91
91
  break;
92
92
  }
93
93
  return _context.abrupt("return");
94
- case 2:
94
+ case 1:
95
95
  // @ts-ignore - Jira's ESLint v10 types expose sourceCode, platform still checks with ESLint v9.
96
96
  importDeclarations = ((_context$sourceCode = context.sourceCode) !== null && _context$sourceCode !== void 0 ? _context$sourceCode : context.getSourceCode()).ast.body.filter(function (node) {
97
97
  return node.type === 'ImportDeclaration';
@@ -104,17 +104,17 @@ var rule = (0, _createRule.createLintRule)({
104
104
  return importDeclaration.source.value === '@compiled/react';
105
105
  });
106
106
  if (!(hasEmotionImport || !hasCompiledImport)) {
107
- _context.next = 7;
107
+ _context.next = 2;
108
108
  break;
109
109
  }
110
110
  return _context.abrupt("return");
111
- case 7:
112
- _context.next = 9;
111
+ case 2:
112
+ _context.next = 3;
113
113
  return fixer.replaceText(
114
114
  // TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
115
115
  // @ts-ignore - types don't accept comment nodes
116
116
  pragma, "/** @jsxImportSource @compiled/react */");
117
- case 9:
117
+ case 3:
118
118
  case "end":
119
119
  return _context.stop();
120
120
  }
@@ -135,33 +135,33 @@ var rule = (0, _createRule.createLintRule)({
135
135
  },
136
136
  fix: /*#__PURE__*/_regenerator.default.mark(function fix(fixer) {
137
137
  var specifiers;
138
- return _regenerator.default.wrap(function fix$(_context2) {
138
+ return _regenerator.default.wrap(function (_context2) {
139
139
  while (1) switch (_context2.prev = _context2.next) {
140
140
  case 0:
141
141
  if (config.canAutoFix) {
142
- _context2.next = 2;
142
+ _context2.next = 1;
143
143
  break;
144
144
  }
145
145
  return _context2.abrupt("return");
146
- case 2:
146
+ case 1:
147
147
  specifiers = getSpecifiers({
148
148
  context: context,
149
149
  node: node,
150
150
  importSource: importSource
151
151
  });
152
152
  if (specifiers) {
153
- _context2.next = 5;
153
+ _context2.next = 2;
154
154
  break;
155
155
  }
156
156
  return _context2.abrupt("return");
157
- case 5:
157
+ case 2:
158
158
  return _context2.delegateYield(fixImport({
159
159
  context: context,
160
160
  fixer: fixer,
161
161
  node: node,
162
162
  specifiers: specifiers
163
- }), "t0", 6);
164
- case 6:
163
+ }), "t0", 3);
164
+ case 3:
165
165
  case "end":
166
166
  return _context2.stop();
167
167
  }
@@ -225,26 +225,26 @@ function fixImport(_ref4) {
225
225
  specifiers = _ref4.specifiers;
226
226
  return /*#__PURE__*/_regenerator.default.mark(function _callee() {
227
227
  var compiledImport;
228
- return _regenerator.default.wrap(function _callee$(_context3) {
228
+ return _regenerator.default.wrap(function (_context3) {
229
229
  while (1) switch (_context3.prev = _context3.next) {
230
230
  case 0:
231
231
  compiledImport = (0, _utils.getFirstImportFromSource)(context, '@compiled/react');
232
232
  if (!compiledImport) {
233
- _context3.next = 8;
233
+ _context3.next = 3;
234
234
  break;
235
235
  }
236
- _context3.next = 4;
236
+ _context3.next = 1;
237
237
  return fixer.remove(node);
238
- case 4:
239
- _context3.next = 6;
238
+ case 1:
239
+ _context3.next = 2;
240
240
  return fixer.replaceText(compiledImport, buildImportDeclaration(compiledImport.specifiers.concat(specifiers), '@compiled/react'));
241
- case 6:
242
- _context3.next = 10;
241
+ case 2:
242
+ _context3.next = 4;
243
243
  break;
244
- case 8:
245
- _context3.next = 10;
244
+ case 3:
245
+ _context3.next = 4;
246
246
  return fixer.replaceText(node, buildImportDeclaration(specifiers, '@compiled/react'));
247
- case 10:
247
+ case 4:
248
248
  case "end":
249
249
  return _context3.stop();
250
250
  }
@@ -1,4 +1,5 @@
1
1
  import _toArray from "@babel/runtime/helpers/toArray";
2
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
2
3
  import cssSelectorParser, { isNesting, isPseudo } from 'postcss-selector-parser';
3
4
  import { getScope } from '@atlaskit/eslint-utils/context-compat';
4
5
  import { importSources } from '@atlaskit/eslint-utils/schema';
@@ -21,7 +22,7 @@ var getCssSelector = function getCssSelector(key) {
21
22
  function isAllowedSelector(selector) {
22
23
  var _selector$nodes = _toArray(selector.nodes),
23
24
  head = _selector$nodes[0],
24
- tail = _selector$nodes.slice(1);
25
+ tail = _arrayLikeToArray(_selector$nodes).slice(1);
25
26
 
26
27
  // The first node must be a nesting selector (`&`) or pseudo-selector.
27
28
  var isHeadAllowed = isNesting(head) || isPseudo(head);
@@ -42,12 +42,12 @@ function checkNoAmbiguousPseudos(_ref) {
42
42
  loc: loc,
43
43
  messageId: 'no-ambiguous-pseudos',
44
44
  fix: /*#__PURE__*/_regeneratorRuntime.mark(function fix(fixer) {
45
- return _regeneratorRuntime.wrap(function fix$(_context) {
45
+ return _regeneratorRuntime.wrap(function (_context) {
46
46
  while (1) switch (_context.prev = _context.next) {
47
47
  case 0:
48
- _context.next = 2;
48
+ _context.next = 1;
49
49
  return fixer.insertTextBeforeRange(range, '&');
50
- case 2:
50
+ case 1:
51
51
  case "end":
52
52
  return _context.stop();
53
53
  }
@@ -61,12 +61,12 @@ function checkNoAmbiguousPseudos(_ref) {
61
61
  suggest: [{
62
62
  messageId: 'insert-nesting-selector',
63
63
  fix: /*#__PURE__*/_regeneratorRuntime.mark(function fix(fixer) {
64
- return _regeneratorRuntime.wrap(function fix$(_context2) {
64
+ return _regeneratorRuntime.wrap(function (_context2) {
65
65
  while (1) switch (_context2.prev = _context2.next) {
66
66
  case 0:
67
- _context2.next = 2;
67
+ _context2.next = 1;
68
68
  return fixer.insertTextBeforeRange(range, '&');
69
- case 2:
69
+ case 1:
70
70
  case "end":
71
71
  return _context2.stop();
72
72
  }
@@ -131,12 +131,12 @@ function checkNoLegacyPseudoElementSyntax(_ref3) {
131
131
  loc: loc,
132
132
  messageId: 'no-legacy-pseudo-element-syntax',
133
133
  fix: /*#__PURE__*/_regeneratorRuntime.mark(function fix(fixer) {
134
- return _regeneratorRuntime.wrap(function fix$(_context3) {
134
+ return _regeneratorRuntime.wrap(function (_context3) {
135
135
  while (1) switch (_context3.prev = _context3.next) {
136
136
  case 0:
137
- _context3.next = 2;
137
+ _context3.next = 1;
138
138
  return fixer.insertTextBeforeRange(range, ':');
139
- case 2:
139
+ case 1:
140
140
  case "end":
141
141
  return _context3.stop();
142
142
  }
@@ -76,15 +76,15 @@ var rule = createLintRule({
76
76
  fix: /*#__PURE__*/_regeneratorRuntime.mark(function fix(fixer) {
77
77
  var _context$sourceCode;
78
78
  var importDeclarations, hasEmotionImport, hasCompiledImport;
79
- return _regeneratorRuntime.wrap(function fix$(_context) {
79
+ return _regeneratorRuntime.wrap(function (_context) {
80
80
  while (1) switch (_context.prev = _context.next) {
81
81
  case 0:
82
82
  if (config.canAutoFix) {
83
- _context.next = 2;
83
+ _context.next = 1;
84
84
  break;
85
85
  }
86
86
  return _context.abrupt("return");
87
- case 2:
87
+ case 1:
88
88
  // @ts-ignore - Jira's ESLint v10 types expose sourceCode, platform still checks with ESLint v9.
89
89
  importDeclarations = ((_context$sourceCode = context.sourceCode) !== null && _context$sourceCode !== void 0 ? _context$sourceCode : context.getSourceCode()).ast.body.filter(function (node) {
90
90
  return node.type === 'ImportDeclaration';
@@ -97,17 +97,17 @@ var rule = createLintRule({
97
97
  return importDeclaration.source.value === '@compiled/react';
98
98
  });
99
99
  if (!(hasEmotionImport || !hasCompiledImport)) {
100
- _context.next = 7;
100
+ _context.next = 2;
101
101
  break;
102
102
  }
103
103
  return _context.abrupt("return");
104
- case 7:
105
- _context.next = 9;
104
+ case 2:
105
+ _context.next = 3;
106
106
  return fixer.replaceText(
107
107
  // TODO: JFP-2823 - this type cast was added due to Jira's ESLint v9 migration
108
108
  // @ts-ignore - types don't accept comment nodes
109
109
  pragma, "/** @jsxImportSource @compiled/react */");
110
- case 9:
110
+ case 3:
111
111
  case "end":
112
112
  return _context.stop();
113
113
  }
@@ -128,33 +128,33 @@ var rule = createLintRule({
128
128
  },
129
129
  fix: /*#__PURE__*/_regeneratorRuntime.mark(function fix(fixer) {
130
130
  var specifiers;
131
- return _regeneratorRuntime.wrap(function fix$(_context2) {
131
+ return _regeneratorRuntime.wrap(function (_context2) {
132
132
  while (1) switch (_context2.prev = _context2.next) {
133
133
  case 0:
134
134
  if (config.canAutoFix) {
135
- _context2.next = 2;
135
+ _context2.next = 1;
136
136
  break;
137
137
  }
138
138
  return _context2.abrupt("return");
139
- case 2:
139
+ case 1:
140
140
  specifiers = getSpecifiers({
141
141
  context: context,
142
142
  node: node,
143
143
  importSource: importSource
144
144
  });
145
145
  if (specifiers) {
146
- _context2.next = 5;
146
+ _context2.next = 2;
147
147
  break;
148
148
  }
149
149
  return _context2.abrupt("return");
150
- case 5:
150
+ case 2:
151
151
  return _context2.delegateYield(fixImport({
152
152
  context: context,
153
153
  fixer: fixer,
154
154
  node: node,
155
155
  specifiers: specifiers
156
- }), "t0", 6);
157
- case 6:
156
+ }), "t0", 3);
157
+ case 3:
158
158
  case "end":
159
159
  return _context2.stop();
160
160
  }
@@ -218,26 +218,26 @@ function fixImport(_ref4) {
218
218
  specifiers = _ref4.specifiers;
219
219
  return /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
220
220
  var compiledImport;
221
- return _regeneratorRuntime.wrap(function _callee$(_context3) {
221
+ return _regeneratorRuntime.wrap(function (_context3) {
222
222
  while (1) switch (_context3.prev = _context3.next) {
223
223
  case 0:
224
224
  compiledImport = getFirstImportFromSource(context, '@compiled/react');
225
225
  if (!compiledImport) {
226
- _context3.next = 8;
226
+ _context3.next = 3;
227
227
  break;
228
228
  }
229
- _context3.next = 4;
229
+ _context3.next = 1;
230
230
  return fixer.remove(node);
231
- case 4:
232
- _context3.next = 6;
231
+ case 1:
232
+ _context3.next = 2;
233
233
  return fixer.replaceText(compiledImport, buildImportDeclaration(compiledImport.specifiers.concat(specifiers), '@compiled/react'));
234
- case 6:
235
- _context3.next = 10;
234
+ case 2:
235
+ _context3.next = 4;
236
236
  break;
237
- case 8:
238
- _context3.next = 10;
237
+ case 3:
238
+ _context3.next = 4;
239
239
  return fixer.replaceText(node, buildImportDeclaration(specifiers, '@compiled/react'));
240
- case 10:
240
+ case 4:
241
241
  case "end":
242
242
  return _context3.stop();
243
243
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/eslint-plugin-ui-styling-standard",
3
- "version": "1.6.4",
3
+ "version": "2.1.0",
4
4
  "author": "Atlassian Pty Ltd",
5
5
  "description": "The eslint plugin to enforce and educate on Atlassian's UI Styling Standard",
6
6
  "license": "Apache-2.0",
@@ -10,9 +10,7 @@
10
10
  "name": "UI Styling Standard",
11
11
  "category": "Tooling"
12
12
  },
13
- "toolingLabels": [
14
- "linting"
15
- ]
13
+ "toolingLabels": ["linting"]
16
14
  },
17
15
  "publishConfig": {
18
16
  "registry": "https://registry.npmjs.org/"
@@ -23,21 +21,11 @@
23
21
  "module": "dist/esm/index.js",
24
22
  "module:es2019": "dist/es2019/index.js",
25
23
  "types": "dist/types/index.d.ts",
26
- "typesVersions": {
27
- ">=4.5 <4.9": {
28
- "*": [
29
- "dist/types-ts4.5/*",
30
- "dist/types-ts4.5/index.d.ts"
31
- ]
32
- }
33
- },
34
- "sideEffects": [
35
- "**/*.compiled.css"
36
- ],
24
+ "sideEffects": ["**/*.compiled.css"],
37
25
  "atlaskit:src": "src/index.tsx",
38
26
  "dependencies": {
39
- "@atlaskit/eslint-plugin-design-system": "^14.3.0",
40
- "@atlaskit/eslint-utils": "^2.0.0",
27
+ "@atlaskit/eslint-plugin-design-system": "^15.6.0",
28
+ "@atlaskit/eslint-utils": "^3.0.0",
41
29
  "@babel/runtime": "^7.0.0",
42
30
  "@typescript-eslint/utils": "^7.1.0",
43
31
  "ajv": "^6.12.6",
@@ -51,7 +39,7 @@
51
39
  },
52
40
  "devDependencies": {
53
41
  "@af/formatting": "workspace:^",
54
- "@atlaskit/ds-lib": "^7.0.0",
42
+ "@atlaskit/ds-lib": "^8.0.0",
55
43
  "@atlassian/codegen": "^0.2.0",
56
44
  "@atlassian/ts-loader": "^0.1.0",
57
45
  "@eslint/eslintrc": "^3.0.2",
@@ -1,11 +0,0 @@
1
- /**
2
- * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::93c84481278f52fc66ecbba80094e6e5>>
4
- * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
- */
6
- import type { ESLint } from 'eslint';
7
- export declare const plugin: ESLint.Plugin;
8
- export { rules } from './rules/index.codegen';
9
- export declare const configs: ESLint.Plugin['configs'];
10
- export declare const meta: ESLint.Plugin['meta'];
11
- export default plugin;
@@ -1 +0,0 @@
1
- export { meta, rules, plugin, configs, default } from './index.codegen';
@@ -1,8 +0,0 @@
1
- /**
2
- * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::61c9435885ec26523572667a3a476d30>>
4
- * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
- */
6
- import type { Linter } from 'eslint';
7
- declare const config: Linter.FlatConfig;
8
- export default config;
@@ -1,8 +0,0 @@
1
- /**
2
- * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::8f28dfef84548edbe33f59201f295cc5>>
4
- * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
- */
6
- import type { ESLint } from 'eslint';
7
- declare const config: ESLint.ConfigData;
8
- export default config;
@@ -1,8 +0,0 @@
1
- /**
2
- * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::61c9435885ec26523572667a3a476d30>>
4
- * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
- */
6
- import type { Linter } from 'eslint';
7
- declare const config: Linter.FlatConfig;
8
- export default config;
@@ -1,8 +0,0 @@
1
- /**
2
- * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::8f28dfef84548edbe33f59201f295cc5>>
4
- * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
- */
6
- import type { ESLint } from 'eslint';
7
- declare const config: ESLint.ConfigData;
8
- export default config;
@@ -1,3 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- declare const rule: Rule.RuleModule;
3
- export default rule;
@@ -1,3 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- declare const rule: Rule.RuleModule;
3
- export default rule;
@@ -1,3 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- declare const rule: Rule.RuleModule;
3
- export default rule;
@@ -1,13 +0,0 @@
1
- import type { LintRuleMeta } from '@atlaskit/eslint-utils/create-rule';
2
- /**
3
- * External rules must be scoped, have a display name, and external urls.
4
- */
5
- export type ExternalRuleMeta = LintRuleMeta & {
6
- isExternal: true;
7
- name: `@${string}/${string}`;
8
- displayName: string;
9
- docs: {
10
- externalUrl: `https://${string}`;
11
- };
12
- };
13
- export declare const externalRules: ExternalRuleMeta[];
@@ -1,7 +0,0 @@
1
- /**
2
- * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::2eab912b0c44d0fcbdc2f0b79cb42fa9>>
4
- * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
- */
6
- import type { Rule } from 'eslint';
7
- export declare const rules: Record<string, Rule.RuleModule>;
@@ -1,3 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- declare const rule: Rule.RuleModule;
3
- export default rule;
@@ -1,2 +0,0 @@
1
- declare const rule: import('eslint').Rule.RuleModule;
2
- export default rule;
@@ -1,2 +0,0 @@
1
- declare const rule: import('eslint').Rule.RuleModule;
2
- export default rule;
@@ -1,2 +0,0 @@
1
- declare const rule: import('eslint').Rule.RuleModule;
2
- export default rule;
@@ -1,2 +0,0 @@
1
- declare const rule: import('eslint').Rule.RuleModule;
2
- export default rule;
@@ -1,2 +0,0 @@
1
- declare const rule: import('eslint').Rule.RuleModule;
2
- export default rule;
@@ -1,2 +0,0 @@
1
- declare const rule: import('eslint').Rule.RuleModule;
2
- export default rule;
@@ -1,2 +0,0 @@
1
- declare const rule: import('eslint').Rule.RuleModule;
2
- export default rule;
@@ -1,3 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- declare const rule: Rule.RuleModule;
3
- export default rule;
@@ -1,2 +0,0 @@
1
- declare const rule: import('eslint').Rule.RuleModule;
2
- export default rule;
@@ -1,2 +0,0 @@
1
- declare const rule: import('eslint').Rule.RuleModule;
2
- export default rule;
@@ -1,99 +0,0 @@
1
- import type { CSSPseudos } from '@compiled/react';
2
- /**
3
- * Validation approach from
4
- * https://stackoverflow.com/a/71236280
5
- */
6
- type Validate<T extends true> = T;
7
- type HasAllUnique<Tuple, Union, Seen = never> = Tuple extends readonly [
8
- infer Head,
9
- ...infer Tail
10
- ] ? Head extends Seen ? {
11
- ERROR: [
12
- 'The following key appears more than once in the tuple:',
13
- Head
14
- ];
15
- } : HasAllUnique<Tail, Exclude<Union, Head>, Head | Seen> : [
16
- Union
17
- ] extends [
18
- never
19
- ] ? true : {
20
- ERROR: [
21
- 'Some keys are missing from the tuple:',
22
- Union
23
- ];
24
- };
25
- /**
26
- * Exporting this so it isn't considered unused.
27
- */
28
- export type _ = Validate<HasAllUnique<typeof cssPseudos, CSSPseudos>>;
29
- declare const cssPseudos: readonly [
30
- "&:active",
31
- "&:autofill",
32
- "&:blank",
33
- "&:checked",
34
- "&:default",
35
- "&:defined",
36
- "&:disabled",
37
- "&:empty",
38
- "&:enabled",
39
- "&:first",
40
- "&:focus",
41
- "&:focus-visible",
42
- "&:focus-within",
43
- "&:fullscreen",
44
- "&:hover",
45
- "&:in-range",
46
- "&:indeterminate",
47
- "&:invalid",
48
- "&:left",
49
- "&:link",
50
- "&:local-link",
51
- "&:optional",
52
- "&:out-of-range",
53
- "&:paused",
54
- "&:picture-in-picture",
55
- "&:placeholder-shown",
56
- "&:playing",
57
- "&:popover-open",
58
- "&:read-only",
59
- "&:read-write",
60
- "&:required",
61
- "&:right",
62
- "&:target",
63
- "&:user-invalid",
64
- "&:user-valid",
65
- "&:valid",
66
- "&:visited",
67
- "&::after",
68
- "&::backdrop",
69
- "&::before",
70
- "&::cue",
71
- "&::cue-region",
72
- "&::first-letter",
73
- "&::first-line",
74
- "&::grammar-error",
75
- "&::marker",
76
- "&::placeholder",
77
- "&::selection",
78
- "&::spelling-error",
79
- "&::target-text",
80
- "&::view-transition",
81
- "&::-webkit-details-marker",
82
- "&:active:visited",
83
- "&:focus:not(:focus-visible)",
84
- "&:focus::after",
85
- "&:focus::before",
86
- "&:focus-visible::after",
87
- "&:focus-visible::before",
88
- "&:focus-within::after",
89
- "&:focus-within::before",
90
- "&:hover::after",
91
- "&:hover::before",
92
- "&:visited:active",
93
- "&:visited:hover",
94
- "&:visited:focus",
95
- "&:visited:focus-visible",
96
- "&:visited:focus-within"
97
- ];
98
- export declare const allowedPseudos: Set<string>;
99
- export {};
@@ -1,7 +0,0 @@
1
- import type { AST, Rule } from 'eslint';
2
- type Range = [
3
- number,
4
- number
5
- ];
6
- export declare function getSourceLocationFromRange(context: Rule.RuleContext, [start, end]: Range): AST.SourceLocation;
7
- export {};
@@ -1,3 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- declare const rule: Rule.RuleModule;
3
- export default rule;
@@ -1,14 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- import type * as ESTree from 'eslint-codemod-utils';
3
- import { type Selector } from 'postcss-selector-parser';
4
- type CheckArgs = {
5
- context: Rule.RuleContext;
6
- sourceNode: ESTree.Node;
7
- selector: Selector;
8
- config: {
9
- shouldAlwaysInsertNestingSelectorForAmbiguousPseudos: boolean;
10
- };
11
- isXcssCall: boolean;
12
- };
13
- export declare function lintSelector(args: CheckArgs): void;
14
- export {};
@@ -1,21 +0,0 @@
1
- import type * as ESTree from 'eslint-codemod-utils';
2
- import { type Node as SelectorNode } from 'postcss-selector-parser';
3
- type Range = [
4
- number,
5
- number
6
- ];
7
- export declare function getRangeFromNode({ node, sourceNode, }: {
8
- /**
9
- * The selector AST node to get the range of.
10
- */
11
- node: SelectorNode & {
12
- value: string;
13
- };
14
- /**
15
- * The source ESTree node whose value was parsed to obtain the selector AST.
16
- *
17
- * The range is calculated relative to this node's range.
18
- */
19
- sourceNode: ESTree.Node;
20
- }): Range;
21
- export {};
@@ -1,23 +0,0 @@
1
- /**
2
- * This util is intentionally not in `@atlaskit/eslint-utils` at this time.
3
- *
4
- * This is because the API is likely to change and should not be considered stable.
5
- */
6
- import type { Rule } from 'eslint';
7
- import type * as ESTree from 'eslint-codemod-utils';
8
- type CssMapVisitorArgs = {
9
- type: 'variant' | 'declaration' | 'ruleset' | 'selectors';
10
- node: ESTree.Property;
11
- } | {
12
- type: 'grouped-at-rules';
13
- node: ESTree.Property;
14
- atRule: string;
15
- };
16
- type CssMapVisitor = (args: CssMapVisitorArgs) => void;
17
- export declare function walkCssMap({ context, importSources, visitor, }: {
18
- context: Rule.RuleContext;
19
- program: ESTree.Program;
20
- importSources: string[];
21
- visitor: CssMapVisitor;
22
- }): void;
23
- export {};
@@ -1,2 +0,0 @@
1
- declare const rule: import('eslint').Rule.RuleModule;
2
- export default rule;
@@ -1,13 +0,0 @@
1
- export declare const messages: {
2
- 'no-array-values': string;
3
- 'no-conditional-values': string;
4
- 'no-dynamic-keys': string;
5
- 'no-function-calls': string;
6
- 'no-identifier-arguments': string;
7
- 'no-object-access': string;
8
- 'no-object-references': string;
9
- 'no-spread-elements': string;
10
- 'no-unsafe-values': string;
11
- 'no-variables': string;
12
- };
13
- export type MessageId = keyof typeof messages;
@@ -1,28 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- import type { CallExpression } from 'estree-jsx';
3
- export declare class Linter {
4
- private readonly allowedDynamicKeys;
5
- private readonly allowedFunctionCalls;
6
- private readonly context;
7
- private readonly baseNode;
8
- constructor(context: Rule.RuleContext, baseNode: CallExpression);
9
- /**
10
- * Wrapper around `context.report` to provide type checking on the message ID.
11
- */
12
- private report;
13
- /**
14
- * Fallback case to lint any identifier that is not otherwise handled.
15
- */
16
- private lintUnhandledIdentifier;
17
- private lintIdentifier;
18
- private isAllowedDynamicKey;
19
- private lintKey;
20
- private isAllowedFunctionCall;
21
- private lintFunctionCall;
22
- private lintObjectExpression;
23
- private lintUnhandledValue;
24
- private lintValue;
25
- private lintArgument;
26
- private lintArguments;
27
- run(): void;
28
- }
@@ -1,3 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- declare const rule: Rule.RuleModule;
3
- export default rule;
@@ -1,3 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- declare const rule: Rule.RuleModule;
3
- export default rule;
@@ -1,2 +0,0 @@
1
- import type * as ESTree from 'eslint-codemod-utils';
2
- export declare function isImportDefaultSpecifier(specifier: ESTree.Node): specifier is ESTree.ImportDefaultSpecifier;
@@ -1,2 +0,0 @@
1
- import type * as ESTree from 'eslint-codemod-utils';
2
- export declare function isImportNamespaceSpecifier(specifier: ESTree.Node): specifier is ESTree.ImportNamespaceSpecifier;
@@ -1,2 +0,0 @@
1
- import type * as ESTree from 'eslint-codemod-utils';
2
- export declare function isImportSpecifier(specifier: ESTree.Node): specifier is ESTree.ImportSpecifier;
@@ -1,2 +0,0 @@
1
- import type { Scope } from 'eslint';
2
- export declare function isSafeCss(css: Scope.Variable): boolean;
@@ -1,2 +0,0 @@
1
- import type { Scope } from 'eslint';
2
- export declare function isSafeKeyframes(keyframes: Scope.Variable): boolean;
@@ -1,2 +0,0 @@
1
- import type * as ESTree from 'eslint-codemod-utils';
2
- export declare function isSafeProperty(property: ESTree.Property | ESTree.SpreadElement, isSafePropertyValue: (value: ESTree.Property['value']) => boolean): boolean;
@@ -1,5 +0,0 @@
1
- import type * as ESTree from 'eslint-codemod-utils';
2
- /**
3
- * Determines if a style argument is safe for auto-fix conversion.
4
- */
5
- export declare function isSafeStyleArgument(arg: ESTree.Expression | ESTree.SpreadElement): boolean;
@@ -1,2 +0,0 @@
1
- import type * as ESTree from 'eslint-codemod-utils';
2
- export declare function isSafeStyleObject(object: ESTree.ObjectExpression): boolean;
@@ -1,2 +0,0 @@
1
- import type { Scope } from 'eslint';
2
- export declare function isSafeStyled(styled: Scope.Variable): boolean;
@@ -1,7 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- import type * as ESTree from 'eslint-codemod-utils';
3
- export declare function isSafeUsage({ context, specifier, supportedImports, }: {
4
- context: Rule.RuleContext;
5
- specifier: ESTree.ImportSpecifier;
6
- supportedImports: Set<string>;
7
- }): boolean;
@@ -1,6 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- import type * as ESTree from 'eslint-codemod-utils';
3
- export declare function getFirstImportFromSource(context: Rule.RuleContext, source: string): ESTree.ImportDeclaration | undefined;
4
- export { isImportSpecifier } from './is-import-specifier';
5
- export { isImportDefaultSpecifier } from './is-import-default-specifier';
6
- export { isImportNamespaceSpecifier } from './is-import-namespace-specifier';
@@ -1,18 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- import type { FromSchema, JSONSchema } from 'json-schema-to-ts';
3
- import type { LintRule as BaseLintRule, LintRuleMeta as BaseLintRuleMeta } from '@atlaskit/eslint-utils/create-rule';
4
- export interface LintRule<Schema extends JSONSchema, Config> extends Omit<BaseLintRule, 'meta' | 'create'> {
5
- meta: LintRuleMeta<Schema>;
6
- create(context: Rule.RuleContext, config: Config): Rule.RuleListener;
7
- /**
8
- * Unsure why the eslint typings include this when the docs
9
- * say the schema should be in meta.
10
- */
11
- schema?: never;
12
- }
13
- export interface LintRuleMeta<Schema extends JSONSchema> extends Omit<BaseLintRuleMeta, 'schema'> {
14
- schema: Schema;
15
- }
16
- export declare const createLintRuleWithTypedConfig: <Schema extends JSONSchema & {
17
- type: "object";
18
- }, Config = FromSchema<Schema>>(rule: LintRule<Schema, Config>) => Rule.RuleModule;
@@ -1,9 +0,0 @@
1
- import type { Rule } from 'eslint';
2
- import { type LintRule } from '@atlaskit/eslint-utils/create-rule';
3
- /**
4
- * Tiny wrapped over the ESLint rule module type that ensures
5
- * there is a docs link to our ESLint plugin documentation page,
6
- * as well as improving type support.
7
- */
8
- export declare const createLintRule: (rule: LintRule) => Rule.RuleModule;
9
- export { getRuleUrl } from './get-rule-url';
@@ -1 +0,0 @@
1
- export declare function getRuleUrl(ruleName: string): string;