@atlaskit/eslint-plugin-platform 2.9.2 → 2.10.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 +15 -0
- package/dist/cjs/index.js +11 -1
- package/dist/cjs/rules/compiled/expand-motion-shorthand/index.js +281 -0
- package/dist/cjs/rules/compiled/use-motion-token-values/index.js +506 -0
- package/dist/cjs/rules/editor-example-type-import-required/index.js +321 -0
- package/dist/cjs/rules/import/one-value-export-per-file/index.js +203 -0
- package/dist/es2019/index.js +11 -1
- package/dist/es2019/rules/compiled/expand-motion-shorthand/index.js +239 -0
- package/dist/es2019/rules/compiled/use-motion-token-values/index.js +444 -0
- package/dist/es2019/rules/editor-example-type-import-required/index.js +286 -0
- package/dist/es2019/rules/import/one-value-export-per-file/index.js +191 -0
- package/dist/esm/index.js +11 -1
- package/dist/esm/rules/compiled/expand-motion-shorthand/index.js +275 -0
- package/dist/esm/rules/compiled/use-motion-token-values/index.js +499 -0
- package/dist/esm/rules/editor-example-type-import-required/index.js +314 -0
- package/dist/esm/rules/import/one-value-export-per-file/index.js +196 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/rules/compiled/expand-motion-shorthand/index.d.ts +3 -0
- package/dist/types/rules/compiled/use-motion-token-values/index.d.ts +3 -0
- package/dist/types/rules/editor-example-type-import-required/index.d.ts +4 -0
- package/dist/types/rules/import/one-value-export-per-file/index.d.ts +3 -0
- package/dist/types-ts4.5/index.d.ts +6 -0
- package/dist/types-ts4.5/rules/compiled/expand-motion-shorthand/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/compiled/use-motion-token-values/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/editor-example-type-import-required/index.d.ts +4 -0
- package/dist/types-ts4.5/rules/import/one-value-export-per-file/index.d.ts +3 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-platform
|
|
2
2
|
|
|
3
|
+
## 2.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`ed426d1a0955c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ed426d1a0955c) -
|
|
8
|
+
Add `one-value-export-per-file` ESLint rule for reporting files with multiple local value exports.
|
|
9
|
+
|
|
10
|
+
## 2.9.3
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`a1196120ab924`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a1196120ab924) -
|
|
15
|
+
Add `use-motion-token-values` and `expand-motion-shorthand` lint rules to enforce motion token
|
|
16
|
+
usage.
|
|
17
|
+
|
|
3
18
|
## 2.9.2
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -33,6 +33,8 @@ var _validGateName = _interopRequireDefault(require("./rules/feature-gating/vali
|
|
|
33
33
|
var _expandBackgroundShorthand = _interopRequireDefault(require("./rules/compiled/expand-background-shorthand"));
|
|
34
34
|
var _expandSpacingShorthand = _interopRequireDefault(require("./rules/compiled/expand-spacing-shorthand"));
|
|
35
35
|
var _noCssPropInObjectSpread = _interopRequireDefault(require("./rules/compiled/no-css-prop-in-object-spread"));
|
|
36
|
+
var _useMotionTokenValues = _interopRequireDefault(require("./rules/compiled/use-motion-token-values"));
|
|
37
|
+
var _expandMotionShorthand = _interopRequireDefault(require("./rules/compiled/expand-motion-shorthand"));
|
|
36
38
|
var _noSparseCheckout = _interopRequireDefault(require("./rules/no-sparse-checkout"));
|
|
37
39
|
var _noDirectDocumentUsage = _interopRequireDefault(require("./rules/no-direct-document-usage"));
|
|
38
40
|
var _noSetImmediate = _interopRequireDefault(require("./rules/no-set-immediate"));
|
|
@@ -43,7 +45,9 @@ var _noBarrelEntryJestMock = _interopRequireDefault(require("./rules/import/no-b
|
|
|
43
45
|
var _noJestMockBarrelFiles = _interopRequireDefault(require("./rules/import/no-jest-mock-barrel-files"));
|
|
44
46
|
var _noRelativeBarrelFileImports = _interopRequireDefault(require("./rules/import/no-relative-barrel-file-imports"));
|
|
45
47
|
var _noConversationAssistantBarrelImports = _interopRequireDefault(require("./rules/import/no-conversation-assistant-barrel-imports"));
|
|
48
|
+
var _oneValueExportPerFile = _interopRequireDefault(require("./rules/import/one-value-export-per-file"));
|
|
46
49
|
var _visitExampleTypeImportRequired = _interopRequireDefault(require("./rules/visit-example-type-import-required"));
|
|
50
|
+
var _editorExampleTypeImportRequired = _interopRequireDefault(require("./rules/editor-example-type-import-required"));
|
|
47
51
|
var _ensureUseSyncExternalStoreServerSnapshot = _interopRequireDefault(require("./rules/ensure-use-sync-external-store-server-snapshot"));
|
|
48
52
|
var _noXcssInCx = _interopRequireDefault(require("./rules/no-xcss-in-cx"));
|
|
49
53
|
var _nodePath = require("node:path");
|
|
@@ -104,9 +108,13 @@ var rules = exports.rules = {
|
|
|
104
108
|
'no-jest-mock-barrel-files': _noJestMockBarrelFiles.default,
|
|
105
109
|
'no-relative-barrel-file-imports': _noRelativeBarrelFileImports.default,
|
|
106
110
|
'no-conversation-assistant-barrel-imports': _noConversationAssistantBarrelImports.default,
|
|
111
|
+
'one-value-export-per-file': _oneValueExportPerFile.default,
|
|
107
112
|
'visit-example-type-import-required': _visitExampleTypeImportRequired.default,
|
|
108
113
|
'no-xcss-in-cx': _noXcssInCx.default,
|
|
109
|
-
'
|
|
114
|
+
'editor-example-type-import-required': _editorExampleTypeImportRequired.default,
|
|
115
|
+
'ensure-use-sync-external-store-server-snapshot': _ensureUseSyncExternalStoreServerSnapshot.default,
|
|
116
|
+
'use-motion-token-values': _useMotionTokenValues.default,
|
|
117
|
+
'expand-motion-shorthand': _expandMotionShorthand.default
|
|
110
118
|
};
|
|
111
119
|
var commonConfig = {
|
|
112
120
|
'@atlaskit/platform/ensure-test-runner-arguments': 'error',
|
|
@@ -124,6 +132,8 @@ var commonConfig = {
|
|
|
124
132
|
'@atlaskit/platform/expand-background-shorthand': 'error',
|
|
125
133
|
'@atlaskit/platform/expand-spacing-shorthand': 'error',
|
|
126
134
|
'@atlaskit/platform/no-css-prop-in-object-spread': 'error',
|
|
135
|
+
'@atlaskit/platform/use-motion-token-values': 'warn',
|
|
136
|
+
'@atlaskit/platform/expand-motion-shorthand': 'warn',
|
|
127
137
|
'@compiled/jsx-pragma': ['error', {
|
|
128
138
|
importSources: ['@atlaskit/css'],
|
|
129
139
|
onlyRunIfImportingCompiled: true,
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.expandTransitionShorthand = exports.default = void 0;
|
|
7
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
8
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
9
|
+
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; }
|
|
10
|
+
var EASING_KEYWORDS = ['ease', 'ease-in', 'ease-out', 'ease-in-out', 'linear', 'step-start', 'step-end'];
|
|
11
|
+
var KEYWORD_VALUES = ['none', 'all', 'inherit', 'initial', 'unset'];
|
|
12
|
+
var isDuration = function isDuration(token) {
|
|
13
|
+
return /^\d+(?:\.\d+)?m?s$/.test(token);
|
|
14
|
+
};
|
|
15
|
+
var isEasing = function isEasing(token) {
|
|
16
|
+
return EASING_KEYWORDS.includes(token) || token.startsWith('cubic-bezier(') || token.startsWith('steps(');
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Tokenizes a CSS shorthand value string, respecting function boundaries.
|
|
20
|
+
* e.g. 'opacity 200ms cubic-bezier(0.4, 0, 0, 1) 0ms' →
|
|
21
|
+
* ['opacity', '200ms', 'cubic-bezier(0.4, 0, 0, 1)', '0ms']
|
|
22
|
+
* Splits on whitespace only when not inside parentheses.
|
|
23
|
+
*/
|
|
24
|
+
var tokenizeShorthand = function tokenizeShorthand(value) {
|
|
25
|
+
var tokens = [];
|
|
26
|
+
var depth = 0;
|
|
27
|
+
var current = '';
|
|
28
|
+
for (var i = 0; i < value.length; i++) {
|
|
29
|
+
var ch = value[i];
|
|
30
|
+
if (ch === '(') {
|
|
31
|
+
depth++;
|
|
32
|
+
current += ch;
|
|
33
|
+
} else if (ch === ')') {
|
|
34
|
+
depth--;
|
|
35
|
+
current += ch;
|
|
36
|
+
} else if (/\s/.test(ch) && depth === 0) {
|
|
37
|
+
if (current.length > 0) {
|
|
38
|
+
tokens.push(current);
|
|
39
|
+
current = '';
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
current += ch;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (current.length > 0) {
|
|
46
|
+
tokens.push(current);
|
|
47
|
+
}
|
|
48
|
+
return tokens;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// Splits on top-level commas (outside function parens) — preserves cubic-bezier(...) commas.
|
|
52
|
+
var splitOnTopLevelCommas = function splitOnTopLevelCommas(value) {
|
|
53
|
+
var parts = [];
|
|
54
|
+
var depth = 0;
|
|
55
|
+
var current = '';
|
|
56
|
+
var _iterator = _createForOfIteratorHelper(value),
|
|
57
|
+
_step;
|
|
58
|
+
try {
|
|
59
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
60
|
+
var ch = _step.value;
|
|
61
|
+
if (ch === '(') {
|
|
62
|
+
depth++;
|
|
63
|
+
current += ch;
|
|
64
|
+
} else if (ch === ')') {
|
|
65
|
+
depth--;
|
|
66
|
+
current += ch;
|
|
67
|
+
} else if (ch === ',' && depth === 0) {
|
|
68
|
+
parts.push(current.trim());
|
|
69
|
+
current = '';
|
|
70
|
+
} else {
|
|
71
|
+
current += ch;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
} catch (err) {
|
|
75
|
+
_iterator.e(err);
|
|
76
|
+
} finally {
|
|
77
|
+
_iterator.f();
|
|
78
|
+
}
|
|
79
|
+
if (current.trim().length > 0) {
|
|
80
|
+
parts.push(current.trim());
|
|
81
|
+
}
|
|
82
|
+
return parts;
|
|
83
|
+
};
|
|
84
|
+
var parseTransition = function parseTransition(value) {
|
|
85
|
+
var parts = tokenizeShorthand(value.trim());
|
|
86
|
+
var result = {};
|
|
87
|
+
var durationCount = 0;
|
|
88
|
+
var _iterator2 = _createForOfIteratorHelper(parts),
|
|
89
|
+
_step2;
|
|
90
|
+
try {
|
|
91
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
92
|
+
var part = _step2.value;
|
|
93
|
+
if (isDuration(part)) {
|
|
94
|
+
if (durationCount === 0) {
|
|
95
|
+
result.transitionDuration = part;
|
|
96
|
+
} else {
|
|
97
|
+
result.transitionDelay = part;
|
|
98
|
+
}
|
|
99
|
+
durationCount++;
|
|
100
|
+
} else if (isEasing(part)) {
|
|
101
|
+
result.transitionTimingFunction = part;
|
|
102
|
+
} else {
|
|
103
|
+
result.transitionProperty = part;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
} catch (err) {
|
|
107
|
+
_iterator2.e(err);
|
|
108
|
+
} finally {
|
|
109
|
+
_iterator2.f();
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
112
|
+
};
|
|
113
|
+
var parseAnimation = function parseAnimation(value) {
|
|
114
|
+
var parts = tokenizeShorthand(value.trim());
|
|
115
|
+
var result = {};
|
|
116
|
+
var durationCount = 0;
|
|
117
|
+
var _iterator3 = _createForOfIteratorHelper(parts),
|
|
118
|
+
_step3;
|
|
119
|
+
try {
|
|
120
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
121
|
+
var part = _step3.value;
|
|
122
|
+
if (isDuration(part)) {
|
|
123
|
+
if (durationCount === 0) {
|
|
124
|
+
result.animationDuration = part;
|
|
125
|
+
} else {
|
|
126
|
+
result.animationDelay = part;
|
|
127
|
+
}
|
|
128
|
+
durationCount++;
|
|
129
|
+
} else if (isEasing(part)) {
|
|
130
|
+
result.animationTimingFunction = part;
|
|
131
|
+
} else if (part === 'infinite' || /^\d+(\.\d+)?$/.test(part)) {
|
|
132
|
+
result.animationIterationCount = part;
|
|
133
|
+
} else if (['normal', 'reverse', 'alternate', 'alternate-reverse'].includes(part)) {
|
|
134
|
+
result.animationDirection = part;
|
|
135
|
+
} else if (['none', 'forwards', 'backwards', 'both'].includes(part)) {
|
|
136
|
+
result.animationFillMode = part;
|
|
137
|
+
} else if (['running', 'paused'].includes(part)) {
|
|
138
|
+
result.animationPlayState = part;
|
|
139
|
+
} else {
|
|
140
|
+
result.animationName = part;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
} catch (err) {
|
|
144
|
+
_iterator3.e(err);
|
|
145
|
+
} finally {
|
|
146
|
+
_iterator3.f();
|
|
147
|
+
}
|
|
148
|
+
return result;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// Combine sub-property values across comma-separated transitions/animations.
|
|
152
|
+
// If no segment explicitly set this sub-property, omit it entirely.
|
|
153
|
+
// Otherwise, fill missing slots with the CSS spec default to preserve positional alignment.
|
|
154
|
+
var combineSubPropertyValues = function combineSubPropertyValues(segments, subProperty, defaultValue) {
|
|
155
|
+
if (segments.every(function (s) {
|
|
156
|
+
return s[subProperty] === undefined;
|
|
157
|
+
})) {
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
return segments.map(function (s) {
|
|
161
|
+
var _s$subProperty;
|
|
162
|
+
return (_s$subProperty = s[subProperty]) !== null && _s$subProperty !== void 0 ? _s$subProperty : defaultValue;
|
|
163
|
+
}).join(', ');
|
|
164
|
+
};
|
|
165
|
+
var buildTransitionFix = function buildTransitionFix(segments, indent) {
|
|
166
|
+
var lines = [];
|
|
167
|
+
var property = combineSubPropertyValues(segments, 'transitionProperty', 'all');
|
|
168
|
+
var duration = combineSubPropertyValues(segments, 'transitionDuration', '0s');
|
|
169
|
+
var timing = combineSubPropertyValues(segments, 'transitionTimingFunction', 'ease');
|
|
170
|
+
var delay = combineSubPropertyValues(segments, 'transitionDelay', '0s');
|
|
171
|
+
if (property !== undefined) lines.push("transitionProperty: '".concat(property, "'"));
|
|
172
|
+
if (duration !== undefined) lines.push("transitionDuration: '".concat(duration, "'"));
|
|
173
|
+
if (timing !== undefined) lines.push("transitionTimingFunction: '".concat(timing, "'"));
|
|
174
|
+
if (delay !== undefined) lines.push("transitionDelay: '".concat(delay, "'"));
|
|
175
|
+
return lines.join(",\n".concat(indent));
|
|
176
|
+
};
|
|
177
|
+
var buildAnimationFix = function buildAnimationFix(segments, indent) {
|
|
178
|
+
var lines = [];
|
|
179
|
+
var name = combineSubPropertyValues(segments, 'animationName', 'none');
|
|
180
|
+
var duration = combineSubPropertyValues(segments, 'animationDuration', '0s');
|
|
181
|
+
var timing = combineSubPropertyValues(segments, 'animationTimingFunction', 'ease');
|
|
182
|
+
var delay = combineSubPropertyValues(segments, 'animationDelay', '0s');
|
|
183
|
+
var iter = combineSubPropertyValues(segments, 'animationIterationCount', '1');
|
|
184
|
+
var direction = combineSubPropertyValues(segments, 'animationDirection', 'normal');
|
|
185
|
+
var fill = combineSubPropertyValues(segments, 'animationFillMode', 'none');
|
|
186
|
+
var playState = combineSubPropertyValues(segments, 'animationPlayState', 'running');
|
|
187
|
+
if (name !== undefined) lines.push("animationName: '".concat(name, "'"));
|
|
188
|
+
if (duration !== undefined) lines.push("animationDuration: '".concat(duration, "'"));
|
|
189
|
+
if (timing !== undefined) lines.push("animationTimingFunction: '".concat(timing, "'"));
|
|
190
|
+
if (delay !== undefined) lines.push("animationDelay: '".concat(delay, "'"));
|
|
191
|
+
if (iter !== undefined) lines.push("animationIterationCount: '".concat(iter, "'"));
|
|
192
|
+
if (direction !== undefined) lines.push("animationDirection: '".concat(direction, "'"));
|
|
193
|
+
if (fill !== undefined) lines.push("animationFillMode: '".concat(fill, "'"));
|
|
194
|
+
if (playState !== undefined) lines.push("animationPlayState: '".concat(playState, "'"));
|
|
195
|
+
return lines.join(",\n".concat(indent));
|
|
196
|
+
};
|
|
197
|
+
var TRANSITION_SUB_PROPERTIES = ['transitionProperty', 'transitionDuration', 'transitionTimingFunction', 'transitionDelay'];
|
|
198
|
+
var ANIMATION_SUB_PROPERTIES = ['animationName', 'animationDuration', 'animationTimingFunction', 'animationDelay', 'animationIterationCount', 'animationDirection', 'animationFillMode', 'animationPlayState'];
|
|
199
|
+
var executeExpandTransitionRule = function executeExpandTransitionRule(context, node, property) {
|
|
200
|
+
var _context$sourceCode, _node$loc;
|
|
201
|
+
if (node.value.type === 'CallExpression') {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (node.value.type === 'TemplateLiteral') {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (node.value.type !== 'Literal' || typeof node.value.value !== 'string') {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
var rawValue = node.value.value;
|
|
211
|
+
if (KEYWORD_VALUES.includes(rawValue)) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
var subProperties = property === 'transition' ? TRANSITION_SUB_PROPERTIES : ANIMATION_SUB_PROPERTIES;
|
|
215
|
+
|
|
216
|
+
// Extract leading whitespace to preserve indentation style (tabs vs spaces)
|
|
217
|
+
var sourceCode = (_context$sourceCode = context.sourceCode) !== null && _context$sourceCode !== void 0 ? _context$sourceCode : context.getSourceCode();
|
|
218
|
+
var nodeStart = (_node$loc = node.loc) === null || _node$loc === void 0 ? void 0 : _node$loc.start;
|
|
219
|
+
var indent = '\t';
|
|
220
|
+
if (nodeStart) {
|
|
221
|
+
var _sourceCode$lines;
|
|
222
|
+
var lineText = (_sourceCode$lines = sourceCode.lines[nodeStart.line - 1]) !== null && _sourceCode$lines !== void 0 ? _sourceCode$lines : '';
|
|
223
|
+
var leadingWhitespace = lineText.match(/^(\s*)/);
|
|
224
|
+
if (leadingWhitespace) {
|
|
225
|
+
indent = leadingWhitespace[1];
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
var segmentStrings = splitOnTopLevelCommas(rawValue);
|
|
229
|
+
if (property === 'transition') {
|
|
230
|
+
var segments = segmentStrings.map(parseTransition);
|
|
231
|
+
var fixText = buildTransitionFix(segments, indent);
|
|
232
|
+
context.report({
|
|
233
|
+
node: node,
|
|
234
|
+
messageId: 'expandTransitionShorthand',
|
|
235
|
+
data: {
|
|
236
|
+
property: property,
|
|
237
|
+
subProperties: subProperties.join(', ')
|
|
238
|
+
},
|
|
239
|
+
fix: function fix(fixer) {
|
|
240
|
+
return fixer.replaceText(node, fixText);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
} else {
|
|
244
|
+
var _segments = segmentStrings.map(parseAnimation);
|
|
245
|
+
var _fixText = buildAnimationFix(_segments, indent);
|
|
246
|
+
context.report({
|
|
247
|
+
node: node,
|
|
248
|
+
messageId: 'expandTransitionShorthand',
|
|
249
|
+
data: {
|
|
250
|
+
property: property,
|
|
251
|
+
subProperties: subProperties.join(', ')
|
|
252
|
+
},
|
|
253
|
+
fix: function fix(fixer) {
|
|
254
|
+
return fixer.replaceText(node, _fixText);
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
var expandTransitionShorthand = exports.expandTransitionShorthand = {
|
|
260
|
+
meta: {
|
|
261
|
+
type: 'suggestion',
|
|
262
|
+
fixable: 'code',
|
|
263
|
+
docs: {
|
|
264
|
+
url: 'https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/platform/eslint-plugin/src/rules/compiled/expand-transition-shorthand/'
|
|
265
|
+
},
|
|
266
|
+
messages: {
|
|
267
|
+
expandTransitionShorthand: "Use {{ subProperties }} instead of the '{{ property }}' shorthand so that individual values can be replaced with motion tokens."
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
create: function create(context) {
|
|
271
|
+
return {
|
|
272
|
+
'Property[key.name="transition"]': function PropertyKeyNameTransition(node) {
|
|
273
|
+
executeExpandTransitionRule(context, node, 'transition');
|
|
274
|
+
},
|
|
275
|
+
'Property[key.name="animation"]': function PropertyKeyNameAnimation(node) {
|
|
276
|
+
executeExpandTransitionRule(context, node, 'animation');
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
var _default = exports.default = expandTransitionShorthand;
|