@atlaskit/eslint-plugin-design-system 13.4.0 → 13.5.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 +16 -0
- package/README.md +1 -0
- package/dist/cjs/ast-nodes/object.js +0 -2
- 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/consistent-css-prop-usage/index.js +0 -2
- package/dist/cjs/rules/ensure-design-token-usage/color.js +0 -2
- package/dist/cjs/rules/ensure-design-token-usage/index.js +0 -2
- package/dist/cjs/rules/ensure-design-token-usage/spacing.js +1 -1
- package/dist/cjs/rules/ensure-design-token-usage/utils.js +0 -2
- package/dist/cjs/rules/ensure-icon-color/index.js +0 -2
- package/dist/cjs/rules/index.codegen.js +3 -1
- package/dist/cjs/rules/no-boolean-autofocus-on-modal-dialog/index.js +0 -2
- package/dist/cjs/rules/no-custom-icons/index.js +0 -2
- package/dist/cjs/rules/no-deprecated-design-token-usage/index.js +0 -2
- package/dist/cjs/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind-all.js +1 -1
- package/dist/cjs/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind.js +1 -1
- package/dist/cjs/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-jsx-attribute.js +0 -2
- package/dist/cjs/rules/no-html-anchor/node-types/jsx-element/index.js +1 -1
- package/dist/cjs/rules/no-html-button/node-types/jsx-element/index.js +0 -2
- package/dist/cjs/rules/no-margin/index.js +0 -2
- package/dist/cjs/rules/no-nested-styles/index.js +0 -2
- package/dist/cjs/rules/no-physical-properties/index.js +0 -2
- package/dist/cjs/rules/no-unsafe-design-token-usage/index.js +1 -1
- package/dist/cjs/rules/use-button-group-label/index.js +0 -2
- package/dist/cjs/rules/use-datetime-picker-calendar-button/index.js +0 -2
- package/dist/cjs/rules/use-drawer-label/index.js +0 -2
- package/dist/cjs/rules/use-heading-level-in-spotlight-card/index.js +0 -2
- package/dist/cjs/rules/use-href-in-link-item/index.js +0 -2
- package/dist/cjs/rules/use-href-in-link-item/utils.js +0 -2
- package/dist/cjs/rules/use-menu-section-title/index.js +0 -2
- package/dist/cjs/rules/use-modal-dialog-close-button/index.js +25 -13
- package/dist/cjs/rules/use-onboarding-spotlight-label/index.js +0 -2
- package/dist/cjs/rules/use-popup-label/index.js +0 -2
- package/dist/cjs/rules/use-should-render-to-parent/index.js +113 -0
- package/dist/cjs/rules/use-tag-group-label/index.js +0 -2
- package/dist/cjs/rules/use-visually-hidden/fix-jsx.js +0 -2
- package/dist/cjs/rules/use-visually-hidden/fix-vanilla.js +0 -2
- package/dist/cjs/rules/use-visually-hidden/index.js +0 -2
- package/dist/cjs/rules/use-visually-hidden/utils.js +0 -3
- package/dist/cjs/rules/utils/create-no-tagged-template-expression-rule/get-tagged-template-expression-offset.js +0 -1
- package/dist/cjs/rules/utils/create-no-tagged-template-expression-rule/index.js +0 -4
- package/dist/cjs/rules/utils/create-no-tagged-template-expression-rule/to-arguments.js +0 -1
- package/dist/cjs/rules/utils/error-boundary.js +0 -2
- package/dist/cjs/rules/utils/find-in-parent.js +0 -2
- package/dist/cjs/rules/utils/get-import-node-by-source.js +0 -2
- package/dist/cjs/rules/utils/get-is-exception.js +0 -2
- package/dist/cjs/rules/utils/is-node.js +0 -2
- package/dist/es2019/ast-nodes/object.js +0 -2
- 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/consistent-css-prop-usage/index.js +0 -2
- package/dist/es2019/rules/ensure-design-token-usage/color.js +0 -2
- package/dist/es2019/rules/ensure-design-token-usage/index.js +0 -2
- package/dist/es2019/rules/ensure-design-token-usage/spacing.js +0 -2
- package/dist/es2019/rules/ensure-design-token-usage/utils.js +0 -2
- package/dist/es2019/rules/ensure-icon-color/index.js +0 -2
- package/dist/es2019/rules/index.codegen.js +3 -1
- package/dist/es2019/rules/no-boolean-autofocus-on-modal-dialog/index.js +0 -2
- package/dist/es2019/rules/no-custom-icons/index.js +0 -2
- package/dist/es2019/rules/no-deprecated-design-token-usage/index.js +0 -2
- package/dist/es2019/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind-all.js +0 -2
- package/dist/es2019/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind.js +0 -2
- package/dist/es2019/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-jsx-attribute.js +0 -2
- package/dist/es2019/rules/no-html-anchor/node-types/jsx-element/index.js +0 -2
- package/dist/es2019/rules/no-html-button/node-types/jsx-element/index.js +0 -2
- package/dist/es2019/rules/no-margin/index.js +0 -2
- package/dist/es2019/rules/no-nested-styles/index.js +0 -2
- package/dist/es2019/rules/no-physical-properties/index.js +0 -2
- package/dist/es2019/rules/no-unsafe-design-token-usage/index.js +0 -2
- package/dist/es2019/rules/use-button-group-label/index.js +0 -2
- package/dist/es2019/rules/use-datetime-picker-calendar-button/index.js +0 -2
- package/dist/es2019/rules/use-drawer-label/index.js +0 -2
- package/dist/es2019/rules/use-heading-level-in-spotlight-card/index.js +0 -2
- package/dist/es2019/rules/use-href-in-link-item/index.js +0 -2
- package/dist/es2019/rules/use-href-in-link-item/utils.js +0 -2
- package/dist/es2019/rules/use-menu-section-title/index.js +0 -2
- package/dist/es2019/rules/use-modal-dialog-close-button/index.js +24 -14
- package/dist/es2019/rules/use-onboarding-spotlight-label/index.js +0 -2
- package/dist/es2019/rules/use-popup-label/index.js +0 -2
- package/dist/es2019/rules/use-should-render-to-parent/index.js +97 -0
- package/dist/es2019/rules/use-tag-group-label/index.js +0 -2
- package/dist/es2019/rules/use-visually-hidden/fix-jsx.js +0 -2
- package/dist/es2019/rules/use-visually-hidden/fix-vanilla.js +0 -2
- package/dist/es2019/rules/use-visually-hidden/index.js +0 -2
- package/dist/es2019/rules/use-visually-hidden/utils.js +0 -4
- package/dist/es2019/rules/utils/create-no-tagged-template-expression-rule/get-tagged-template-expression-offset.js +0 -1
- package/dist/es2019/rules/utils/create-no-tagged-template-expression-rule/index.js +0 -4
- package/dist/es2019/rules/utils/create-no-tagged-template-expression-rule/to-arguments.js +0 -1
- package/dist/es2019/rules/utils/error-boundary.js +0 -2
- package/dist/es2019/rules/utils/find-in-parent.js +0 -2
- package/dist/es2019/rules/utils/get-import-node-by-source.js +0 -2
- package/dist/es2019/rules/utils/get-is-exception.js +0 -2
- package/dist/es2019/rules/utils/is-node.js +0 -2
- package/dist/esm/ast-nodes/object.js +0 -2
- 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/consistent-css-prop-usage/index.js +0 -2
- package/dist/esm/rules/ensure-design-token-usage/color.js +0 -2
- package/dist/esm/rules/ensure-design-token-usage/index.js +0 -2
- package/dist/esm/rules/ensure-design-token-usage/spacing.js +0 -2
- package/dist/esm/rules/ensure-design-token-usage/utils.js +0 -2
- package/dist/esm/rules/ensure-icon-color/index.js +0 -2
- package/dist/esm/rules/index.codegen.js +3 -1
- package/dist/esm/rules/no-boolean-autofocus-on-modal-dialog/index.js +0 -2
- package/dist/esm/rules/no-custom-icons/index.js +0 -2
- package/dist/esm/rules/no-deprecated-design-token-usage/index.js +0 -2
- package/dist/esm/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind-all.js +0 -2
- package/dist/esm/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind.js +0 -2
- package/dist/esm/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-jsx-attribute.js +0 -2
- package/dist/esm/rules/no-html-anchor/node-types/jsx-element/index.js +0 -2
- package/dist/esm/rules/no-html-button/node-types/jsx-element/index.js +0 -2
- package/dist/esm/rules/no-margin/index.js +0 -2
- package/dist/esm/rules/no-nested-styles/index.js +0 -2
- package/dist/esm/rules/no-physical-properties/index.js +0 -2
- package/dist/esm/rules/no-unsafe-design-token-usage/index.js +0 -2
- package/dist/esm/rules/use-button-group-label/index.js +0 -2
- package/dist/esm/rules/use-datetime-picker-calendar-button/index.js +0 -2
- package/dist/esm/rules/use-drawer-label/index.js +0 -2
- package/dist/esm/rules/use-heading-level-in-spotlight-card/index.js +0 -2
- package/dist/esm/rules/use-href-in-link-item/index.js +0 -2
- package/dist/esm/rules/use-href-in-link-item/utils.js +0 -2
- package/dist/esm/rules/use-menu-section-title/index.js +0 -2
- package/dist/esm/rules/use-modal-dialog-close-button/index.js +24 -14
- package/dist/esm/rules/use-onboarding-spotlight-label/index.js +0 -2
- package/dist/esm/rules/use-popup-label/index.js +0 -2
- package/dist/esm/rules/use-should-render-to-parent/index.js +107 -0
- package/dist/esm/rules/use-tag-group-label/index.js +0 -2
- package/dist/esm/rules/use-visually-hidden/fix-jsx.js +0 -2
- package/dist/esm/rules/use-visually-hidden/fix-vanilla.js +0 -2
- package/dist/esm/rules/use-visually-hidden/index.js +0 -2
- package/dist/esm/rules/use-visually-hidden/utils.js +0 -4
- package/dist/esm/rules/utils/create-no-tagged-template-expression-rule/get-tagged-template-expression-offset.js +0 -1
- package/dist/esm/rules/utils/create-no-tagged-template-expression-rule/index.js +0 -4
- package/dist/esm/rules/utils/create-no-tagged-template-expression-rule/to-arguments.js +0 -1
- package/dist/esm/rules/utils/error-boundary.js +0 -2
- package/dist/esm/rules/utils/find-in-parent.js +0 -2
- package/dist/esm/rules/utils/get-import-node-by-source.js +0 -2
- package/dist/esm/rules/utils/get-is-exception.js +0 -2
- package/dist/esm/rules/utils/is-node.js +0 -2
- package/dist/types/index.codegen.d.ts +9 -0
- package/dist/types/presets/all-flat.codegen.d.ts +1 -0
- package/dist/types/presets/all.codegen.d.ts +1 -0
- package/dist/types/presets/recommended-flat.codegen.d.ts +1 -0
- package/dist/types/presets/recommended.codegen.d.ts +1 -0
- package/dist/types/rules/index.codegen.d.ts +1 -0
- package/dist/types/rules/use-should-render-to-parent/index.d.ts +6 -0
- package/dist/types-ts4.5/index.codegen.d.ts +9 -0
- package/dist/types-ts4.5/presets/all-flat.codegen.d.ts +1 -0
- package/dist/types-ts4.5/presets/all.codegen.d.ts +1 -0
- package/dist/types-ts4.5/presets/recommended-flat.codegen.d.ts +1 -0
- package/dist/types-ts4.5/presets/recommended.codegen.d.ts +1 -0
- package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
- package/dist/types-ts4.5/rules/use-should-render-to-parent/index.d.ts +6 -0
- package/package.json +4 -4
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// Original source from Compiled https://github.com/atlassian-labs/compiled/blob/master/packages/eslint-plugin/src/utils/create-no-tagged-template-expression-rule/get-tagged-template-expression-offset.ts
|
|
2
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
2
|
|
|
4
3
|
export const getTaggedTemplateExpressionOffset = node => {
|
|
5
4
|
const {
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
/* eslint-disable @atlassian/tangerine/import/entry-points */
|
|
2
|
-
|
|
3
1
|
// Original source from Compiled https://github.com/atlassian-labs/compiled/blob/master/packages/eslint-plugin/src/utils/create-no-tagged-template-expression-rule/index.ts
|
|
4
2
|
|
|
5
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
6
|
-
|
|
7
3
|
import esquery from 'esquery';
|
|
8
4
|
import { getScope, getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
9
5
|
import { getImportSources, isEmotion } from '@atlaskit/eslint-utils/is-supported-import';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// Original source from Compiled https://github.com/atlassian-labs/compiled/blob/master/packages/eslint-plugin/src/utils/create-no-tagged-template-expression-rule/to-arguments.ts
|
|
2
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
2
|
|
|
4
3
|
const getArguments = (chars, expressions = []) => {
|
|
5
4
|
if (!chars.trim().length && expressions) {
|
|
@@ -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::d6f1473b4b8a65399a9c887b4ba1912e>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -53,6 +53,7 @@ export default {
|
|
|
53
53
|
'@atlaskit/design-system/use-popup-label': 'warn',
|
|
54
54
|
'@atlaskit/design-system/use-primitives': 'warn',
|
|
55
55
|
'@atlaskit/design-system/use-primitives-text': 'warn',
|
|
56
|
+
'@atlaskit/design-system/use-should-render-to-parent': 'warn',
|
|
56
57
|
'@atlaskit/design-system/use-tag-group-label': 'warn',
|
|
57
58
|
'@atlaskit/design-system/use-tokens-space': 'error',
|
|
58
59
|
'@atlaskit/design-system/use-tokens-typography': '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::011cbb2ac5166d9a4a1d1cab68d0156d>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -52,6 +52,7 @@ export default {
|
|
|
52
52
|
'@atlaskit/design-system/use-popup-label': 'warn',
|
|
53
53
|
'@atlaskit/design-system/use-primitives': 'warn',
|
|
54
54
|
'@atlaskit/design-system/use-primitives-text': 'warn',
|
|
55
|
+
'@atlaskit/design-system/use-should-render-to-parent': 'warn',
|
|
55
56
|
'@atlaskit/design-system/use-tag-group-label': 'warn',
|
|
56
57
|
'@atlaskit/design-system/use-tokens-space': 'error',
|
|
57
58
|
'@atlaskit/design-system/use-tokens-typography': '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::abef9d23f187fcebf6ab9cdeb874229b>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -39,6 +39,7 @@ export default {
|
|
|
39
39
|
'@atlaskit/design-system/use-modal-dialog-close-button': 'warn',
|
|
40
40
|
'@atlaskit/design-system/use-onboarding-spotlight-label': 'warn',
|
|
41
41
|
'@atlaskit/design-system/use-popup-label': 'warn',
|
|
42
|
+
'@atlaskit/design-system/use-should-render-to-parent': 'warn',
|
|
42
43
|
'@atlaskit/design-system/use-tag-group-label': 'warn',
|
|
43
44
|
'@atlaskit/design-system/use-visually-hidden': 'error'
|
|
44
45
|
}
|
|
@@ -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::3d1a55011e92acf33daaf53e8bfc3532>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -38,6 +38,7 @@ export default {
|
|
|
38
38
|
'@atlaskit/design-system/use-modal-dialog-close-button': 'warn',
|
|
39
39
|
'@atlaskit/design-system/use-onboarding-spotlight-label': 'warn',
|
|
40
40
|
'@atlaskit/design-system/use-popup-label': 'warn',
|
|
41
|
+
'@atlaskit/design-system/use-should-render-to-parent': 'warn',
|
|
41
42
|
'@atlaskit/design-system/use-tag-group-label': 'warn',
|
|
42
43
|
'@atlaskit/design-system/use-visually-hidden': 'error'
|
|
43
44
|
}
|
|
@@ -2,8 +2,6 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
4
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
5
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
6
|
-
|
|
7
5
|
import { getIdentifierInParentScope, insertAtStartOfFile, insertImportDeclaration, isNodeOfType } from 'eslint-codemod-utils';
|
|
8
6
|
import estraverse from 'estraverse';
|
|
9
7
|
import assign from 'lodash/assign';
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
-
|
|
3
1
|
import { node as generate, isNodeOfType } from 'eslint-codemod-utils';
|
|
4
2
|
import { getIsException } from '../utils/get-is-exception';
|
|
5
3
|
import { includesHardCodedColor, isHardCodedColor, isLegacyColor, isLegacyNamedColor } from '../utils/is-color';
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
-
|
|
4
2
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
5
3
|
import { getScope, getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
6
4
|
import { getImportSources } from '@atlaskit/eslint-utils/is-supported-import';
|
|
@@ -2,8 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
5
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
6
|
-
|
|
7
5
|
import { isNodeOfType, property } from 'eslint-codemod-utils';
|
|
8
6
|
import { emToPixels, findTokenNameByPropertyValue, getRawExpression, getTokenNodeForValue, getTokenReplacement, getValue, insertTokensImport, isAuto, isCalc, isValidSpacingValue, isZero, splitShorthandValues } from './utils';
|
|
9
7
|
export var lintObjectForSpacing = function lintObjectForSpacing(node, context, ruleConfig, fontSize, tokenNode) {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
-
|
|
4
2
|
import { callExpression, identifier, insertAtStartOfFile, insertImportDeclaration, isNodeOfType, literal } from 'eslint-codemod-utils';
|
|
5
3
|
import { getScope, getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
6
4
|
import { spacing as spacingScale } from '@atlaskit/tokens/tokens-raw';
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
-
|
|
3
1
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
2
|
import { createIsFromImportSourceFor } from '../no-custom-icons/checks/is-from-import-source';
|
|
5
3
|
import { createLintRule } from '../utils/create-rule';
|
|
@@ -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::f169e765038e90ec6531f19333f70cfb>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import consistentCssPropUsage from './consistent-css-prop-usage';
|
|
@@ -49,6 +49,7 @@ import useOnboardingSpotlightLabel from './use-onboarding-spotlight-label';
|
|
|
49
49
|
import usePopupLabel from './use-popup-label';
|
|
50
50
|
import usePrimitives from './use-primitives';
|
|
51
51
|
import usePrimitivesText from './use-primitives-text';
|
|
52
|
+
import useShouldRenderToParent from './use-should-render-to-parent';
|
|
52
53
|
import useTagGroupLabel from './use-tag-group-label';
|
|
53
54
|
import useTokensSpace from './use-tokens-space';
|
|
54
55
|
import useTokensTypography from './use-tokens-typography';
|
|
@@ -100,6 +101,7 @@ export var rules = {
|
|
|
100
101
|
'use-popup-label': usePopupLabel,
|
|
101
102
|
'use-primitives': usePrimitives,
|
|
102
103
|
'use-primitives-text': usePrimitivesText,
|
|
104
|
+
'use-should-render-to-parent': useShouldRenderToParent,
|
|
103
105
|
'use-tag-group-label': useTagGroupLabel,
|
|
104
106
|
'use-tokens-space': useTokensSpace,
|
|
105
107
|
'use-tokens-typography': useTokensTypography,
|
package/dist/esm/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind-all.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
2
2
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
3
3
|
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; }
|
|
4
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
5
|
-
|
|
6
4
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
7
5
|
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
8
6
|
import { getModuleOfIdentifier } from '../../utils/get-import-node-by-source';
|
package/dist/esm/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
2
2
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
3
3
|
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; }
|
|
4
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
5
|
-
|
|
6
4
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
7
5
|
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
8
6
|
import { getModuleOfIdentifier } from '../../utils/get-import-node-by-source';
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
-
|
|
3
1
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
2
|
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
5
3
|
import { getModuleOfIdentifier } from '../../utils/get-import-node-by-source';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
2
2
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
3
3
|
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; }
|
|
4
|
-
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
5
|
-
|
|
6
4
|
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
7
5
|
import * as ast from '../../../../ast-nodes';
|
|
8
6
|
import { isSupportedForLint } from '../supported';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
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
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; }
|
|
4
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
5
|
-
|
|
6
4
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
7
5
|
import renameMapping from '@atlaskit/tokens/rename-mapping';
|
|
8
6
|
import tokenDefaultValues from '@atlaskit/tokens/token-default-values';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
2
2
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
3
3
|
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; }
|
|
4
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
5
|
-
|
|
6
4
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
7
5
|
import { JSXAttribute } from '../../ast-nodes/jsx-attribute';
|
|
8
6
|
import { JSXElementHelper } from '../../ast-nodes/jsx-element';
|
|
@@ -68,7 +66,7 @@ var rule = createLintRule({
|
|
|
68
66
|
return;
|
|
69
67
|
}
|
|
70
68
|
var name = node.openingElement.name.name;
|
|
71
|
-
if (name
|
|
69
|
+
if (![defaultImportLocalName, modalHeaderLocalName].includes(name)) {
|
|
72
70
|
return;
|
|
73
71
|
}
|
|
74
72
|
var modalHeaderNode = null;
|
|
@@ -132,13 +130,31 @@ var rule = createLintRule({
|
|
|
132
130
|
_iterator.f();
|
|
133
131
|
}
|
|
134
132
|
};
|
|
135
|
-
|
|
133
|
+
if (name === defaultImportLocalName) {
|
|
134
|
+
searchNode(node);
|
|
135
|
+
|
|
136
|
+
// If there is a close button, skip the rest, as this satisfies the
|
|
137
|
+
// rule. If there is a modal header, it will be recognized in later
|
|
138
|
+
// scans, so don't add duplicate errors
|
|
139
|
+
if (closeButtonNode || modalHeaderNode) {
|
|
140
|
+
return;
|
|
141
|
+
// No close button or modal header exists
|
|
142
|
+
} else {
|
|
143
|
+
return context.report({
|
|
144
|
+
node: node,
|
|
145
|
+
messageId: 'noCloseButtonExists'
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
} else if (name === modalHeaderLocalName) {
|
|
149
|
+
modalHeaderNode = node;
|
|
150
|
+
searchNode(node);
|
|
151
|
+
|
|
152
|
+
// If there is a close button, skip the rest, as this satisfies the rule.
|
|
153
|
+
if (closeButtonNode) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
136
156
|
|
|
137
|
-
// If there is a close button, skip the rest, as this satisfies the rule.
|
|
138
|
-
if (closeButtonNode) {
|
|
139
|
-
return;
|
|
140
157
|
// No close button exists, so check the modal header
|
|
141
|
-
} else if (modalHeaderNode !== null) {
|
|
142
158
|
var prop = JSXElementHelper.getAttributeByName(modalHeaderNode, PROP_NAME);
|
|
143
159
|
|
|
144
160
|
// If the prop exists
|
|
@@ -171,12 +187,6 @@ var rule = createLintRule({
|
|
|
171
187
|
}]
|
|
172
188
|
});
|
|
173
189
|
}
|
|
174
|
-
// No close button or modal header exists
|
|
175
|
-
} else {
|
|
176
|
-
return context.report({
|
|
177
|
-
node: node,
|
|
178
|
-
messageId: 'noCloseButtonExists'
|
|
179
|
-
});
|
|
180
190
|
}
|
|
181
191
|
}
|
|
182
192
|
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
+
|
|
3
|
+
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
+
import { createLintRule } from '../utils/create-rule';
|
|
5
|
+
export var RULE_NAME = 'use-should-render-to-parent';
|
|
6
|
+
var PROP_NAME = 'shouldRenderToParent';
|
|
7
|
+
var message = "Setting the `".concat(PROP_NAME, "` prop to anything other than `true` causes accessibility issues. Only set to `false` as a last resort.");
|
|
8
|
+
export var addProp = "Add `".concat(PROP_NAME, "` prop.");
|
|
9
|
+
export var setPropToTrue = "Set `".concat(PROP_NAME, "` prop to `true`.");
|
|
10
|
+
var components = ['@atlaskit/popup', '@atlaskit/dropdown-menu'];
|
|
11
|
+
var rule = createLintRule({
|
|
12
|
+
meta: {
|
|
13
|
+
name: RULE_NAME,
|
|
14
|
+
type: 'suggestion',
|
|
15
|
+
docs: {
|
|
16
|
+
description: "Encourages makers to use the `".concat(PROP_NAME, "` where possible in Atlassian Design System `Popup` and `DropdownMenu` components."),
|
|
17
|
+
recommended: true,
|
|
18
|
+
severity: 'warn'
|
|
19
|
+
},
|
|
20
|
+
messages: {
|
|
21
|
+
missingShouldRenderToParentProp: "The default value of `".concat(PROP_NAME, "` is `false`. ").concat(message),
|
|
22
|
+
falseShouldRenderToParentProp: message
|
|
23
|
+
},
|
|
24
|
+
hasSuggestions: true
|
|
25
|
+
},
|
|
26
|
+
create: function create(context) {
|
|
27
|
+
var componentLocalName;
|
|
28
|
+
return {
|
|
29
|
+
ImportDeclaration: function ImportDeclaration(node) {
|
|
30
|
+
var source = node.source.value;
|
|
31
|
+
if (typeof source !== 'string') {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (!components.includes(source)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (!node.specifiers.length) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
var defaultImport = node.specifiers.filter(function (spec) {
|
|
41
|
+
return spec.type === 'ImportDefaultSpecifier';
|
|
42
|
+
});
|
|
43
|
+
var namedImport = node.specifiers.filter(function (spec) {
|
|
44
|
+
return spec.type === 'ImportSpecifier';
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// If popup or dropdown menu and using a default import
|
|
48
|
+
if (defaultImport.length && defaultImport[0].local) {
|
|
49
|
+
componentLocalName = defaultImport[0].local.name;
|
|
50
|
+
// or if popup and using a named import
|
|
51
|
+
} else if (namedImport.length && namedImport[0].type === 'ImportSpecifier' && namedImport[0].imported.name === 'Popup') {
|
|
52
|
+
componentLocalName = namedImport[0].local.name;
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
JSXElement: function JSXElement(node) {
|
|
56
|
+
if (!isNodeOfType(node, 'JSXElement')) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (!isNodeOfType(node.openingElement.name, 'JSXIdentifier')) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
var name = node.openingElement.name.name;
|
|
63
|
+
if (name === componentLocalName) {
|
|
64
|
+
var prop = node.openingElement.attributes.find(function (attr) {
|
|
65
|
+
return isNodeOfType(attr, 'JSXAttribute') && isNodeOfType(attr.name, 'JSXIdentifier') && attr.name.name === PROP_NAME;
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// If the prop does not exist, throw
|
|
69
|
+
if (!prop) {
|
|
70
|
+
return context.report({
|
|
71
|
+
node: node.openingElement.name,
|
|
72
|
+
messageId: 'missingShouldRenderToParentProp',
|
|
73
|
+
suggest: [{
|
|
74
|
+
desc: addProp,
|
|
75
|
+
fix: function fix(fixer) {
|
|
76
|
+
return [fixer.insertTextAfter(node.openingElement.name, " ".concat(PROP_NAME))];
|
|
77
|
+
}
|
|
78
|
+
}]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// If the prop is a boolean attribute with no value (set to `true`),
|
|
83
|
+
// it's valid
|
|
84
|
+
if (!('value' in prop) || prop.value === null) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// If the prop has a falsy literal value or a falsy value in an
|
|
89
|
+
// expression container, throw
|
|
90
|
+
if (isNodeOfType(prop.value, 'Literal') && !prop.value.value || isNodeOfType(prop.value, 'JSXExpressionContainer') && prop.value.expression.type === 'Literal' && !prop.value.expression.value) {
|
|
91
|
+
return context.report({
|
|
92
|
+
node: prop,
|
|
93
|
+
messageId: 'falseShouldRenderToParentProp',
|
|
94
|
+
suggest: [{
|
|
95
|
+
desc: setPropToTrue,
|
|
96
|
+
fix: function fix(fixer) {
|
|
97
|
+
return [fixer.replaceText(prop, PROP_NAME)];
|
|
98
|
+
}
|
|
99
|
+
}]
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
export default rule;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
-
|
|
3
1
|
import { closestOfType } from 'eslint-codemod-utils';
|
|
4
2
|
import { getImportedNodeBySource } from '../utils/get-import-node-by-source';
|
|
5
3
|
import { IMPORT_NAME, VISUALLY_HIDDEN_IMPORT, VISUALLY_HIDDEN_SOURCE } from './constants';
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
-
|
|
3
1
|
import { getImportedNodeBySource } from '../utils/get-import-node-by-source';
|
|
4
2
|
import { IMPORT_NAME, VISUALLY_HIDDEN_IMPORT, VISUALLY_HIDDEN_SOURCE } from './constants';
|
|
5
3
|
import { getFirstImport } from './utils';
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
-
|
|
4
2
|
import { closestOfType, hasImportDeclaration, isNodeOfType } from 'eslint-codemod-utils';
|
|
5
3
|
import { getDeclaredVariables, getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
6
4
|
import { createLintRule } from '../utils/create-rule';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// Original source from Compiled https://github.com/atlassian-labs/compiled/blob/master/packages/eslint-plugin/src/utils/create-no-tagged-template-expression-rule/get-tagged-template-expression-offset.ts
|
|
2
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
2
|
|
|
4
3
|
export var getTaggedTemplateExpressionOffset = function getTaggedTemplateExpressionOffset(node) {
|
|
5
4
|
var parent = node.parent;
|