@atlaskit/eslint-plugin-design-system 10.24.1 → 10.26.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 +23 -0
- package/README.md +2 -1
- package/dist/cjs/ast-nodes/jsx-attribute.js +8 -0
- package/dist/cjs/presets/all-flat.codegen.js +2 -1
- package/dist/cjs/presets/all.codegen.js +2 -1
- package/dist/cjs/presets/recommended-flat.codegen.js +2 -1
- package/dist/cjs/presets/recommended.codegen.js +2 -1
- package/dist/cjs/rules/index.codegen.js +3 -1
- package/dist/cjs/rules/no-deprecated-imports/checks.js +201 -0
- package/dist/cjs/rules/no-deprecated-imports/constants.js +8 -0
- package/dist/cjs/rules/no-deprecated-imports/handlers/icon.js +204 -0
- package/dist/cjs/rules/no-deprecated-imports/index.js +25 -118
- package/dist/cjs/rules/use-datetime-picker-calendar-button/index.js +187 -0
- package/dist/cjs/rules/utils/get-deprecated-config.js +9 -1
- package/dist/es2019/ast-nodes/jsx-attribute.js +8 -0
- package/dist/es2019/presets/all-flat.codegen.js +2 -1
- package/dist/es2019/presets/all.codegen.js +2 -1
- package/dist/es2019/presets/recommended-flat.codegen.js +2 -1
- package/dist/es2019/presets/recommended.codegen.js +2 -1
- package/dist/es2019/rules/index.codegen.js +3 -1
- package/dist/es2019/rules/no-deprecated-imports/checks.js +175 -0
- package/dist/es2019/rules/no-deprecated-imports/constants.js +2 -0
- package/dist/es2019/rules/no-deprecated-imports/handlers/icon.js +153 -0
- package/dist/es2019/rules/no-deprecated-imports/index.js +23 -103
- package/dist/es2019/rules/use-datetime-picker-calendar-button/index.js +173 -0
- package/dist/es2019/rules/utils/get-deprecated-config.js +12 -1
- package/dist/esm/ast-nodes/jsx-attribute.js +8 -0
- package/dist/esm/presets/all-flat.codegen.js +2 -1
- package/dist/esm/presets/all.codegen.js +2 -1
- package/dist/esm/presets/recommended-flat.codegen.js +2 -1
- package/dist/esm/presets/recommended.codegen.js +2 -1
- package/dist/esm/rules/index.codegen.js +3 -1
- package/dist/esm/rules/no-deprecated-imports/checks.js +195 -0
- package/dist/esm/rules/no-deprecated-imports/constants.js +2 -0
- package/dist/esm/rules/no-deprecated-imports/handlers/icon.js +197 -0
- package/dist/esm/rules/no-deprecated-imports/index.js +23 -117
- package/dist/esm/rules/use-datetime-picker-calendar-button/index.js +181 -0
- package/dist/esm/rules/utils/get-deprecated-config.js +9 -1
- package/dist/types/ast-nodes/jsx-attribute.d.ts +3 -0
- package/dist/types/index.codegen.d.ts +14 -9
- package/dist/types/presets/all-flat.codegen.d.ts +2 -1
- package/dist/types/presets/all.codegen.d.ts +2 -1
- package/dist/types/presets/recommended-flat.codegen.d.ts +2 -1
- package/dist/types/presets/recommended.codegen.d.ts +2 -1
- package/dist/types/rules/index.codegen.d.ts +2 -3
- package/dist/types/rules/no-deprecated-imports/checks.d.ts +11 -0
- package/dist/types/rules/no-deprecated-imports/constants.d.ts +2 -0
- package/dist/types/rules/no-deprecated-imports/handlers/icon.d.ts +38 -0
- package/dist/types/rules/no-deprecated-imports/index.d.ts +1 -7
- package/dist/types/rules/use-datetime-picker-calendar-button/index.d.ts +7 -0
- package/dist/types/rules/utils/types.d.ts +1 -0
- package/dist/types-ts4.5/ast-nodes/jsx-attribute.d.ts +3 -0
- package/dist/types-ts4.5/index.codegen.d.ts +14 -15
- package/dist/types-ts4.5/presets/all-flat.codegen.d.ts +2 -1
- package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
- package/dist/types-ts4.5/presets/recommended-flat.codegen.d.ts +2 -1
- package/dist/types-ts4.5/presets/recommended.codegen.d.ts +2 -1
- package/dist/types-ts4.5/rules/index.codegen.d.ts +2 -5
- package/dist/types-ts4.5/rules/no-deprecated-imports/checks.d.ts +11 -0
- package/dist/types-ts4.5/rules/no-deprecated-imports/constants.d.ts +2 -0
- package/dist/types-ts4.5/rules/no-deprecated-imports/handlers/icon.d.ts +38 -0
- package/dist/types-ts4.5/rules/no-deprecated-imports/index.d.ts +1 -9
- package/dist/types-ts4.5/rules/use-datetime-picker-calendar-button/index.d.ts +7 -0
- package/dist/types-ts4.5/rules/utils/types.d.ts +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
+
|
|
3
|
+
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
+
import { JSXAttribute } from '../../ast-nodes/jsx-attribute';
|
|
5
|
+
import { JSXElementHelper } from '../../ast-nodes/jsx-element';
|
|
6
|
+
import { createLintRule } from '../utils/create-rule';
|
|
7
|
+
var DATE_PICKER = 'DatePicker';
|
|
8
|
+
var DATETIME_PICKER = 'DateTimePicker';
|
|
9
|
+
var PROP_NAME = 'shouldShowCalendarButton';
|
|
10
|
+
|
|
11
|
+
// Lint rule message
|
|
12
|
+
var message = '`shouldShowCalendarButton` should be set to `true` to make date picker accessible.';
|
|
13
|
+
|
|
14
|
+
// Fix messages
|
|
15
|
+
export var addCalendarButtonProp = 'Add `shouldShowCalendarButton` prop.';
|
|
16
|
+
export var setCalendarButtonPropToTrue = 'Set `shouldShowCalendarButton` prop to `true`.';
|
|
17
|
+
export var addCalendarButtonProperty = 'Add `shouldShowCalendarButton: true` to `datePickerProps`.';
|
|
18
|
+
export var setCalendarButtonPropertyToTrue = 'Set `shouldShowCalendarButton` property in `datePickerProps` to `true`.';
|
|
19
|
+
var datePickerJSXElement = function datePickerJSXElement(node, context) {
|
|
20
|
+
var prop = JSXElementHelper.getAttributeByName(node, PROP_NAME);
|
|
21
|
+
|
|
22
|
+
// If the prop exists
|
|
23
|
+
if (prop) {
|
|
24
|
+
var attrValue = JSXAttribute.getValue(prop);
|
|
25
|
+
// If the value is a boolean with value `false`
|
|
26
|
+
if ((attrValue === null || attrValue === void 0 ? void 0 : attrValue.type) === 'ExpressionStatement Literal' && (attrValue === null || attrValue === void 0 ? void 0 : attrValue.value) === false) {
|
|
27
|
+
return context.report({
|
|
28
|
+
node: prop,
|
|
29
|
+
messageId: 'datePickerCalendarButtonShouldBeShown',
|
|
30
|
+
suggest: [{
|
|
31
|
+
desc: setCalendarButtonPropToTrue,
|
|
32
|
+
fix: function fix(fixer) {
|
|
33
|
+
return [fixer.replaceText(prop, PROP_NAME)];
|
|
34
|
+
}
|
|
35
|
+
}]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
// If the prop does not exist
|
|
39
|
+
} else {
|
|
40
|
+
return context.report({
|
|
41
|
+
node: node.openingElement,
|
|
42
|
+
messageId: 'datePickerMissingCalendarButtonProp',
|
|
43
|
+
suggest: [{
|
|
44
|
+
desc: addCalendarButtonProp,
|
|
45
|
+
fix: function fix(fixer) {
|
|
46
|
+
return [fixer.insertTextAfter(node.openingElement.name, " ".concat(PROP_NAME))];
|
|
47
|
+
}
|
|
48
|
+
}]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var dateTimePickerJSXElement = function dateTimePickerJSXElement(node, context) {
|
|
53
|
+
var _datePickerProp$value, _expression$propertie;
|
|
54
|
+
var datePickerProp = JSXElementHelper.getAttributeByName(node, 'datePickerProps');
|
|
55
|
+
|
|
56
|
+
// If the `datePickerProps` prop does not exist or is not an expression
|
|
57
|
+
// container (the latter being essentially unprecedented, against type
|
|
58
|
+
// guidelines, and useless)
|
|
59
|
+
if (!datePickerProp || ((_datePickerProp$value = datePickerProp.value) === null || _datePickerProp$value === void 0 ? void 0 : _datePickerProp$value.type) !== 'JSXExpressionContainer') {
|
|
60
|
+
return context.report({
|
|
61
|
+
node: node.openingElement,
|
|
62
|
+
messageId: 'dateTimePickerMissingCalendarButtonProp',
|
|
63
|
+
suggest: [{
|
|
64
|
+
desc: addCalendarButtonProperty,
|
|
65
|
+
fix: function fix(fixer) {
|
|
66
|
+
return [fixer.insertTextAfter(node.openingElement.name, " datePickerProps={{ ".concat(PROP_NAME, ": true }}"))];
|
|
67
|
+
}
|
|
68
|
+
}]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Had to cast all these things because ESLint can't hang here. The
|
|
73
|
+
// types are just abjectly wrong from what I can log.
|
|
74
|
+
var expression = datePickerProp.value.expression;
|
|
75
|
+
// If it is not an analyzable expression, like a variable or something, skip
|
|
76
|
+
// it.
|
|
77
|
+
if (!isNodeOfType(datePickerProp.value.expression, 'ObjectExpression')) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
var prop = expression === null || expression === void 0 || (_expression$propertie = expression.properties) === null || _expression$propertie === void 0 ? void 0 : _expression$propertie.find(function (property) {
|
|
81
|
+
return property.type === 'Property' && property.key.name === PROP_NAME;
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// If the `shouldShowCalendarButton` prop does not exist in `datePickerProps`
|
|
85
|
+
if (!prop) {
|
|
86
|
+
return context.report({
|
|
87
|
+
node: datePickerProp,
|
|
88
|
+
messageId: 'dateTimePickerMissingCalendarButtonProp',
|
|
89
|
+
suggest: [{
|
|
90
|
+
desc: addCalendarButtonProperty,
|
|
91
|
+
fix: function fix(fixer) {
|
|
92
|
+
// If it has existing properties
|
|
93
|
+
if (expression.properties.length > 0) {
|
|
94
|
+
// Needs following comma to not disrupt existing properties inside `datePickerProps`
|
|
95
|
+
return [fixer.insertTextBefore(expression.properties[0], "".concat(PROP_NAME, ": true,"))];
|
|
96
|
+
// Else it's an empty object
|
|
97
|
+
} else {
|
|
98
|
+
return [fixer.replaceText(expression, "{ ".concat(PROP_NAME, ": true }"))];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}]
|
|
102
|
+
});
|
|
103
|
+
// If the `shouldShowCalendarButton` property exists and it's value is `false`
|
|
104
|
+
} else if (isNodeOfType(prop.value, 'Literal') && prop.value.value !== true) {
|
|
105
|
+
return context.report({
|
|
106
|
+
node: datePickerProp,
|
|
107
|
+
messageId: 'dateTimePickerCalendarButtonShouldBeShown',
|
|
108
|
+
suggest: [{
|
|
109
|
+
desc: setCalendarButtonPropertyToTrue,
|
|
110
|
+
// Needs following comma to not disrupt existing properties inside `datePickerProps`
|
|
111
|
+
fix: function fix(fixer) {
|
|
112
|
+
return [fixer.replaceText(prop, "".concat(PROP_NAME, ": true,"))];
|
|
113
|
+
}
|
|
114
|
+
}]
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
var rule = createLintRule({
|
|
119
|
+
meta: {
|
|
120
|
+
name: 'use-datetime-picker-calendar-button',
|
|
121
|
+
type: 'suggestion',
|
|
122
|
+
fixable: 'code',
|
|
123
|
+
hasSuggestions: true,
|
|
124
|
+
docs: {
|
|
125
|
+
description: "Encourages makers to use calendar button in Atlassian Design System's date picker and datetime picker components.",
|
|
126
|
+
recommended: true,
|
|
127
|
+
severity: 'warn'
|
|
128
|
+
},
|
|
129
|
+
messages: {
|
|
130
|
+
dateTimePickerMissingCalendarButtonProp: "In `datePickerProps`, ".concat(message),
|
|
131
|
+
datePickerMissingCalendarButtonProp: message,
|
|
132
|
+
dateTimePickerCalendarButtonShouldBeShown: "In `datePickerProps`, ".concat(message),
|
|
133
|
+
datePickerCalendarButtonShouldBeShown: message
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
create: function create(context) {
|
|
137
|
+
// List of component's locally imported names that match
|
|
138
|
+
var contextLocalIdentifier = [];
|
|
139
|
+
var contextImportedIdentifier = [];
|
|
140
|
+
return {
|
|
141
|
+
// Only run rule in files where the package is imported
|
|
142
|
+
ImportDeclaration: function ImportDeclaration(node) {
|
|
143
|
+
var _node$specifiers;
|
|
144
|
+
var datetimePickerIdentifier = (_node$specifiers = node.specifiers) === null || _node$specifiers === void 0 ? void 0 : _node$specifiers.filter(function (spec) {
|
|
145
|
+
if (node.source.value === '@atlaskit/datetime-picker') {
|
|
146
|
+
var _spec$imported;
|
|
147
|
+
return isNodeOfType(spec, 'ImportSpecifier') && [DATE_PICKER, DATETIME_PICKER].includes((_spec$imported = spec.imported) === null || _spec$imported === void 0 ? void 0 : _spec$imported.name);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
datetimePickerIdentifier.forEach(function (identifier) {
|
|
151
|
+
var imported = identifier.imported,
|
|
152
|
+
local = identifier.local;
|
|
153
|
+
contextLocalIdentifier.push(local.name);
|
|
154
|
+
contextImportedIdentifier.push(imported.name);
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
JSXElement: function JSXElement(node) {
|
|
158
|
+
if (!isNodeOfType(node, 'JSXElement')) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (!isNodeOfType(node.openingElement.name, 'JSXIdentifier')) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
var name = node.openingElement.name.name;
|
|
165
|
+
var localIndex = contextLocalIdentifier.indexOf(name);
|
|
166
|
+
|
|
167
|
+
// If this component does not match what we're looking for, quit early
|
|
168
|
+
if (localIndex === -1) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
var importedName = contextImportedIdentifier[localIndex];
|
|
172
|
+
if (importedName === DATE_PICKER) {
|
|
173
|
+
return datePickerJSXElement(node, context);
|
|
174
|
+
} else if (importedName === DATETIME_PICKER) {
|
|
175
|
+
return dateTimePickerJSXElement(node, context);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
export default rule;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1
4
|
import fs from 'fs';
|
|
2
5
|
import path from 'path';
|
|
6
|
+
import { deprecatedCore as deprecatedIconLabCore } from '@atlaskit/icon-lab/deprecated-map';
|
|
7
|
+
import { deprecatedCore as deprecatedIconCore, deprecatedUtility as deprecatedIconUtility } from '@atlaskit/icon/deprecated-map';
|
|
3
8
|
export var getConfig = function getConfig(specifier) {
|
|
4
9
|
var configPath = path.resolve(__dirname, '..', '..', '..', 'configs', 'deprecated.json');
|
|
5
10
|
var source = fs.readFileSync(configPath, 'utf8');
|
|
6
11
|
var parsedConfig = JSON.parse(source);
|
|
7
|
-
|
|
12
|
+
var combinedConfig = _objectSpread(_objectSpread({}, parsedConfig), {}, {
|
|
13
|
+
imports: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, parsedConfig.imports), deprecatedIconCore), deprecatedIconUtility), deprecatedIconLabCore)
|
|
14
|
+
});
|
|
15
|
+
return combinedConfig[specifier];
|
|
8
16
|
};
|
|
@@ -18,6 +18,9 @@ declare const HelperJSXAttribute: {
|
|
|
18
18
|
getValue(node: JSXAttribute): {
|
|
19
19
|
type: 'ExpressionStatement';
|
|
20
20
|
value: string;
|
|
21
|
+
} | {
|
|
22
|
+
type: 'ExpressionStatement Literal';
|
|
23
|
+
value: string | number | bigint | boolean | RegExp | null | undefined;
|
|
21
24
|
} | {
|
|
22
25
|
type: 'Literal';
|
|
23
26
|
value: string;
|
|
@@ -17,9 +17,7 @@ export declare const plugin: {
|
|
|
17
17
|
deprecatedConfig: import("./rules/utils/types").DeprecatedConfig;
|
|
18
18
|
}], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
19
19
|
'no-deprecated-design-token-usage': import("eslint").Rule.RuleModule;
|
|
20
|
-
'no-deprecated-imports': import("
|
|
21
|
-
deprecatedConfig: import("./rules/utils/types").DeprecatedConfig;
|
|
22
|
-
}], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
20
|
+
'no-deprecated-imports': import("eslint").Rule.RuleModule;
|
|
23
21
|
'no-direct-use-of-web-platform-drag-and-drop': import("eslint").Rule.RuleModule;
|
|
24
22
|
'no-empty-styled-expression': import("eslint").Rule.RuleModule;
|
|
25
23
|
'no-exported-css': import("eslint").Rule.RuleModule;
|
|
@@ -39,6 +37,7 @@ export declare const plugin: {
|
|
|
39
37
|
'no-unsupported-drag-and-drop-libraries': import("eslint").Rule.RuleModule;
|
|
40
38
|
'prefer-primitives': import("eslint").Rule.RuleModule;
|
|
41
39
|
'use-button-group-label': import("eslint").Rule.RuleModule;
|
|
40
|
+
'use-datetime-picker-calendar-button': import("eslint").Rule.RuleModule;
|
|
42
41
|
'use-drawer-label': import("eslint").Rule.RuleModule;
|
|
43
42
|
'use-heading': import("eslint").Rule.RuleModule;
|
|
44
43
|
'use-heading-level-in-spotlight-card': import("eslint").Rule.RuleModule;
|
|
@@ -89,6 +88,7 @@ export declare const plugin: {
|
|
|
89
88
|
readonly '@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': "error";
|
|
90
89
|
readonly '@atlaskit/design-system/prefer-primitives': "warn";
|
|
91
90
|
readonly '@atlaskit/design-system/use-button-group-label': "warn";
|
|
91
|
+
readonly '@atlaskit/design-system/use-datetime-picker-calendar-button': "warn";
|
|
92
92
|
readonly '@atlaskit/design-system/use-drawer-label': "warn";
|
|
93
93
|
readonly '@atlaskit/design-system/use-heading': "warn";
|
|
94
94
|
readonly '@atlaskit/design-system/use-heading-level-in-spotlight-card': "warn";
|
|
@@ -141,6 +141,7 @@ export declare const plugin: {
|
|
|
141
141
|
readonly '@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': "error";
|
|
142
142
|
readonly '@atlaskit/design-system/prefer-primitives': "warn";
|
|
143
143
|
readonly '@atlaskit/design-system/use-button-group-label': "warn";
|
|
144
|
+
readonly '@atlaskit/design-system/use-datetime-picker-calendar-button': "warn";
|
|
144
145
|
readonly '@atlaskit/design-system/use-drawer-label': "warn";
|
|
145
146
|
readonly '@atlaskit/design-system/use-heading': "warn";
|
|
146
147
|
readonly '@atlaskit/design-system/use-heading-level-in-spotlight-card': "warn";
|
|
@@ -180,6 +181,7 @@ export declare const plugin: {
|
|
|
180
181
|
readonly '@atlaskit/design-system/no-unsafe-style-overrides': "warn";
|
|
181
182
|
readonly '@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': "error";
|
|
182
183
|
readonly '@atlaskit/design-system/use-button-group-label': "warn";
|
|
184
|
+
readonly '@atlaskit/design-system/use-datetime-picker-calendar-button': "warn";
|
|
183
185
|
readonly '@atlaskit/design-system/use-drawer-label': "warn";
|
|
184
186
|
readonly '@atlaskit/design-system/use-heading-level-in-spotlight-card': "warn";
|
|
185
187
|
readonly '@atlaskit/design-system/use-href-in-link-item': "warn";
|
|
@@ -216,6 +218,7 @@ export declare const plugin: {
|
|
|
216
218
|
readonly '@atlaskit/design-system/no-unsafe-style-overrides': "warn";
|
|
217
219
|
readonly '@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': "error";
|
|
218
220
|
readonly '@atlaskit/design-system/use-button-group-label': "warn";
|
|
221
|
+
readonly '@atlaskit/design-system/use-datetime-picker-calendar-button': "warn";
|
|
219
222
|
readonly '@atlaskit/design-system/use-drawer-label': "warn";
|
|
220
223
|
readonly '@atlaskit/design-system/use-heading-level-in-spotlight-card': "warn";
|
|
221
224
|
readonly '@atlaskit/design-system/use-href-in-link-item': "warn";
|
|
@@ -265,6 +268,7 @@ export declare const configs: {
|
|
|
265
268
|
readonly '@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': "error";
|
|
266
269
|
readonly '@atlaskit/design-system/prefer-primitives': "warn";
|
|
267
270
|
readonly '@atlaskit/design-system/use-button-group-label': "warn";
|
|
271
|
+
readonly '@atlaskit/design-system/use-datetime-picker-calendar-button': "warn";
|
|
268
272
|
readonly '@atlaskit/design-system/use-drawer-label': "warn";
|
|
269
273
|
readonly '@atlaskit/design-system/use-heading': "warn";
|
|
270
274
|
readonly '@atlaskit/design-system/use-heading-level-in-spotlight-card': "warn";
|
|
@@ -303,9 +307,7 @@ export declare const configs: {
|
|
|
303
307
|
deprecatedConfig: import("./rules/utils/types").DeprecatedConfig;
|
|
304
308
|
}], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
305
309
|
'no-deprecated-design-token-usage': import("eslint").Rule.RuleModule;
|
|
306
|
-
'no-deprecated-imports': import("
|
|
307
|
-
deprecatedConfig: import("./rules/utils/types").DeprecatedConfig;
|
|
308
|
-
}], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
310
|
+
'no-deprecated-imports': import("eslint").Rule.RuleModule;
|
|
309
311
|
'no-direct-use-of-web-platform-drag-and-drop': import("eslint").Rule.RuleModule;
|
|
310
312
|
'no-empty-styled-expression': import("eslint").Rule.RuleModule;
|
|
311
313
|
'no-exported-css': import("eslint").Rule.RuleModule;
|
|
@@ -325,6 +327,7 @@ export declare const configs: {
|
|
|
325
327
|
'no-unsupported-drag-and-drop-libraries': import("eslint").Rule.RuleModule;
|
|
326
328
|
'prefer-primitives': import("eslint").Rule.RuleModule;
|
|
327
329
|
'use-button-group-label': import("eslint").Rule.RuleModule;
|
|
330
|
+
'use-datetime-picker-calendar-button': import("eslint").Rule.RuleModule;
|
|
328
331
|
'use-drawer-label': import("eslint").Rule.RuleModule;
|
|
329
332
|
'use-heading': import("eslint").Rule.RuleModule;
|
|
330
333
|
'use-heading-level-in-spotlight-card': import("eslint").Rule.RuleModule;
|
|
@@ -375,6 +378,7 @@ export declare const configs: {
|
|
|
375
378
|
readonly '@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': "error";
|
|
376
379
|
readonly '@atlaskit/design-system/prefer-primitives': "warn";
|
|
377
380
|
readonly '@atlaskit/design-system/use-button-group-label': "warn";
|
|
381
|
+
readonly '@atlaskit/design-system/use-datetime-picker-calendar-button': "warn";
|
|
378
382
|
readonly '@atlaskit/design-system/use-drawer-label': "warn";
|
|
379
383
|
readonly '@atlaskit/design-system/use-heading': "warn";
|
|
380
384
|
readonly '@atlaskit/design-system/use-heading-level-in-spotlight-card': "warn";
|
|
@@ -414,6 +418,7 @@ export declare const configs: {
|
|
|
414
418
|
readonly '@atlaskit/design-system/no-unsafe-style-overrides': "warn";
|
|
415
419
|
readonly '@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': "error";
|
|
416
420
|
readonly '@atlaskit/design-system/use-button-group-label': "warn";
|
|
421
|
+
readonly '@atlaskit/design-system/use-datetime-picker-calendar-button': "warn";
|
|
417
422
|
readonly '@atlaskit/design-system/use-drawer-label': "warn";
|
|
418
423
|
readonly '@atlaskit/design-system/use-heading-level-in-spotlight-card': "warn";
|
|
419
424
|
readonly '@atlaskit/design-system/use-href-in-link-item': "warn";
|
|
@@ -447,9 +452,7 @@ export declare const configs: {
|
|
|
447
452
|
deprecatedConfig: import("./rules/utils/types").DeprecatedConfig;
|
|
448
453
|
}], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
449
454
|
'no-deprecated-design-token-usage': import("eslint").Rule.RuleModule;
|
|
450
|
-
'no-deprecated-imports': import("
|
|
451
|
-
deprecatedConfig: import("./rules/utils/types").DeprecatedConfig;
|
|
452
|
-
}], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
455
|
+
'no-deprecated-imports': import("eslint").Rule.RuleModule;
|
|
453
456
|
'no-direct-use-of-web-platform-drag-and-drop': import("eslint").Rule.RuleModule;
|
|
454
457
|
'no-empty-styled-expression': import("eslint").Rule.RuleModule;
|
|
455
458
|
'no-exported-css': import("eslint").Rule.RuleModule;
|
|
@@ -469,6 +472,7 @@ export declare const configs: {
|
|
|
469
472
|
'no-unsupported-drag-and-drop-libraries': import("eslint").Rule.RuleModule;
|
|
470
473
|
'prefer-primitives': import("eslint").Rule.RuleModule;
|
|
471
474
|
'use-button-group-label': import("eslint").Rule.RuleModule;
|
|
475
|
+
'use-datetime-picker-calendar-button': import("eslint").Rule.RuleModule;
|
|
472
476
|
'use-drawer-label': import("eslint").Rule.RuleModule;
|
|
473
477
|
'use-heading': import("eslint").Rule.RuleModule;
|
|
474
478
|
'use-heading-level-in-spotlight-card': import("eslint").Rule.RuleModule;
|
|
@@ -508,6 +512,7 @@ export declare const configs: {
|
|
|
508
512
|
readonly '@atlaskit/design-system/no-unsafe-style-overrides': "warn";
|
|
509
513
|
readonly '@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': "error";
|
|
510
514
|
readonly '@atlaskit/design-system/use-button-group-label': "warn";
|
|
515
|
+
readonly '@atlaskit/design-system/use-datetime-picker-calendar-button': "warn";
|
|
511
516
|
readonly '@atlaskit/design-system/use-drawer-label': "warn";
|
|
512
517
|
readonly '@atlaskit/design-system/use-heading-level-in-spotlight-card': "warn";
|
|
513
518
|
readonly '@atlaskit/design-system/use-href-in-link-item': "warn";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::72c978e91d268fe1463898bd263385bc>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -36,6 +36,7 @@ declare const _default: {
|
|
|
36
36
|
readonly '@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': "error";
|
|
37
37
|
readonly '@atlaskit/design-system/prefer-primitives': "warn";
|
|
38
38
|
readonly '@atlaskit/design-system/use-button-group-label': "warn";
|
|
39
|
+
readonly '@atlaskit/design-system/use-datetime-picker-calendar-button': "warn";
|
|
39
40
|
readonly '@atlaskit/design-system/use-drawer-label': "warn";
|
|
40
41
|
readonly '@atlaskit/design-system/use-heading': "warn";
|
|
41
42
|
readonly '@atlaskit/design-system/use-heading-level-in-spotlight-card': "warn";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::5bfdac53d9eb0cc8f885ce996861719e>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -36,6 +36,7 @@ declare const _default: {
|
|
|
36
36
|
readonly '@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': "error";
|
|
37
37
|
readonly '@atlaskit/design-system/prefer-primitives': "warn";
|
|
38
38
|
readonly '@atlaskit/design-system/use-button-group-label': "warn";
|
|
39
|
+
readonly '@atlaskit/design-system/use-datetime-picker-calendar-button': "warn";
|
|
39
40
|
readonly '@atlaskit/design-system/use-drawer-label': "warn";
|
|
40
41
|
readonly '@atlaskit/design-system/use-heading': "warn";
|
|
41
42
|
readonly '@atlaskit/design-system/use-heading-level-in-spotlight-card': "warn";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::2c1f5cd2494143a83d590243d7ebf539>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -25,6 +25,7 @@ declare const _default: {
|
|
|
25
25
|
readonly '@atlaskit/design-system/no-unsafe-style-overrides': "warn";
|
|
26
26
|
readonly '@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': "error";
|
|
27
27
|
readonly '@atlaskit/design-system/use-button-group-label': "warn";
|
|
28
|
+
readonly '@atlaskit/design-system/use-datetime-picker-calendar-button': "warn";
|
|
28
29
|
readonly '@atlaskit/design-system/use-drawer-label': "warn";
|
|
29
30
|
readonly '@atlaskit/design-system/use-heading-level-in-spotlight-card': "warn";
|
|
30
31
|
readonly '@atlaskit/design-system/use-href-in-link-item': "warn";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::9aeb2fd0b5bde21f6ef61b407d0d32ab>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -25,6 +25,7 @@ declare const _default: {
|
|
|
25
25
|
readonly '@atlaskit/design-system/no-unsafe-style-overrides': "warn";
|
|
26
26
|
readonly '@atlaskit/design-system/no-unsupported-drag-and-drop-libraries': "error";
|
|
27
27
|
readonly '@atlaskit/design-system/use-button-group-label': "warn";
|
|
28
|
+
readonly '@atlaskit/design-system/use-datetime-picker-calendar-button': "warn";
|
|
28
29
|
readonly '@atlaskit/design-system/use-drawer-label': "warn";
|
|
29
30
|
readonly '@atlaskit/design-system/use-heading-level-in-spotlight-card': "warn";
|
|
30
31
|
readonly '@atlaskit/design-system/use-href-in-link-item': "warn";
|
|
@@ -12,9 +12,7 @@ export declare const rules: {
|
|
|
12
12
|
deprecatedConfig: import("./utils/types").DeprecatedConfig;
|
|
13
13
|
}], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
14
14
|
'no-deprecated-design-token-usage': import("eslint").Rule.RuleModule;
|
|
15
|
-
'no-deprecated-imports': import("
|
|
16
|
-
deprecatedConfig: import("./utils/types").DeprecatedConfig;
|
|
17
|
-
}], import("@typescript-eslint/utils/dist/ts-eslint").RuleListener>;
|
|
15
|
+
'no-deprecated-imports': import("eslint").Rule.RuleModule;
|
|
18
16
|
'no-direct-use-of-web-platform-drag-and-drop': import("eslint").Rule.RuleModule;
|
|
19
17
|
'no-empty-styled-expression': import("eslint").Rule.RuleModule;
|
|
20
18
|
'no-exported-css': import("eslint").Rule.RuleModule;
|
|
@@ -34,6 +32,7 @@ export declare const rules: {
|
|
|
34
32
|
'no-unsupported-drag-and-drop-libraries': import("eslint").Rule.RuleModule;
|
|
35
33
|
'prefer-primitives': import("eslint").Rule.RuleModule;
|
|
36
34
|
'use-button-group-label': import("eslint").Rule.RuleModule;
|
|
35
|
+
'use-datetime-picker-calendar-button': import("eslint").Rule.RuleModule;
|
|
37
36
|
'use-drawer-label': import("eslint").Rule.RuleModule;
|
|
38
37
|
'use-heading': import("eslint").Rule.RuleModule;
|
|
39
38
|
'use-heading-level-in-spotlight-card': import("eslint").Rule.RuleModule;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import { type ExportNamedDeclaration, type ImportDeclaration } from 'eslint-codemod-utils';
|
|
3
|
+
type ReturnObject = {
|
|
4
|
+
checkImportNode: (node: ImportDeclaration & Rule.NodeParentExtension) => void;
|
|
5
|
+
checkExportNode: (node: ExportNamedDeclaration & Rule.NodeParentExtension) => void;
|
|
6
|
+
checkJSXElement: (node: Rule.Node) => void;
|
|
7
|
+
checkIdentifier: (node: Rule.Node) => void;
|
|
8
|
+
throwErrors: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const createChecks: (context: Rule.RuleContext) => ReturnObject;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import { type ExportNamedDeclaration, type ImportDeclaration, type JSXElement } from 'eslint-codemod-utils';
|
|
3
|
+
import { type DeprecatedImportConfigEntry } from '../../utils/types';
|
|
4
|
+
export type ImportIconDeprecationError = Rule.ReportDescriptor & {
|
|
5
|
+
node: ImportDeclaration;
|
|
6
|
+
};
|
|
7
|
+
export type ExportIconDeprecationError = Rule.ReportDescriptor & {
|
|
8
|
+
node: ExportNamedDeclaration;
|
|
9
|
+
};
|
|
10
|
+
export type ImportIconDeprecationErrorListAuto = {
|
|
11
|
+
[key: string]: ImportIconDeprecationError;
|
|
12
|
+
};
|
|
13
|
+
export type ExportIconDeprecationErrorListAuto = {
|
|
14
|
+
[key: string]: ExportIconDeprecationError;
|
|
15
|
+
};
|
|
16
|
+
type DeprecationIconHandler = (context: Rule.RuleContext) => {
|
|
17
|
+
createImportError: (args: {
|
|
18
|
+
node: ImportDeclaration;
|
|
19
|
+
importSource: string;
|
|
20
|
+
config: DeprecatedImportConfigEntry;
|
|
21
|
+
}) => void;
|
|
22
|
+
createExportError: (args: {
|
|
23
|
+
node: ExportNamedDeclaration;
|
|
24
|
+
importSource: string;
|
|
25
|
+
config: DeprecatedImportConfigEntry;
|
|
26
|
+
}) => void;
|
|
27
|
+
checkJSXElement: (node: JSXElement) => void;
|
|
28
|
+
checkIdentifier: (node: Rule.Node) => void;
|
|
29
|
+
throwErrors: () => void;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* __Deprecation icon handler__
|
|
33
|
+
*
|
|
34
|
+
* A deprecation icon handler which is responsible for displaying an error for deprecated icons.
|
|
35
|
+
* It also includes a fixer to replace the deprecated icon with the new icon if a replacement exists.
|
|
36
|
+
*/
|
|
37
|
+
export declare const getDeprecationIconHandler: DeprecationIconHandler;
|
|
38
|
+
export {};
|
|
@@ -24,12 +24,6 @@
|
|
|
24
24
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
25
|
* THE SOFTWARE.
|
|
26
26
|
*/
|
|
27
|
-
import { type TSESLint } from '@typescript-eslint/utils';
|
|
28
|
-
import { type DeprecatedConfig } from '../utils/types';
|
|
29
27
|
export declare const name = "no-deprecated-imports";
|
|
30
|
-
|
|
31
|
-
export declare const pathWithCustomMessageId = "pathWithCustomMessage";
|
|
32
|
-
declare const rule: TSESLint.RuleModule<string, [{
|
|
33
|
-
deprecatedConfig: DeprecatedConfig;
|
|
34
|
-
}], TSESLint.RuleListener>;
|
|
28
|
+
declare const rule: import("eslint").Rule.RuleModule;
|
|
35
29
|
export default rule;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
export declare const addCalendarButtonProp = "Add `shouldShowCalendarButton` prop.";
|
|
3
|
+
export declare const setCalendarButtonPropToTrue = "Set `shouldShowCalendarButton` prop to `true`.";
|
|
4
|
+
export declare const addCalendarButtonProperty = "Add `shouldShowCalendarButton: true` to `datePickerProps`.";
|
|
5
|
+
export declare const setCalendarButtonPropertyToTrue = "Set `shouldShowCalendarButton` property in `datePickerProps` to `true`.";
|
|
6
|
+
declare const rule: Rule.RuleModule;
|
|
7
|
+
export default rule;
|
|
@@ -17,6 +17,7 @@ export type DeprecatedImportConfigEntry = {
|
|
|
17
17
|
importName: string;
|
|
18
18
|
message: string;
|
|
19
19
|
}[];
|
|
20
|
+
unfixable?: boolean;
|
|
20
21
|
};
|
|
21
22
|
export declare const isDeprecatedImportConfig: (config: DeprecatedImportConfig | DeprecatedJSXAttributeConfig) => config is DeprecatedImportConfig;
|
|
22
23
|
export declare const isDeprecatedJSXAttributeConfig: (config: DeprecatedImportConfig | DeprecatedJSXAttributeConfig) => config is DeprecatedJSXAttributeConfig;
|
|
@@ -18,6 +18,9 @@ declare const HelperJSXAttribute: {
|
|
|
18
18
|
getValue(node: JSXAttribute): {
|
|
19
19
|
type: 'ExpressionStatement';
|
|
20
20
|
value: string;
|
|
21
|
+
} | {
|
|
22
|
+
type: 'ExpressionStatement Literal';
|
|
23
|
+
value: string | number | bigint | boolean | RegExp | null | undefined;
|
|
21
24
|
} | {
|
|
22
25
|
type: 'Literal';
|
|
23
26
|
value: string;
|