@atlaskit/eslint-plugin-ui-styling-standard 1.6.4 → 2.0.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 +26 -0
- package/dist/cjs/rules/no-nested-selectors/index.js +2 -1
- package/dist/cjs/rules/no-unsafe-selectors/lint-selector.js +9 -9
- package/dist/cjs/rules/use-compiled/index.js +24 -24
- package/dist/esm/rules/no-nested-selectors/index.js +2 -1
- package/dist/esm/rules/no-unsafe-selectors/lint-selector.js +9 -9
- package/dist/esm/rules/use-compiled/index.js +24 -24
- package/package.json +4 -12
- package/dist/types-ts4.5/index.codegen.d.ts +0 -11
- package/dist/types-ts4.5/index.d.ts +0 -1
- package/dist/types-ts4.5/presets/all-flat.codegen.d.ts +0 -8
- package/dist/types-ts4.5/presets/all.codegen.d.ts +0 -8
- package/dist/types-ts4.5/presets/recommended-flat.codegen.d.ts +0 -8
- package/dist/types-ts4.5/presets/recommended.codegen.d.ts +0 -8
- package/dist/types-ts4.5/rules/atlaskit-theme/index.d.ts +0 -3
- package/dist/types-ts4.5/rules/convert-props-syntax/index.d.ts +0 -3
- package/dist/types-ts4.5/rules/enforce-style-prop/index.d.ts +0 -3
- package/dist/types-ts4.5/rules/external-rules.d.ts +0 -13
- package/dist/types-ts4.5/rules/index.codegen.d.ts +0 -7
- package/dist/types-ts4.5/rules/local-cx-xcss/index.d.ts +0 -3
- package/dist/types-ts4.5/rules/no-array-arguments/index.d.ts +0 -2
- package/dist/types-ts4.5/rules/no-classname-prop/index.d.ts +0 -2
- package/dist/types-ts4.5/rules/no-container-queries/index.d.ts +0 -2
- package/dist/types-ts4.5/rules/no-dynamic-styles/index.d.ts +0 -2
- package/dist/types-ts4.5/rules/no-exported-styles/index.d.ts +0 -2
- package/dist/types-ts4.5/rules/no-global-styles/index.d.ts +0 -2
- package/dist/types-ts4.5/rules/no-important-styles/index.d.ts +0 -2
- package/dist/types-ts4.5/rules/no-imported-style-values/index.d.ts +0 -3
- package/dist/types-ts4.5/rules/no-nested-selectors/index.d.ts +0 -2
- package/dist/types-ts4.5/rules/no-styled/index.d.ts +0 -2
- package/dist/types-ts4.5/rules/no-unsafe-selectors/constants.d.ts +0 -99
- package/dist/types-ts4.5/rules/no-unsafe-selectors/get-source-location-from-range.d.ts +0 -7
- package/dist/types-ts4.5/rules/no-unsafe-selectors/index.d.ts +0 -3
- package/dist/types-ts4.5/rules/no-unsafe-selectors/lint-selector.d.ts +0 -14
- package/dist/types-ts4.5/rules/no-unsafe-selectors/source-position-utils.d.ts +0 -21
- package/dist/types-ts4.5/rules/no-unsafe-selectors/walk-css-map.d.ts +0 -23
- package/dist/types-ts4.5/rules/no-unsafe-values/index.d.ts +0 -2
- package/dist/types-ts4.5/rules/no-unsafe-values/messages.d.ts +0 -13
- package/dist/types-ts4.5/rules/no-unsafe-values/utils.d.ts +0 -28
- package/dist/types-ts4.5/rules/no-unused-cssmap-properties/index.d.ts +0 -3
- package/dist/types-ts4.5/rules/use-compiled/index.d.ts +0 -3
- package/dist/types-ts4.5/rules/use-compiled/is-import-default-specifier.d.ts +0 -2
- package/dist/types-ts4.5/rules/use-compiled/is-import-namespace-specifier.d.ts +0 -2
- package/dist/types-ts4.5/rules/use-compiled/is-import-specifier.d.ts +0 -2
- package/dist/types-ts4.5/rules/use-compiled/is-safe-css.d.ts +0 -2
- package/dist/types-ts4.5/rules/use-compiled/is-safe-keyframes.d.ts +0 -2
- package/dist/types-ts4.5/rules/use-compiled/is-safe-property.d.ts +0 -2
- package/dist/types-ts4.5/rules/use-compiled/is-safe-style-argument.d.ts +0 -5
- package/dist/types-ts4.5/rules/use-compiled/is-safe-style-object.d.ts +0 -2
- package/dist/types-ts4.5/rules/use-compiled/is-safe-styled.d.ts +0 -2
- package/dist/types-ts4.5/rules/use-compiled/is-safe-usage.d.ts +0 -7
- package/dist/types-ts4.5/rules/use-compiled/utils.d.ts +0 -6
- package/dist/types-ts4.5/rules/utils/create-rule-with-typed-config.d.ts +0 -18
- package/dist/types-ts4.5/rules/utils/create-rule.d.ts +0 -9
- package/dist/types-ts4.5/rules/utils/get-rule-url.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-ui-styling-standard
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`f2dc9097319f0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f2dc9097319f0) - ###
|
|
8
|
+
Dropped support for _legacy_ Typescript 4 types. **Typescript 5 is now the new minimum**.
|
|
9
|
+
|
|
10
|
+
Removes the `typesVersions` property and `dist/types-ts4.5` directory from the dist.
|
|
11
|
+
|
|
12
|
+
Types are now exclusively via the `"types": "dist/types/index.d.ts"` property.
|
|
13
|
+
|
|
14
|
+
```diff
|
|
15
|
+
- "typesVersions": {
|
|
16
|
+
- ">=4.5 <4.9": {
|
|
17
|
+
- "*": [
|
|
18
|
+
- "dist/types-ts4.5/*",
|
|
19
|
+
- "dist/types-ts4.5/index.d.ts"
|
|
20
|
+
- ]
|
|
21
|
+
- }
|
|
22
|
+
- },
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
3
29
|
## 1.6.4
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -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
|
|
52
|
+
return _regenerator.default.wrap(function (_context) {
|
|
53
53
|
while (1) switch (_context.prev = _context.next) {
|
|
54
54
|
case 0:
|
|
55
|
-
_context.next =
|
|
55
|
+
_context.next = 1;
|
|
56
56
|
return fixer.insertTextBeforeRange(range, '&');
|
|
57
|
-
case
|
|
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
|
|
71
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
72
72
|
while (1) switch (_context2.prev = _context2.next) {
|
|
73
73
|
case 0:
|
|
74
|
-
_context2.next =
|
|
74
|
+
_context2.next = 1;
|
|
75
75
|
return fixer.insertTextBeforeRange(range, '&');
|
|
76
|
-
case
|
|
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
|
|
141
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
142
142
|
while (1) switch (_context3.prev = _context3.next) {
|
|
143
143
|
case 0:
|
|
144
|
-
_context3.next =
|
|
144
|
+
_context3.next = 1;
|
|
145
145
|
return fixer.insertTextBeforeRange(range, ':');
|
|
146
|
-
case
|
|
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
|
|
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 =
|
|
90
|
+
_context.next = 1;
|
|
91
91
|
break;
|
|
92
92
|
}
|
|
93
93
|
return _context.abrupt("return");
|
|
94
|
-
case
|
|
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 =
|
|
107
|
+
_context.next = 2;
|
|
108
108
|
break;
|
|
109
109
|
}
|
|
110
110
|
return _context.abrupt("return");
|
|
111
|
-
case
|
|
112
|
-
_context.next =
|
|
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
|
|
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
|
|
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 =
|
|
142
|
+
_context2.next = 1;
|
|
143
143
|
break;
|
|
144
144
|
}
|
|
145
145
|
return _context2.abrupt("return");
|
|
146
|
-
case
|
|
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 =
|
|
153
|
+
_context2.next = 2;
|
|
154
154
|
break;
|
|
155
155
|
}
|
|
156
156
|
return _context2.abrupt("return");
|
|
157
|
-
case
|
|
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",
|
|
164
|
-
case
|
|
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
|
|
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 =
|
|
233
|
+
_context3.next = 3;
|
|
234
234
|
break;
|
|
235
235
|
}
|
|
236
|
-
_context3.next =
|
|
236
|
+
_context3.next = 1;
|
|
237
237
|
return fixer.remove(node);
|
|
238
|
-
case
|
|
239
|
-
_context3.next =
|
|
238
|
+
case 1:
|
|
239
|
+
_context3.next = 2;
|
|
240
240
|
return fixer.replaceText(compiledImport, buildImportDeclaration(compiledImport.specifiers.concat(specifiers), '@compiled/react'));
|
|
241
|
-
case
|
|
242
|
-
_context3.next =
|
|
241
|
+
case 2:
|
|
242
|
+
_context3.next = 4;
|
|
243
243
|
break;
|
|
244
|
-
case
|
|
245
|
-
_context3.next =
|
|
244
|
+
case 3:
|
|
245
|
+
_context3.next = 4;
|
|
246
246
|
return fixer.replaceText(node, buildImportDeclaration(specifiers, '@compiled/react'));
|
|
247
|
-
case
|
|
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
|
|
45
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
46
46
|
while (1) switch (_context.prev = _context.next) {
|
|
47
47
|
case 0:
|
|
48
|
-
_context.next =
|
|
48
|
+
_context.next = 1;
|
|
49
49
|
return fixer.insertTextBeforeRange(range, '&');
|
|
50
|
-
case
|
|
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
|
|
64
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
65
65
|
while (1) switch (_context2.prev = _context2.next) {
|
|
66
66
|
case 0:
|
|
67
|
-
_context2.next =
|
|
67
|
+
_context2.next = 1;
|
|
68
68
|
return fixer.insertTextBeforeRange(range, '&');
|
|
69
|
-
case
|
|
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
|
|
134
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
135
135
|
while (1) switch (_context3.prev = _context3.next) {
|
|
136
136
|
case 0:
|
|
137
|
-
_context3.next =
|
|
137
|
+
_context3.next = 1;
|
|
138
138
|
return fixer.insertTextBeforeRange(range, ':');
|
|
139
|
-
case
|
|
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
|
|
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 =
|
|
83
|
+
_context.next = 1;
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
86
|
return _context.abrupt("return");
|
|
87
|
-
case
|
|
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 =
|
|
100
|
+
_context.next = 2;
|
|
101
101
|
break;
|
|
102
102
|
}
|
|
103
103
|
return _context.abrupt("return");
|
|
104
|
-
case
|
|
105
|
-
_context.next =
|
|
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
|
|
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
|
|
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 =
|
|
135
|
+
_context2.next = 1;
|
|
136
136
|
break;
|
|
137
137
|
}
|
|
138
138
|
return _context2.abrupt("return");
|
|
139
|
-
case
|
|
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 =
|
|
146
|
+
_context2.next = 2;
|
|
147
147
|
break;
|
|
148
148
|
}
|
|
149
149
|
return _context2.abrupt("return");
|
|
150
|
-
case
|
|
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",
|
|
157
|
-
case
|
|
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
|
|
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 =
|
|
226
|
+
_context3.next = 3;
|
|
227
227
|
break;
|
|
228
228
|
}
|
|
229
|
-
_context3.next =
|
|
229
|
+
_context3.next = 1;
|
|
230
230
|
return fixer.remove(node);
|
|
231
|
-
case
|
|
232
|
-
_context3.next =
|
|
231
|
+
case 1:
|
|
232
|
+
_context3.next = 2;
|
|
233
233
|
return fixer.replaceText(compiledImport, buildImportDeclaration(compiledImport.specifiers.concat(specifiers), '@compiled/react'));
|
|
234
|
-
case
|
|
235
|
-
_context3.next =
|
|
234
|
+
case 2:
|
|
235
|
+
_context3.next = 4;
|
|
236
236
|
break;
|
|
237
|
-
case
|
|
238
|
-
_context3.next =
|
|
237
|
+
case 3:
|
|
238
|
+
_context3.next = 4;
|
|
239
239
|
return fixer.replaceText(node, buildImportDeclaration(specifiers, '@compiled/react'));
|
|
240
|
-
case
|
|
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": "
|
|
3
|
+
"version": "2.0.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",
|
|
@@ -23,21 +23,13 @@
|
|
|
23
23
|
"module": "dist/esm/index.js",
|
|
24
24
|
"module:es2019": "dist/es2019/index.js",
|
|
25
25
|
"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
26
|
"sideEffects": [
|
|
35
27
|
"**/*.compiled.css"
|
|
36
28
|
],
|
|
37
29
|
"atlaskit:src": "src/index.tsx",
|
|
38
30
|
"dependencies": {
|
|
39
|
-
"@atlaskit/eslint-plugin-design-system": "^
|
|
40
|
-
"@atlaskit/eslint-utils": "^
|
|
31
|
+
"@atlaskit/eslint-plugin-design-system": "^15.0.0",
|
|
32
|
+
"@atlaskit/eslint-utils": "^3.0.0",
|
|
41
33
|
"@babel/runtime": "^7.0.0",
|
|
42
34
|
"@typescript-eslint/utils": "^7.1.0",
|
|
43
35
|
"ajv": "^6.12.6",
|
|
@@ -51,7 +43,7 @@
|
|
|
51
43
|
},
|
|
52
44
|
"devDependencies": {
|
|
53
45
|
"@af/formatting": "workspace:^",
|
|
54
|
-
"@atlaskit/ds-lib": "^
|
|
46
|
+
"@atlaskit/ds-lib": "^8.0.0",
|
|
55
47
|
"@atlassian/codegen": "^0.2.0",
|
|
56
48
|
"@atlassian/ts-loader": "^0.1.0",
|
|
57
49
|
"@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,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,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,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,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,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;
|