@atlaskit/eslint-plugin-design-system 10.0.0 → 10.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.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/rules/ensure-design-token-usage/index.js +10 -1
- package/dist/cjs/rules/no-unsafe-design-token-usage/index.js +16 -3
- package/dist/cjs/rules/utils/is-node.js +4 -6
- package/dist/es2019/rules/ensure-design-token-usage/index.js +11 -1
- package/dist/es2019/rules/no-unsafe-design-token-usage/index.js +14 -1
- package/dist/es2019/rules/utils/is-node.js +4 -4
- package/dist/esm/rules/ensure-design-token-usage/index.js +10 -1
- package/dist/esm/rules/no-unsafe-design-token-usage/index.js +16 -3
- package/dist/esm/rules/utils/is-node.js +4 -6
- package/dist/types/rules/ensure-design-token-usage/index.d.ts +1 -1
- package/dist/types/rules/use-tokens-typography/utils.d.ts +19 -19
- package/dist/types/rules/utils/is-node.d.ts +3 -3
- package/dist/types-ts4.5/rules/ensure-design-token-usage/index.d.ts +1 -1
- package/dist/types-ts4.5/rules/use-tokens-typography/utils.d.ts +19 -19
- package/dist/types-ts4.5/rules/utils/is-node.d.ts +3 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/eslint-plugin-design-system
|
|
2
2
|
|
|
3
|
+
## 10.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#98883](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/98883)
|
|
8
|
+
[`482fe4d89379`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/482fe4d89379) -
|
|
9
|
+
Automatically insert the default fallback value for a token when fallbacks are enforced
|
|
10
|
+
|
|
11
|
+
## 10.0.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#98294](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/98294)
|
|
16
|
+
[`0663be43d057`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0663be43d057) -
|
|
17
|
+
The `ensure-design-token-usage` rule will now ignore `xcss()` calls even if the `xcss` variable
|
|
18
|
+
has been aliased.
|
|
19
|
+
|
|
3
20
|
## 10.0.0
|
|
4
21
|
|
|
5
22
|
### Major Changes
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.createWithConfig = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
10
|
+
var _isSupportedImport = require("@atlaskit/eslint-utils/is-supported-import");
|
|
10
11
|
var _createRule = require("../utils/create-rule");
|
|
11
12
|
var _isColor = require("../utils/is-color");
|
|
12
13
|
var _isNode = require("../utils/is-node");
|
|
@@ -67,6 +68,14 @@ var createWithConfig = exports.createWithConfig = function createWithConfig(init
|
|
|
67
68
|
return ObjectExpression;
|
|
68
69
|
}(function (parentNode) {
|
|
69
70
|
return (0, _errorBoundary.errorBoundary)(function () {
|
|
71
|
+
var _context$getScope = context.getScope(),
|
|
72
|
+
references = _context$getScope.references;
|
|
73
|
+
/**
|
|
74
|
+
* NOTE: This rule doesn't have an `importSources` config option,
|
|
75
|
+
* so this will just be equal to DEFAULT_IMPORT_SOURCES (which is fine)
|
|
76
|
+
*/
|
|
77
|
+
var importSources = (0, _isSupportedImport.getImportSources)(context);
|
|
78
|
+
|
|
70
79
|
// To force the correct node type
|
|
71
80
|
if (!(0, _eslintCodemodUtils.isNodeOfType)(parentNode, 'ObjectExpression')) {
|
|
72
81
|
return;
|
|
@@ -76,7 +85,7 @@ var createWithConfig = exports.createWithConfig = function createWithConfig(init
|
|
|
76
85
|
if (parentNode.parent.type === 'Property') {
|
|
77
86
|
return;
|
|
78
87
|
}
|
|
79
|
-
if ((0, _isNode.isDecendantOfXcssBlock)(parentNode)) {
|
|
88
|
+
if ((0, _isNode.isDecendantOfXcssBlock)(parentNode, references, importSources)) {
|
|
80
89
|
return;
|
|
81
90
|
}
|
|
82
91
|
if (!(0, _isNode.isDecendantOfStyleBlock)(parentNode) && !(0, _isNode.isDecendantOfType)(parentNode, 'JSXExpressionContainer')) {
|
|
@@ -8,6 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
10
10
|
var _renameMapping = _interopRequireDefault(require("@atlaskit/tokens/rename-mapping"));
|
|
11
|
+
var _tokenDefaultValues = _interopRequireDefault(require("@atlaskit/tokens/token-default-values"));
|
|
11
12
|
var _tokenIds = require("@atlaskit/tokens/token-ids");
|
|
12
13
|
var _tokenNames = _interopRequireDefault(require("@atlaskit/tokens/token-names"));
|
|
13
14
|
var _createRule = require("../utils/create-rule");
|
|
@@ -92,18 +93,30 @@ var rule = (0, _createRule.createLintRule)({
|
|
|
92
93
|
return;
|
|
93
94
|
}
|
|
94
95
|
if (node.arguments.length < 2 && config.fallbackUsage === 'forced') {
|
|
96
|
+
var fix;
|
|
97
|
+
if (node.arguments[0].type === 'Literal') {
|
|
98
|
+
var value = node.arguments[0].value;
|
|
99
|
+
var tokenName = value;
|
|
100
|
+
var fallbackValue = _tokenDefaultValues.default[tokenName] || null;
|
|
101
|
+
if (fallbackValue) {
|
|
102
|
+
fix = function fix(fixer) {
|
|
103
|
+
return fixer.replaceText(node, "".concat((0, _eslintCodemodUtils.isNodeOfType)(node.callee, 'Identifier') ? node.callee.name : 'token', "('").concat(tokenName, "', '").concat(fallbackValue, "')"));
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
95
107
|
context.report({
|
|
96
108
|
messageId: 'tokenFallbackEnforced',
|
|
97
|
-
node: node
|
|
109
|
+
node: node,
|
|
110
|
+
fix: fix
|
|
98
111
|
});
|
|
99
112
|
} else if (node.arguments.length > 1 && config.fallbackUsage === 'none') {
|
|
100
113
|
if (node.arguments[0].type === 'Literal') {
|
|
101
|
-
var
|
|
114
|
+
var _value = node.arguments[0].value;
|
|
102
115
|
context.report({
|
|
103
116
|
messageId: 'tokenFallbackRestricted',
|
|
104
117
|
node: node.arguments[1],
|
|
105
118
|
fix: function fix(fixer) {
|
|
106
|
-
return fixer.replaceText(node, "".concat((0, _eslintCodemodUtils.isNodeOfType)(node.callee, 'Identifier') ? node.callee.name : 'token', "('").concat(
|
|
119
|
+
return fixer.replaceText(node, "".concat((0, _eslintCodemodUtils.isNodeOfType)(node.callee, 'Identifier') ? node.callee.name : 'token', "('").concat(_value, "')"));
|
|
107
120
|
}
|
|
108
121
|
});
|
|
109
122
|
} else {
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.isPropertyKey = exports.isDecendantOfXcssBlock = exports.isDecendantOfType = exports.isDecendantOfSvgElement = exports.isDecendantOfStyleJsxAttribute = exports.isDecendantOfStyleBlock = exports.isDecendantOfPrimitive = exports.isDecendantOfGlobalToken = exports.isCssInJsTemplateNode = exports.isCssInJsObjectNode = exports.isCssInJsCallNode = exports.isChildOfType = void 0;
|
|
7
7
|
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
8
|
+
var _isSupportedImport = require("@atlaskit/eslint-utils/is-supported-import");
|
|
8
9
|
var _astNodes = require("../../ast-nodes");
|
|
9
10
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
10
11
|
|
|
@@ -81,16 +82,13 @@ var isCssInJsCallNode = exports.isCssInJsCallNode = function isCssInJsCallNode(n
|
|
|
81
82
|
var isCssInJsObjectNode = exports.isCssInJsObjectNode = function isCssInJsObjectNode(node) {
|
|
82
83
|
return (node === null || node === void 0 ? void 0 : node.type) === 'CallExpression' && node.callee.type === 'MemberExpression' && node.callee.object.type === 'Identifier' && cssInJsCallees.includes(node.callee.object.name);
|
|
83
84
|
};
|
|
84
|
-
var
|
|
85
|
-
return (node === null || node === void 0 ? void 0 : node.type) === 'CallExpression' && node.callee.type === 'Identifier' && node.callee.name === 'xcss';
|
|
86
|
-
};
|
|
87
|
-
var isDecendantOfXcssBlock = exports.isDecendantOfXcssBlock = function isDecendantOfXcssBlock(node) {
|
|
85
|
+
var isDecendantOfXcssBlock = exports.isDecendantOfXcssBlock = function isDecendantOfXcssBlock(node, referencesInScope, importSources) {
|
|
88
86
|
// xcss contains types for all properties that accept tokens, so ignore xcss for linting as it will report false positives
|
|
89
|
-
if (
|
|
87
|
+
if (node.type === 'CallExpression' && (0, _isSupportedImport.isXcss)(node.callee, referencesInScope, importSources)) {
|
|
90
88
|
return true;
|
|
91
89
|
}
|
|
92
90
|
if (node.parent) {
|
|
93
|
-
return isDecendantOfXcssBlock(node.parent);
|
|
91
|
+
return isDecendantOfXcssBlock(node.parent, referencesInScope, importSources);
|
|
94
92
|
}
|
|
95
93
|
return false;
|
|
96
94
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
+
import { getImportSources } from '@atlaskit/eslint-utils/is-supported-import';
|
|
4
5
|
import { createLintRule } from '../utils/create-rule';
|
|
5
6
|
import { includesHardCodedColor } from '../utils/is-color';
|
|
6
7
|
import { isDecendantOfGlobalToken, isDecendantOfStyleBlock, isDecendantOfType, isDecendantOfXcssBlock } from '../utils/is-node';
|
|
@@ -45,6 +46,15 @@ const createWithConfig = initialConfig => context => {
|
|
|
45
46
|
}),
|
|
46
47
|
// const styles = css({ color: 'red', margin: '4px' }), styled.div({ color: 'red', margin: '4px' })
|
|
47
48
|
ObjectExpression: parentNode => errorBoundary(() => {
|
|
49
|
+
const {
|
|
50
|
+
references
|
|
51
|
+
} = context.getScope();
|
|
52
|
+
/**
|
|
53
|
+
* NOTE: This rule doesn't have an `importSources` config option,
|
|
54
|
+
* so this will just be equal to DEFAULT_IMPORT_SOURCES (which is fine)
|
|
55
|
+
*/
|
|
56
|
+
const importSources = getImportSources(context);
|
|
57
|
+
|
|
48
58
|
// To force the correct node type
|
|
49
59
|
if (!isNodeOfType(parentNode, 'ObjectExpression')) {
|
|
50
60
|
return;
|
|
@@ -54,7 +64,7 @@ const createWithConfig = initialConfig => context => {
|
|
|
54
64
|
if (parentNode.parent.type === 'Property') {
|
|
55
65
|
return;
|
|
56
66
|
}
|
|
57
|
-
if (isDecendantOfXcssBlock(parentNode)) {
|
|
67
|
+
if (isDecendantOfXcssBlock(parentNode, references, importSources)) {
|
|
58
68
|
return;
|
|
59
69
|
}
|
|
60
70
|
if (!isDecendantOfStyleBlock(parentNode) && !isDecendantOfType(parentNode, 'JSXExpressionContainer')) {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
4
|
import renameMapping from '@atlaskit/tokens/rename-mapping';
|
|
5
|
+
import tokenDefaultValues from '@atlaskit/tokens/token-default-values';
|
|
5
6
|
import { getTokenId } from '@atlaskit/tokens/token-ids';
|
|
6
7
|
import tokens from '@atlaskit/tokens/token-names';
|
|
7
8
|
import { createLintRule } from '../utils/create-rule';
|
|
@@ -104,9 +105,21 @@ token('color.background.blanket');
|
|
|
104
105
|
return;
|
|
105
106
|
}
|
|
106
107
|
if (node.arguments.length < 2 && config.fallbackUsage === 'forced') {
|
|
108
|
+
let fix;
|
|
109
|
+
if (node.arguments[0].type === 'Literal') {
|
|
110
|
+
const {
|
|
111
|
+
value
|
|
112
|
+
} = node.arguments[0];
|
|
113
|
+
const tokenName = value;
|
|
114
|
+
const fallbackValue = tokenDefaultValues[tokenName] || null;
|
|
115
|
+
if (fallbackValue) {
|
|
116
|
+
fix = fixer => fixer.replaceText(node, `${isNodeOfType(node.callee, 'Identifier') ? node.callee.name : 'token'}('${tokenName}', '${fallbackValue}')`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
107
119
|
context.report({
|
|
108
120
|
messageId: 'tokenFallbackEnforced',
|
|
109
|
-
node
|
|
121
|
+
node,
|
|
122
|
+
fix
|
|
110
123
|
});
|
|
111
124
|
} else if (node.arguments.length > 1 && config.fallbackUsage === 'none') {
|
|
112
125
|
if (node.arguments[0].type === 'Literal') {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
+
import { isXcss } from '@atlaskit/eslint-utils/is-supported-import';
|
|
4
5
|
import { Root } from '../../ast-nodes';
|
|
5
6
|
export const isDecendantOfGlobalToken = node => {
|
|
6
7
|
if (isNodeOfType(node, 'CallExpression') && isNodeOfType(node.callee, 'Identifier') && (node.callee.name === 'token' || node.callee.name === 'getTokenValue')) {
|
|
@@ -68,14 +69,13 @@ const cssInJsCallees = ['css', 'styled', 'styled2'];
|
|
|
68
69
|
export const isCssInJsTemplateNode = node => (node === null || node === void 0 ? void 0 : node.type) === 'TaggedTemplateExpression' && node.tag.type === 'MemberExpression' && node.tag.object.type === 'Identifier' && node.tag.object.name === 'styled';
|
|
69
70
|
export const isCssInJsCallNode = node => (node === null || node === void 0 ? void 0 : node.type) === 'CallExpression' && node.callee.type === 'Identifier' && cssInJsCallees.includes(node.callee.name);
|
|
70
71
|
export const isCssInJsObjectNode = node => (node === null || node === void 0 ? void 0 : node.type) === 'CallExpression' && node.callee.type === 'MemberExpression' && node.callee.object.type === 'Identifier' && cssInJsCallees.includes(node.callee.object.name);
|
|
71
|
-
const
|
|
72
|
-
export const isDecendantOfXcssBlock = node => {
|
|
72
|
+
export const isDecendantOfXcssBlock = (node, referencesInScope, importSources) => {
|
|
73
73
|
// xcss contains types for all properties that accept tokens, so ignore xcss for linting as it will report false positives
|
|
74
|
-
if (
|
|
74
|
+
if (node.type === 'CallExpression' && isXcss(node.callee, referencesInScope, importSources)) {
|
|
75
75
|
return true;
|
|
76
76
|
}
|
|
77
77
|
if (node.parent) {
|
|
78
|
-
return isDecendantOfXcssBlock(node.parent);
|
|
78
|
+
return isDecendantOfXcssBlock(node.parent, referencesInScope, importSources);
|
|
79
79
|
}
|
|
80
80
|
return false;
|
|
81
81
|
};
|
|
@@ -2,6 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
3
|
|
|
4
4
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
5
|
+
import { getImportSources } from '@atlaskit/eslint-utils/is-supported-import';
|
|
5
6
|
import { createLintRule } from '../utils/create-rule';
|
|
6
7
|
import { includesHardCodedColor } from '../utils/is-color';
|
|
7
8
|
import { isDecendantOfGlobalToken, isDecendantOfStyleBlock, isDecendantOfType, isDecendantOfXcssBlock } from '../utils/is-node';
|
|
@@ -60,6 +61,14 @@ var createWithConfig = function createWithConfig(initialConfig) {
|
|
|
60
61
|
return ObjectExpression;
|
|
61
62
|
}(function (parentNode) {
|
|
62
63
|
return errorBoundary(function () {
|
|
64
|
+
var _context$getScope = context.getScope(),
|
|
65
|
+
references = _context$getScope.references;
|
|
66
|
+
/**
|
|
67
|
+
* NOTE: This rule doesn't have an `importSources` config option,
|
|
68
|
+
* so this will just be equal to DEFAULT_IMPORT_SOURCES (which is fine)
|
|
69
|
+
*/
|
|
70
|
+
var importSources = getImportSources(context);
|
|
71
|
+
|
|
63
72
|
// To force the correct node type
|
|
64
73
|
if (!isNodeOfType(parentNode, 'ObjectExpression')) {
|
|
65
74
|
return;
|
|
@@ -69,7 +78,7 @@ var createWithConfig = function createWithConfig(initialConfig) {
|
|
|
69
78
|
if (parentNode.parent.type === 'Property') {
|
|
70
79
|
return;
|
|
71
80
|
}
|
|
72
|
-
if (isDecendantOfXcssBlock(parentNode)) {
|
|
81
|
+
if (isDecendantOfXcssBlock(parentNode, references, importSources)) {
|
|
73
82
|
return;
|
|
74
83
|
}
|
|
75
84
|
if (!isDecendantOfStyleBlock(parentNode) && !isDecendantOfType(parentNode, 'JSXExpressionContainer')) {
|
|
@@ -5,6 +5,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
|
|
6
6
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
7
7
|
import renameMapping from '@atlaskit/tokens/rename-mapping';
|
|
8
|
+
import tokenDefaultValues from '@atlaskit/tokens/token-default-values';
|
|
8
9
|
import { getTokenId } from '@atlaskit/tokens/token-ids';
|
|
9
10
|
import tokens from '@atlaskit/tokens/token-names';
|
|
10
11
|
import { createLintRule } from '../utils/create-rule';
|
|
@@ -87,18 +88,30 @@ var rule = createLintRule({
|
|
|
87
88
|
return;
|
|
88
89
|
}
|
|
89
90
|
if (node.arguments.length < 2 && config.fallbackUsage === 'forced') {
|
|
91
|
+
var fix;
|
|
92
|
+
if (node.arguments[0].type === 'Literal') {
|
|
93
|
+
var value = node.arguments[0].value;
|
|
94
|
+
var tokenName = value;
|
|
95
|
+
var fallbackValue = tokenDefaultValues[tokenName] || null;
|
|
96
|
+
if (fallbackValue) {
|
|
97
|
+
fix = function fix(fixer) {
|
|
98
|
+
return fixer.replaceText(node, "".concat(isNodeOfType(node.callee, 'Identifier') ? node.callee.name : 'token', "('").concat(tokenName, "', '").concat(fallbackValue, "')"));
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
90
102
|
context.report({
|
|
91
103
|
messageId: 'tokenFallbackEnforced',
|
|
92
|
-
node: node
|
|
104
|
+
node: node,
|
|
105
|
+
fix: fix
|
|
93
106
|
});
|
|
94
107
|
} else if (node.arguments.length > 1 && config.fallbackUsage === 'none') {
|
|
95
108
|
if (node.arguments[0].type === 'Literal') {
|
|
96
|
-
var
|
|
109
|
+
var _value = node.arguments[0].value;
|
|
97
110
|
context.report({
|
|
98
111
|
messageId: 'tokenFallbackRestricted',
|
|
99
112
|
node: node.arguments[1],
|
|
100
113
|
fix: function fix(fixer) {
|
|
101
|
-
return fixer.replaceText(node, "".concat(isNodeOfType(node.callee, 'Identifier') ? node.callee.name : 'token', "('").concat(
|
|
114
|
+
return fixer.replaceText(node, "".concat(isNodeOfType(node.callee, 'Identifier') ? node.callee.name : 'token', "('").concat(_value, "')"));
|
|
102
115
|
}
|
|
103
116
|
});
|
|
104
117
|
} else {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
+
import { isXcss } from '@atlaskit/eslint-utils/is-supported-import';
|
|
4
5
|
import { Root } from '../../ast-nodes';
|
|
5
6
|
export var isDecendantOfGlobalToken = function isDecendantOfGlobalToken(node) {
|
|
6
7
|
if (isNodeOfType(node, 'CallExpression') && isNodeOfType(node.callee, 'Identifier') && (node.callee.name === 'token' || node.callee.name === 'getTokenValue')) {
|
|
@@ -75,16 +76,13 @@ export var isCssInJsCallNode = function isCssInJsCallNode(node) {
|
|
|
75
76
|
export var isCssInJsObjectNode = function isCssInJsObjectNode(node) {
|
|
76
77
|
return (node === null || node === void 0 ? void 0 : node.type) === 'CallExpression' && node.callee.type === 'MemberExpression' && node.callee.object.type === 'Identifier' && cssInJsCallees.includes(node.callee.object.name);
|
|
77
78
|
};
|
|
78
|
-
var
|
|
79
|
-
return (node === null || node === void 0 ? void 0 : node.type) === 'CallExpression' && node.callee.type === 'Identifier' && node.callee.name === 'xcss';
|
|
80
|
-
};
|
|
81
|
-
export var isDecendantOfXcssBlock = function isDecendantOfXcssBlock(node) {
|
|
79
|
+
export var isDecendantOfXcssBlock = function isDecendantOfXcssBlock(node, referencesInScope, importSources) {
|
|
82
80
|
// xcss contains types for all properties that accept tokens, so ignore xcss for linting as it will report false positives
|
|
83
|
-
if (
|
|
81
|
+
if (node.type === 'CallExpression' && isXcss(node.callee, referencesInScope, importSources)) {
|
|
84
82
|
return true;
|
|
85
83
|
}
|
|
86
84
|
if (node.parent) {
|
|
87
|
-
return isDecendantOfXcssBlock(node.parent);
|
|
85
|
+
return isDecendantOfXcssBlock(node.parent, referencesInScope, importSources);
|
|
88
86
|
}
|
|
89
87
|
return false;
|
|
90
88
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { RuleConfig } from './types';
|
|
2
|
+
import { type RuleConfig } from './types';
|
|
3
3
|
declare const createWithConfig: (initialConfig: RuleConfig) => Rule.RuleModule['create'];
|
|
4
4
|
declare const rule: Rule.RuleModule;
|
|
5
5
|
export default rule;
|
|
@@ -41,8 +41,8 @@ export declare const fontFamilyTokens: ({
|
|
|
41
41
|
state: string;
|
|
42
42
|
introduced: string;
|
|
43
43
|
description: string;
|
|
44
|
-
responsiveSmallerVariant?: undefined;
|
|
45
44
|
deprecated?: undefined;
|
|
45
|
+
responsiveSmallerVariant?: undefined;
|
|
46
46
|
};
|
|
47
47
|
value: string;
|
|
48
48
|
filePath: string;
|
|
@@ -53,8 +53,8 @@ export declare const fontFamilyTokens: ({
|
|
|
53
53
|
state: string;
|
|
54
54
|
introduced: string;
|
|
55
55
|
description: string;
|
|
56
|
-
responsiveSmallerVariant?: undefined;
|
|
57
56
|
deprecated?: undefined;
|
|
57
|
+
responsiveSmallerVariant?: undefined;
|
|
58
58
|
};
|
|
59
59
|
value: string;
|
|
60
60
|
};
|
|
@@ -67,8 +67,8 @@ export declare const fontFamilyTokens: ({
|
|
|
67
67
|
state: string;
|
|
68
68
|
introduced: string;
|
|
69
69
|
description: string;
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
deprecated: string;
|
|
71
|
+
responsiveSmallerVariant?: undefined;
|
|
72
72
|
};
|
|
73
73
|
value: string;
|
|
74
74
|
filePath: string;
|
|
@@ -79,17 +79,10 @@ export declare const fontFamilyTokens: ({
|
|
|
79
79
|
state: string;
|
|
80
80
|
introduced: string;
|
|
81
81
|
description: string;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
};
|
|
85
|
-
value: {
|
|
86
|
-
fontWeight: string;
|
|
87
|
-
fontSize: string;
|
|
88
|
-
lineHeight: string;
|
|
89
|
-
fontFamily: string;
|
|
90
|
-
fontStyle: string;
|
|
91
|
-
letterSpacing: string;
|
|
82
|
+
deprecated: string;
|
|
83
|
+
responsiveSmallerVariant?: undefined;
|
|
92
84
|
};
|
|
85
|
+
value: string;
|
|
93
86
|
};
|
|
94
87
|
name: string;
|
|
95
88
|
path: string[];
|
|
@@ -100,7 +93,7 @@ export declare const fontFamilyTokens: ({
|
|
|
100
93
|
state: string;
|
|
101
94
|
introduced: string;
|
|
102
95
|
description: string;
|
|
103
|
-
responsiveSmallerVariant
|
|
96
|
+
responsiveSmallerVariant: string;
|
|
104
97
|
deprecated?: undefined;
|
|
105
98
|
};
|
|
106
99
|
value: string;
|
|
@@ -112,7 +105,7 @@ export declare const fontFamilyTokens: ({
|
|
|
112
105
|
state: string;
|
|
113
106
|
introduced: string;
|
|
114
107
|
description: string;
|
|
115
|
-
responsiveSmallerVariant
|
|
108
|
+
responsiveSmallerVariant: string;
|
|
116
109
|
deprecated?: undefined;
|
|
117
110
|
};
|
|
118
111
|
value: {
|
|
@@ -133,7 +126,7 @@ export declare const fontFamilyTokens: ({
|
|
|
133
126
|
state: string;
|
|
134
127
|
introduced: string;
|
|
135
128
|
description: string;
|
|
136
|
-
deprecated
|
|
129
|
+
deprecated?: undefined;
|
|
137
130
|
responsiveSmallerVariant?: undefined;
|
|
138
131
|
};
|
|
139
132
|
value: string;
|
|
@@ -145,10 +138,17 @@ export declare const fontFamilyTokens: ({
|
|
|
145
138
|
state: string;
|
|
146
139
|
introduced: string;
|
|
147
140
|
description: string;
|
|
148
|
-
deprecated
|
|
141
|
+
deprecated?: undefined;
|
|
149
142
|
responsiveSmallerVariant?: undefined;
|
|
150
143
|
};
|
|
151
|
-
value:
|
|
144
|
+
value: {
|
|
145
|
+
fontWeight: string;
|
|
146
|
+
fontSize: string;
|
|
147
|
+
lineHeight: string;
|
|
148
|
+
fontFamily: string;
|
|
149
|
+
fontStyle: string;
|
|
150
|
+
letterSpacing: string;
|
|
151
|
+
};
|
|
152
152
|
};
|
|
153
153
|
name: string;
|
|
154
154
|
path: string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Rule } from 'eslint';
|
|
2
|
-
import { CallExpression, EslintNode, Expression, TaggedTemplateExpression } from 'eslint-codemod-utils';
|
|
1
|
+
import type { Rule, Scope } from 'eslint';
|
|
2
|
+
import { type CallExpression, type EslintNode, type Expression, type TaggedTemplateExpression } from 'eslint-codemod-utils';
|
|
3
3
|
export declare const isDecendantOfGlobalToken: (node: EslintNode) => boolean;
|
|
4
4
|
export declare const isDecendantOfType: (node: Rule.Node, type: Rule.Node['type'], skipNode?: boolean) => boolean;
|
|
5
5
|
export declare const isPropertyKey: (node: Rule.Node) => boolean;
|
|
@@ -9,6 +9,6 @@ export declare const isDecendantOfPrimitive: (node: Rule.Node, context: Rule.Rul
|
|
|
9
9
|
export declare const isCssInJsTemplateNode: (node?: Expression | null) => node is TaggedTemplateExpression;
|
|
10
10
|
export declare const isCssInJsCallNode: (node?: Expression | null) => node is CallExpression;
|
|
11
11
|
export declare const isCssInJsObjectNode: (node?: Expression | null) => node is CallExpression;
|
|
12
|
-
export declare const isDecendantOfXcssBlock: (node: Rule.Node) => boolean;
|
|
12
|
+
export declare const isDecendantOfXcssBlock: (node: Rule.Node, referencesInScope: Scope.Reference[], importSources: string[]) => boolean;
|
|
13
13
|
export declare const isDecendantOfStyleBlock: (node: Rule.Node) => boolean;
|
|
14
14
|
export declare const isChildOfType: (node: Rule.Node, type: Rule.Node['type']) => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { RuleConfig } from './types';
|
|
2
|
+
import { type RuleConfig } from './types';
|
|
3
3
|
declare const createWithConfig: (initialConfig: RuleConfig) => Rule.RuleModule['create'];
|
|
4
4
|
declare const rule: Rule.RuleModule;
|
|
5
5
|
export default rule;
|
|
@@ -41,8 +41,8 @@ export declare const fontFamilyTokens: ({
|
|
|
41
41
|
state: string;
|
|
42
42
|
introduced: string;
|
|
43
43
|
description: string;
|
|
44
|
-
responsiveSmallerVariant?: undefined;
|
|
45
44
|
deprecated?: undefined;
|
|
45
|
+
responsiveSmallerVariant?: undefined;
|
|
46
46
|
};
|
|
47
47
|
value: string;
|
|
48
48
|
filePath: string;
|
|
@@ -53,8 +53,8 @@ export declare const fontFamilyTokens: ({
|
|
|
53
53
|
state: string;
|
|
54
54
|
introduced: string;
|
|
55
55
|
description: string;
|
|
56
|
-
responsiveSmallerVariant?: undefined;
|
|
57
56
|
deprecated?: undefined;
|
|
57
|
+
responsiveSmallerVariant?: undefined;
|
|
58
58
|
};
|
|
59
59
|
value: string;
|
|
60
60
|
};
|
|
@@ -67,8 +67,8 @@ export declare const fontFamilyTokens: ({
|
|
|
67
67
|
state: string;
|
|
68
68
|
introduced: string;
|
|
69
69
|
description: string;
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
deprecated: string;
|
|
71
|
+
responsiveSmallerVariant?: undefined;
|
|
72
72
|
};
|
|
73
73
|
value: string;
|
|
74
74
|
filePath: string;
|
|
@@ -79,17 +79,10 @@ export declare const fontFamilyTokens: ({
|
|
|
79
79
|
state: string;
|
|
80
80
|
introduced: string;
|
|
81
81
|
description: string;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
};
|
|
85
|
-
value: {
|
|
86
|
-
fontWeight: string;
|
|
87
|
-
fontSize: string;
|
|
88
|
-
lineHeight: string;
|
|
89
|
-
fontFamily: string;
|
|
90
|
-
fontStyle: string;
|
|
91
|
-
letterSpacing: string;
|
|
82
|
+
deprecated: string;
|
|
83
|
+
responsiveSmallerVariant?: undefined;
|
|
92
84
|
};
|
|
85
|
+
value: string;
|
|
93
86
|
};
|
|
94
87
|
name: string;
|
|
95
88
|
path: string[];
|
|
@@ -100,7 +93,7 @@ export declare const fontFamilyTokens: ({
|
|
|
100
93
|
state: string;
|
|
101
94
|
introduced: string;
|
|
102
95
|
description: string;
|
|
103
|
-
responsiveSmallerVariant
|
|
96
|
+
responsiveSmallerVariant: string;
|
|
104
97
|
deprecated?: undefined;
|
|
105
98
|
};
|
|
106
99
|
value: string;
|
|
@@ -112,7 +105,7 @@ export declare const fontFamilyTokens: ({
|
|
|
112
105
|
state: string;
|
|
113
106
|
introduced: string;
|
|
114
107
|
description: string;
|
|
115
|
-
responsiveSmallerVariant
|
|
108
|
+
responsiveSmallerVariant: string;
|
|
116
109
|
deprecated?: undefined;
|
|
117
110
|
};
|
|
118
111
|
value: {
|
|
@@ -133,7 +126,7 @@ export declare const fontFamilyTokens: ({
|
|
|
133
126
|
state: string;
|
|
134
127
|
introduced: string;
|
|
135
128
|
description: string;
|
|
136
|
-
deprecated
|
|
129
|
+
deprecated?: undefined;
|
|
137
130
|
responsiveSmallerVariant?: undefined;
|
|
138
131
|
};
|
|
139
132
|
value: string;
|
|
@@ -145,10 +138,17 @@ export declare const fontFamilyTokens: ({
|
|
|
145
138
|
state: string;
|
|
146
139
|
introduced: string;
|
|
147
140
|
description: string;
|
|
148
|
-
deprecated
|
|
141
|
+
deprecated?: undefined;
|
|
149
142
|
responsiveSmallerVariant?: undefined;
|
|
150
143
|
};
|
|
151
|
-
value:
|
|
144
|
+
value: {
|
|
145
|
+
fontWeight: string;
|
|
146
|
+
fontSize: string;
|
|
147
|
+
lineHeight: string;
|
|
148
|
+
fontFamily: string;
|
|
149
|
+
fontStyle: string;
|
|
150
|
+
letterSpacing: string;
|
|
151
|
+
};
|
|
152
152
|
};
|
|
153
153
|
name: string;
|
|
154
154
|
path: string[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Rule } from 'eslint';
|
|
2
|
-
import { CallExpression, EslintNode, Expression, TaggedTemplateExpression } from 'eslint-codemod-utils';
|
|
1
|
+
import type { Rule, Scope } from 'eslint';
|
|
2
|
+
import { type CallExpression, type EslintNode, type Expression, type TaggedTemplateExpression } from 'eslint-codemod-utils';
|
|
3
3
|
export declare const isDecendantOfGlobalToken: (node: EslintNode) => boolean;
|
|
4
4
|
export declare const isDecendantOfType: (node: Rule.Node, type: Rule.Node['type'], skipNode?: boolean) => boolean;
|
|
5
5
|
export declare const isPropertyKey: (node: Rule.Node) => boolean;
|
|
@@ -9,6 +9,6 @@ export declare const isDecendantOfPrimitive: (node: Rule.Node, context: Rule.Rul
|
|
|
9
9
|
export declare const isCssInJsTemplateNode: (node?: Expression | null) => node is TaggedTemplateExpression;
|
|
10
10
|
export declare const isCssInJsCallNode: (node?: Expression | null) => node is CallExpression;
|
|
11
11
|
export declare const isCssInJsObjectNode: (node?: Expression | null) => node is CallExpression;
|
|
12
|
-
export declare const isDecendantOfXcssBlock: (node: Rule.Node) => boolean;
|
|
12
|
+
export declare const isDecendantOfXcssBlock: (node: Rule.Node, referencesInScope: Scope.Reference[], importSources: string[]) => boolean;
|
|
13
13
|
export declare const isDecendantOfStyleBlock: (node: Rule.Node) => boolean;
|
|
14
14
|
export declare const isChildOfType: (node: Rule.Node, type: Rule.Node['type']) => boolean;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/eslint-plugin-design-system",
|
|
3
3
|
"description": "The essential plugin for use with the Atlassian Design System.",
|
|
4
|
-
"version": "10.
|
|
4
|
+
"version": "10.1.0",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"publishConfig": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@af/formatting": "*",
|
|
57
57
|
"@atlaskit/ds-lib": "^2.3.0",
|
|
58
|
-
"@atlaskit/theme": "^12.
|
|
58
|
+
"@atlaskit/theme": "^12.8.0",
|
|
59
59
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
60
60
|
"@atlassian/codegen": "*",
|
|
61
61
|
"@atlassian/eslint-utils": "^0.4.0",
|