@atlaskit/eslint-plugin-design-system 11.10.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/ast-nodes/object-entry.js +1 -1
- package/dist/cjs/ast-nodes/root.js +1 -1
- package/dist/cjs/presets/all.codegen.js +1 -1
- package/dist/cjs/presets/recommended.codegen.js +1 -1
- package/dist/cjs/rules/consistent-css-prop-usage/index.js +1 -1
- package/dist/cjs/rules/ensure-design-token-usage/color.js +10 -10
- package/dist/cjs/rules/ensure-design-token-usage/index.js +12 -5
- package/dist/cjs/rules/ensure-design-token-usage/utils.js +3 -3
- package/dist/cjs/rules/no-deprecated-apis/index.js +1 -1
- 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 +1 -1
- package/dist/cjs/rules/no-empty-styled-expression/index.js +1 -1
- package/dist/cjs/rules/no-html-anchor/node-types/jsx-element/index.js +1 -1
- package/dist/cjs/rules/no-html-anchor/node-types/styled-component/index.js +1 -1
- package/dist/cjs/rules/no-html-button/node-types/styled-component/index.js +1 -1
- package/dist/cjs/rules/no-invalid-css-map/index.js +1 -1
- package/dist/cjs/rules/no-invalid-css-map/utils.js +1 -1
- package/dist/cjs/rules/no-legacy-icons/helpers.js +40 -3
- package/dist/cjs/rules/no-margin/index.js +4 -4
- package/dist/cjs/rules/no-nested-styles/index.js +2 -2
- package/dist/cjs/rules/no-physical-properties/index.js +1 -1
- package/dist/cjs/rules/no-unsafe-design-token-usage/index.js +2 -2
- package/dist/cjs/rules/no-unsafe-style-overrides/index.js +1 -1
- package/dist/cjs/rules/use-heading/config/index.js +1 -1
- package/dist/cjs/rules/use-heading/index.js +13 -1
- package/dist/cjs/rules/use-heading-level-in-spotlight-card/index.js +1 -1
- package/dist/cjs/rules/use-href-in-link-item/index.js +1 -1
- package/dist/cjs/rules/use-latest-xcss-syntax/index.js +1 -1
- package/dist/cjs/rules/use-latest-xcss-syntax/transformers/style-property/index.js +1 -1
- package/dist/cjs/rules/use-latest-xcss-syntax-typography/config/index.js +3 -2
- package/dist/cjs/rules/use-latest-xcss-syntax-typography/index.js +24 -6
- package/dist/cjs/rules/use-primitives/config/index.js +41 -1
- package/dist/cjs/rules/use-primitives/index.js +14 -0
- package/dist/cjs/rules/use-primitives/transformers/compiled-styled/index.js +1 -1
- package/dist/cjs/rules/use-primitives/transformers/css-to-xcss.js +1 -1
- package/dist/cjs/rules/use-primitives/transformers/emotion-css/index.js +1 -1
- package/dist/cjs/rules/use-primitives/utils/get-variable-usage-count.js +1 -1
- package/dist/cjs/rules/use-primitives-text/config/index.js +11 -2
- package/dist/cjs/rules/use-primitives-text/index.js +27 -0
- package/dist/cjs/rules/use-primitives-text/transformers/emphasis-elements.js +1 -1
- package/dist/cjs/rules/use-primitives-text/transformers/paragraph-elements.js +1 -1
- package/dist/cjs/rules/use-primitives-text/transformers/span-elements.js +1 -1
- package/dist/cjs/rules/use-primitives-text/transformers/strong-elements.js +1 -1
- package/dist/cjs/rules/use-tokens-space/index.js +5 -5
- package/dist/cjs/rules/use-tokens-typography/config/index.js +1 -1
- package/dist/cjs/rules/use-tokens-typography/index.js +7 -6
- package/dist/cjs/rules/use-tokens-typography/transformers/font-family.js +3 -2
- package/dist/cjs/rules/use-tokens-typography/transformers/font-weight.js +3 -2
- package/dist/cjs/rules/use-tokens-typography/transformers/style-object.js +3 -9
- package/dist/cjs/rules/use-tokens-typography/transformers/untokenized-properties.js +2 -1
- package/dist/cjs/rules/use-visually-hidden/index.js +2 -2
- package/dist/cjs/rules/utils/create-no-exported-rule/check-if-supported-export.js +3 -3
- package/dist/cjs/rules/utils/create-no-exported-rule/main.js +1 -1
- package/dist/cjs/rules/utils/create-no-tagged-template-expression-rule/index.js +1 -1
- package/dist/cjs/rules/utils/get-first-supported-import.js +1 -1
- package/dist/cjs/rules/utils/get-is-exception.js +3 -3
- package/dist/cjs/rules/utils/is-node.js +16 -16
- package/dist/es2019/ast-nodes/object-entry.js +1 -1
- package/dist/es2019/ast-nodes/root.js +1 -1
- package/dist/es2019/presets/all.codegen.js +1 -1
- package/dist/es2019/presets/recommended.codegen.js +1 -1
- package/dist/es2019/rules/consistent-css-prop-usage/index.js +1 -1
- package/dist/es2019/rules/ensure-design-token-usage/color.js +10 -10
- package/dist/es2019/rules/ensure-design-token-usage/index.js +8 -1
- package/dist/es2019/rules/ensure-design-token-usage/utils.js +1 -1
- package/dist/es2019/rules/no-deprecated-apis/index.js +1 -1
- package/dist/es2019/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind-all.js +1 -1
- package/dist/es2019/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind.js +1 -1
- package/dist/es2019/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-jsx-attribute.js +1 -1
- package/dist/es2019/rules/no-empty-styled-expression/index.js +1 -1
- package/dist/es2019/rules/no-html-anchor/node-types/jsx-element/index.js +1 -1
- package/dist/es2019/rules/no-html-anchor/node-types/styled-component/index.js +1 -1
- package/dist/es2019/rules/no-html-button/node-types/styled-component/index.js +1 -1
- package/dist/es2019/rules/no-invalid-css-map/index.js +1 -1
- package/dist/es2019/rules/no-invalid-css-map/utils.js +1 -1
- package/dist/es2019/rules/no-legacy-icons/helpers.js +38 -3
- package/dist/es2019/rules/no-nested-styles/index.js +1 -1
- package/dist/es2019/rules/no-unsafe-style-overrides/index.js +1 -1
- package/dist/es2019/rules/use-heading/config/index.js +1 -1
- package/dist/es2019/rules/use-heading/index.js +12 -0
- package/dist/es2019/rules/use-heading-level-in-spotlight-card/index.js +1 -1
- package/dist/es2019/rules/use-href-in-link-item/index.js +1 -1
- package/dist/es2019/rules/use-latest-xcss-syntax/transformers/style-property/index.js +1 -1
- package/dist/es2019/rules/use-latest-xcss-syntax-typography/config/index.js +2 -1
- package/dist/es2019/rules/use-latest-xcss-syntax-typography/index.js +19 -1
- package/dist/es2019/rules/use-primitives/config/index.js +40 -0
- package/dist/es2019/rules/use-primitives/index.js +15 -1
- package/dist/es2019/rules/use-primitives/transformers/compiled-styled/index.js +1 -1
- package/dist/es2019/rules/use-primitives/transformers/css-to-xcss.js +1 -1
- package/dist/es2019/rules/use-primitives/transformers/emotion-css/index.js +1 -1
- package/dist/es2019/rules/use-primitives/utils/get-variable-usage-count.js +1 -1
- package/dist/es2019/rules/use-primitives-text/config/index.js +10 -1
- package/dist/es2019/rules/use-primitives-text/index.js +28 -1
- package/dist/es2019/rules/use-primitives-text/transformers/emphasis-elements.js +1 -1
- package/dist/es2019/rules/use-primitives-text/transformers/paragraph-elements.js +1 -1
- package/dist/es2019/rules/use-primitives-text/transformers/span-elements.js +1 -1
- package/dist/es2019/rules/use-primitives-text/transformers/strong-elements.js +1 -1
- package/dist/es2019/rules/use-tokens-typography/config/index.js +1 -1
- package/dist/es2019/rules/use-tokens-typography/index.js +2 -1
- package/dist/es2019/rules/use-tokens-typography/transformers/font-family.js +3 -2
- package/dist/es2019/rules/use-tokens-typography/transformers/font-weight.js +3 -2
- package/dist/es2019/rules/use-tokens-typography/transformers/style-object.js +3 -9
- package/dist/es2019/rules/use-tokens-typography/transformers/untokenized-properties.js +2 -1
- package/dist/es2019/rules/use-visually-hidden/index.js +2 -2
- package/dist/es2019/rules/utils/create-no-exported-rule/check-if-supported-export.js +1 -1
- package/dist/es2019/rules/utils/create-no-exported-rule/main.js +1 -1
- package/dist/es2019/rules/utils/create-no-tagged-template-expression-rule/index.js +1 -1
- package/dist/es2019/rules/utils/get-first-supported-import.js +1 -1
- package/dist/es2019/rules/utils/is-node.js +1 -1
- package/dist/esm/ast-nodes/object-entry.js +1 -1
- package/dist/esm/ast-nodes/root.js +1 -1
- package/dist/esm/presets/all.codegen.js +1 -1
- package/dist/esm/presets/recommended.codegen.js +1 -1
- package/dist/esm/rules/consistent-css-prop-usage/index.js +1 -1
- package/dist/esm/rules/ensure-design-token-usage/color.js +10 -10
- package/dist/esm/rules/ensure-design-token-usage/index.js +12 -5
- package/dist/esm/rules/ensure-design-token-usage/utils.js +4 -3
- package/dist/esm/rules/no-deprecated-apis/index.js +1 -1
- package/dist/esm/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind-all.js +1 -1
- package/dist/esm/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind.js +1 -1
- package/dist/esm/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-jsx-attribute.js +1 -1
- package/dist/esm/rules/no-empty-styled-expression/index.js +1 -1
- package/dist/esm/rules/no-html-anchor/node-types/jsx-element/index.js +1 -1
- package/dist/esm/rules/no-html-anchor/node-types/styled-component/index.js +1 -1
- package/dist/esm/rules/no-html-button/node-types/styled-component/index.js +1 -1
- package/dist/esm/rules/no-invalid-css-map/index.js +1 -1
- package/dist/esm/rules/no-invalid-css-map/utils.js +1 -1
- package/dist/esm/rules/no-legacy-icons/helpers.js +40 -3
- package/dist/esm/rules/no-margin/index.js +4 -4
- package/dist/esm/rules/no-nested-styles/index.js +2 -2
- package/dist/esm/rules/no-physical-properties/index.js +1 -1
- package/dist/esm/rules/no-unsafe-design-token-usage/index.js +2 -2
- package/dist/esm/rules/no-unsafe-style-overrides/index.js +1 -1
- package/dist/esm/rules/use-heading/config/index.js +1 -1
- package/dist/esm/rules/use-heading/index.js +13 -1
- package/dist/esm/rules/use-heading-level-in-spotlight-card/index.js +1 -1
- package/dist/esm/rules/use-href-in-link-item/index.js +1 -1
- package/dist/esm/rules/use-latest-xcss-syntax/index.js +1 -1
- package/dist/esm/rules/use-latest-xcss-syntax/transformers/style-property/index.js +1 -1
- package/dist/esm/rules/use-latest-xcss-syntax-typography/config/index.js +2 -1
- package/dist/esm/rules/use-latest-xcss-syntax-typography/index.js +25 -7
- package/dist/esm/rules/use-primitives/config/index.js +40 -0
- package/dist/esm/rules/use-primitives/index.js +15 -1
- package/dist/esm/rules/use-primitives/transformers/compiled-styled/index.js +1 -1
- package/dist/esm/rules/use-primitives/transformers/css-to-xcss.js +1 -1
- package/dist/esm/rules/use-primitives/transformers/emotion-css/index.js +1 -1
- package/dist/esm/rules/use-primitives/utils/get-variable-usage-count.js +1 -1
- package/dist/esm/rules/use-primitives-text/config/index.js +10 -1
- package/dist/esm/rules/use-primitives-text/index.js +28 -1
- package/dist/esm/rules/use-primitives-text/transformers/emphasis-elements.js +1 -1
- package/dist/esm/rules/use-primitives-text/transformers/paragraph-elements.js +1 -1
- package/dist/esm/rules/use-primitives-text/transformers/span-elements.js +1 -1
- package/dist/esm/rules/use-primitives-text/transformers/strong-elements.js +1 -1
- package/dist/esm/rules/use-tokens-space/index.js +5 -5
- package/dist/esm/rules/use-tokens-typography/config/index.js +1 -1
- package/dist/esm/rules/use-tokens-typography/index.js +7 -6
- package/dist/esm/rules/use-tokens-typography/transformers/font-family.js +3 -2
- package/dist/esm/rules/use-tokens-typography/transformers/font-weight.js +3 -2
- package/dist/esm/rules/use-tokens-typography/transformers/style-object.js +3 -9
- package/dist/esm/rules/use-tokens-typography/transformers/untokenized-properties.js +2 -1
- package/dist/esm/rules/use-visually-hidden/index.js +2 -2
- package/dist/esm/rules/utils/create-no-exported-rule/check-if-supported-export.js +5 -4
- package/dist/esm/rules/utils/create-no-exported-rule/main.js +1 -1
- package/dist/esm/rules/utils/create-no-tagged-template-expression-rule/index.js +1 -1
- package/dist/esm/rules/utils/get-first-supported-import.js +1 -1
- package/dist/esm/rules/utils/get-is-exception.js +3 -3
- package/dist/esm/rules/utils/is-node.js +23 -16
- package/dist/types/rules/use-latest-xcss-syntax-typography/config/index.d.ts +2 -1
- package/dist/types/rules/use-primitives/config/index.d.ts +2 -1
- package/dist/types/rules/use-primitives-text/config/index.d.ts +2 -1
- package/dist/types-ts4.5/rules/use-latest-xcss-syntax-typography/config/index.d.ts +6 -1
- package/dist/types-ts4.5/rules/use-primitives/config/index.d.ts +2 -1
- package/dist/types-ts4.5/rules/use-primitives-text/config/index.d.ts +2 -1
- package/package.json +3 -3
- package/dist/cjs/rules/utils/context-compat.js +0 -35
- package/dist/es2019/rules/utils/context-compat.js +0 -29
- package/dist/esm/rules/utils/context-compat.js +0 -29
- package/dist/types/rules/utils/context-compat.d.ts +0 -19
- package/dist/types-ts4.5/rules/utils/context-compat.d.ts +0 -19
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
export const PATTERNS = [
|
|
2
|
+
// <p>text</p>
|
|
3
|
+
'paragraph-elements',
|
|
4
|
+
// <span>text</span>
|
|
5
|
+
'span-elements',
|
|
6
|
+
// <strong>text</strong>
|
|
7
|
+
'strong-elements',
|
|
8
|
+
// <em>text</em>
|
|
9
|
+
'emphasis-elements'];
|
|
1
10
|
const defaults = {
|
|
2
11
|
failSilently: false,
|
|
3
12
|
patterns: ['paragraph-elements', 'span-elements', 'strong-elements', 'emphasis-elements'],
|
|
4
13
|
inheritColor: false,
|
|
5
14
|
enableUnsafeAutofix: false,
|
|
6
|
-
enableUnsafeReport:
|
|
15
|
+
enableUnsafeReport: true
|
|
7
16
|
};
|
|
8
17
|
export const getConfig = overrides => {
|
|
9
18
|
return Object.assign({}, defaults, overrides);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLintRule } from '../utils/create-rule';
|
|
2
2
|
import { errorBoundary } from '../utils/error-boundary';
|
|
3
|
-
import { getConfig } from './config';
|
|
3
|
+
import { getConfig, PATTERNS } from './config';
|
|
4
4
|
import { EmphasisElements, ParagraphElements, SpanElements, StrongElements } from './transformers';
|
|
5
5
|
const textDocsUrl = 'https://atlassian.design/components/primitives/text';
|
|
6
6
|
const rule = createLintRule({
|
|
@@ -9,6 +9,33 @@ const rule = createLintRule({
|
|
|
9
9
|
type: 'suggestion',
|
|
10
10
|
fixable: 'code',
|
|
11
11
|
hasSuggestions: true,
|
|
12
|
+
schema: [{
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {
|
|
15
|
+
failSilently: {
|
|
16
|
+
type: 'boolean'
|
|
17
|
+
},
|
|
18
|
+
inheritColor: {
|
|
19
|
+
type: 'boolean'
|
|
20
|
+
},
|
|
21
|
+
enableUnsafeAutofix: {
|
|
22
|
+
type: 'boolean'
|
|
23
|
+
},
|
|
24
|
+
enableUnsafeReport: {
|
|
25
|
+
type: 'boolean'
|
|
26
|
+
},
|
|
27
|
+
patterns: {
|
|
28
|
+
maxLength: PATTERNS.length,
|
|
29
|
+
type: 'array',
|
|
30
|
+
items: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
enum: PATTERNS
|
|
33
|
+
},
|
|
34
|
+
uniqueItems: true
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
additionalProperties: false
|
|
38
|
+
}],
|
|
12
39
|
docs: {
|
|
13
40
|
description: 'Encourage the usage of text components.',
|
|
14
41
|
recommended: false,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
4
5
|
import * as ast from '../../../ast-nodes';
|
|
5
|
-
import { getSourceCode } from '../../utils/context-compat';
|
|
6
6
|
import { addColorInheritAttributeFix, allowedAttrs, updateTestIdAttributeFix } from './common';
|
|
7
7
|
export const EmphasisElements = {
|
|
8
8
|
lint(node, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
4
5
|
import * as ast from '../../../ast-nodes';
|
|
5
|
-
import { getSourceCode } from '../../utils/context-compat';
|
|
6
6
|
import { addColorInheritAttributeFix, allowedAttrs, updateTestIdAttributeFix } from './common';
|
|
7
7
|
export const ParagraphElements = {
|
|
8
8
|
lint(node, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
4
5
|
import * as ast from '../../../ast-nodes';
|
|
5
|
-
import { getSourceCode } from '../../utils/context-compat';
|
|
6
6
|
import { addColorInheritAttributeFix, allowedAttrs, hasTextChildrenOnly, updateTestIdAttributeFix } from './common';
|
|
7
7
|
export const SpanElements = {
|
|
8
8
|
lint(node, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
4
5
|
import * as ast from '../../../ast-nodes';
|
|
5
|
-
import { getSourceCode } from '../../utils/context-compat';
|
|
6
6
|
import { addColorInheritAttributeFix, allowedAttrs, updateTestIdAttributeFix } from './common';
|
|
7
7
|
export const StrongElements = {
|
|
8
8
|
lint(node, {
|
|
@@ -28,7 +28,7 @@ const defaultConfig = {
|
|
|
28
28
|
failSilently: false,
|
|
29
29
|
shouldEnforceFallbacks: false,
|
|
30
30
|
enableUnsafeAutofix: false,
|
|
31
|
-
patterns: ['style-object']
|
|
31
|
+
patterns: ['style-object', 'font-weight', 'font-family', 'untokenized-properties', 'banned-properties', 'restricted-capitalisation']
|
|
32
32
|
};
|
|
33
33
|
export const getConfig = overrides => {
|
|
34
34
|
return Object.assign({}, defaultConfig, overrides);
|
|
@@ -54,7 +54,8 @@ const rule = createLintRule({
|
|
|
54
54
|
severity: 'warn'
|
|
55
55
|
},
|
|
56
56
|
messages: {
|
|
57
|
-
noRawTypographyValues: 'Typography primitives or tokens should be used instead of hard-coded values
|
|
57
|
+
noRawTypographyValues: 'Typography primitives or tokens should be used instead of hard-coded values.',
|
|
58
|
+
noFontSizeTypographyToken: 'Using tokens with the `fontSize` property is invalid. Any `font.heading` or `font.body` tokens must use the CSS `font` property.',
|
|
58
59
|
noRawFontWeightValues: 'Font weight tokens should be used instead of hard-coded values.',
|
|
59
60
|
noRawFontFamilyValues: 'Font family tokens should be used instead of hard-coded values.',
|
|
60
61
|
noUntokenizedProperties: 'Use typography tokens for `{{property}}`.',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
4
5
|
import { Root } from '../../../ast-nodes';
|
|
5
6
|
import { getNodeSource } from '../../utils/get-node-source';
|
|
6
7
|
import { isDecendantOfStyleBlock, isDecendantOfType } from '../../utils/is-node';
|
|
@@ -37,7 +38,7 @@ export const FontFamily = {
|
|
|
37
38
|
return false;
|
|
38
39
|
}
|
|
39
40
|
const isFontFamilyProperty = isNodeOfType(node.key, 'Identifier') && node.key.name === 'fontFamily';
|
|
40
|
-
const valueNodeSource = getNodeSource(context
|
|
41
|
+
const valueNodeSource = getNodeSource(getSourceCode(context), node.value);
|
|
41
42
|
if (isFontFamilyProperty && valueNodeSource.match(/(font\.family.|inherit)/)) {
|
|
42
43
|
return false;
|
|
43
44
|
}
|
|
@@ -64,7 +65,7 @@ export const FontFamily = {
|
|
|
64
65
|
fixes.push(fontWeightValueFix);
|
|
65
66
|
|
|
66
67
|
// Add import if it doesn't exist
|
|
67
|
-
const body = context.
|
|
68
|
+
const body = getSourceCode(context).ast.body;
|
|
68
69
|
const tokensImportDeclarations = Root.findImportsByModule(body, '@atlaskit/tokens');
|
|
69
70
|
|
|
70
71
|
// If there is more than one `@atlaskit/tokens` import, then it becomes difficult to determine which import to transform
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
4
5
|
import { Root } from '../../../ast-nodes';
|
|
5
6
|
import { getNodeSource } from '../../utils/get-node-source';
|
|
6
7
|
import { isDecendantOfStyleBlock, isDecendantOfType } from '../../utils/is-node';
|
|
@@ -37,7 +38,7 @@ export const FontWeight = {
|
|
|
37
38
|
return false;
|
|
38
39
|
}
|
|
39
40
|
const isFontWeightProperty = isNodeOfType(node.key, 'Identifier') && node.key.name === 'fontWeight';
|
|
40
|
-
const valueNodeSource = getNodeSource(context
|
|
41
|
+
const valueNodeSource = getNodeSource(getSourceCode(context), node.value);
|
|
41
42
|
if (isFontWeightProperty && valueNodeSource.match(/(font\.weight.|inherit)/)) {
|
|
42
43
|
return false;
|
|
43
44
|
}
|
|
@@ -65,7 +66,7 @@ export const FontWeight = {
|
|
|
65
66
|
fixes.push(fontWeightValueFix);
|
|
66
67
|
|
|
67
68
|
// Add import if it doesn't exist
|
|
68
|
-
const body = context.
|
|
69
|
+
const body = getSourceCode(context).ast.body;
|
|
69
70
|
const tokensImportDeclarations = Root.findImportsByModule(body, '@atlaskit/tokens');
|
|
70
71
|
|
|
71
72
|
// If there is more than one `@atlaskit/tokens` import, then it becomes difficult to determine which import to transform
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
4
5
|
import { Object as ASTObject, ObjectEntry, Root } from '../../../ast-nodes';
|
|
5
6
|
import { getValueForPropertyNode, normaliseValue } from '../../ensure-design-token-usage/utils';
|
|
6
|
-
import { getSourceCode } from '../../utils/context-compat';
|
|
7
7
|
import { isDecendantOfGlobalToken, isDecendantOfStyleBlock, isDecendantOfType } from '../../utils/is-node';
|
|
8
8
|
import { convertPropertyNodeToStringableNode, defaultFontWeight, findFontFamilyValueForToken, findFontWeightTokenForValue, findTypographyTokenForValues, fontWeightMap, getLiteralProperty, getTokenProperty, insertFallbackImportFull, insertFallbackImportSpecifier, insertTokensImport, isValidPropertyNode, isValidTypographyToken, notUndefined } from '../utils';
|
|
9
9
|
export const StyleObject = {
|
|
@@ -171,10 +171,7 @@ export const StyleObject = {
|
|
|
171
171
|
const fix = StyleObject._fix(fixerRefs, context);
|
|
172
172
|
context.report({
|
|
173
173
|
node: fontSizeNode,
|
|
174
|
-
messageId: 'noRawTypographyValues',
|
|
175
|
-
data: {
|
|
176
|
-
payload: `fontSize:${fontSizeRaw}`
|
|
177
|
-
},
|
|
174
|
+
messageId: isFontSizeAToken ? 'noFontSizeTypographyToken' : 'noRawTypographyValues',
|
|
178
175
|
...(config.enableUnsafeAutofix ? {
|
|
179
176
|
fix
|
|
180
177
|
} : {
|
|
@@ -187,10 +184,7 @@ export const StyleObject = {
|
|
|
187
184
|
} else if (!matchingTokens.length) {
|
|
188
185
|
context.report({
|
|
189
186
|
node: fontSizeNode,
|
|
190
|
-
messageId: 'noRawTypographyValues'
|
|
191
|
-
data: {
|
|
192
|
-
payload: `fontSize:${fontSizeRaw}`
|
|
193
|
-
}
|
|
187
|
+
messageId: 'noRawTypographyValues'
|
|
194
188
|
});
|
|
195
189
|
}
|
|
196
190
|
return;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
4
5
|
import { getNodeSource } from '../../utils/get-node-source';
|
|
5
6
|
import { isDecendantOfStyleBlock, isDecendantOfType } from '../../utils/is-node';
|
|
6
7
|
export const UntokenizedProperties = {
|
|
@@ -37,7 +38,7 @@ export const UntokenizedProperties = {
|
|
|
37
38
|
return false;
|
|
38
39
|
}
|
|
39
40
|
const isFontProperty = isNodeOfType(node.key, 'Identifier') && node.key.name === 'font';
|
|
40
|
-
const valueNodeSource = getNodeSource(context
|
|
41
|
+
const valueNodeSource = getNodeSource(getSourceCode(context), node.value);
|
|
41
42
|
if (isFontProperty && valueNodeSource.match(/(font\.(body|heading|code)|inherit)/)) {
|
|
42
43
|
return false;
|
|
43
44
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
2
|
|
|
3
3
|
import { closestOfType, hasImportDeclaration, isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
-
import { getSourceCode } from '
|
|
4
|
+
import { getDeclaredVariables, getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
5
5
|
import { createLintRule } from '../utils/create-rule';
|
|
6
6
|
import { isCssInJsObjectNode, isCssInJsTemplateNode } from '../utils/is-node';
|
|
7
7
|
import fixJsx from './fix-jsx';
|
|
@@ -36,7 +36,7 @@ const rule = createLintRule({
|
|
|
36
36
|
if (!visuallyHiddenOrAssistive) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
getDeclaredVariables(context, visuallyHiddenOrAssistive).forEach(someNode => {
|
|
40
40
|
someNode.references.map(innerNode => innerNode.identifier).forEach(idNode => {
|
|
41
41
|
// @ts-ignore JSX is not typed correctly in eslint
|
|
42
42
|
if ((idNode === null || idNode === void 0 ? void 0 : idNode.parent.type) === 'JSXExpressionContainer') {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { getScope, getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
1
2
|
import { getImportSources } from '@atlaskit/eslint-utils/is-supported-import';
|
|
2
|
-
import { getScope, getSourceCode } from '../context-compat';
|
|
3
3
|
import { checkIfSupportedExport } from './check-if-supported-export';
|
|
4
4
|
/**
|
|
5
5
|
* Creates a new ESLint rule for banning exporting certain function calls, e.g.
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
6
6
|
|
|
7
7
|
import esquery from 'esquery';
|
|
8
|
+
import { getScope, getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
8
9
|
import { getImportSources, isEmotion } from '@atlaskit/eslint-utils/is-supported-import';
|
|
9
|
-
import { getScope, getSourceCode } from '../context-compat';
|
|
10
10
|
import { generate } from './generate';
|
|
11
11
|
import { getTaggedTemplateExpressionOffset } from './get-tagged-template-expression-offset';
|
|
12
12
|
import { toArguments } from './to-arguments';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
-
import { getSourceCode } from '
|
|
2
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
3
3
|
/**
|
|
4
4
|
* Get the first import declaration in the file that matches any of the packages
|
|
5
5
|
* in `importSources`.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
4
5
|
import { isXcss } from '@atlaskit/eslint-utils/is-supported-import';
|
|
5
6
|
import { Root } from '../../ast-nodes';
|
|
6
|
-
import { getSourceCode } from './context-compat';
|
|
7
7
|
export const isDecendantOfGlobalToken = node => {
|
|
8
8
|
if (isNodeOfType(node, 'CallExpression') && isNodeOfType(node.callee, 'Identifier') && (node.callee.name === 'token' || node.callee.name === 'getTokenValue')) {
|
|
9
9
|
return true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
-
import { getSourceCode } from '
|
|
4
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
5
5
|
export var ObjectEntry = {
|
|
6
6
|
getProperty: function getProperty(node) {
|
|
7
7
|
if (isNodeOfType(node.key, 'Identifier')) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
2
|
|
|
3
3
|
import { hasImportDeclaration, insertImportDeclaration, isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
-
import { getSourceCode } from '
|
|
4
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
5
5
|
import { Import } from './import';
|
|
6
6
|
// Little bit unreadable, but better than duplicating the type
|
|
7
7
|
|
|
@@ -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::75357860fd00d6fc5060362c75d5db5e>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -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::1f8c75cb592edbc7ccb124c7e831e475>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -7,10 +7,10 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
7
7
|
import { getIdentifierInParentScope, insertAtStartOfFile, insertImportDeclaration, isNodeOfType } from 'eslint-codemod-utils';
|
|
8
8
|
import estraverse from 'estraverse';
|
|
9
9
|
import assign from 'lodash/assign';
|
|
10
|
+
import { getScope, getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
10
11
|
import { findVariable } from '@atlaskit/eslint-utils/find-variable';
|
|
11
12
|
import { CSS_IN_JS_IMPORTS } from '@atlaskit/eslint-utils/is-supported-import';
|
|
12
13
|
import { Import } from '../../ast-nodes';
|
|
13
|
-
import { getScope, getSourceCode } from '../utils/context-compat';
|
|
14
14
|
import { createLintRule } from '../utils/create-rule';
|
|
15
15
|
import { getFirstSupportedImport } from '../utils/get-first-supported-import';
|
|
16
16
|
import { getModuleOfIdentifier } from '../utils/get-import-node-by-source';
|
|
@@ -128,25 +128,25 @@ export var lintJSXLiteralForColor = function lintJSXLiteralForColor(node, contex
|
|
|
128
128
|
if (node.type !== 'Literal') {
|
|
129
129
|
return;
|
|
130
130
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (!isNodeOfType(
|
|
131
|
+
|
|
132
|
+
// Changed this condition to properly handle both direct literals and expression containers
|
|
133
|
+
var parent = isNodeOfType(node.parent, 'JSXExpressionContainer') ? node.parent.parent : node.parent;
|
|
134
|
+
if (!isNodeOfType(parent, 'JSXAttribute')) {
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
if (isDecendantOfSvgElement(
|
|
137
|
+
if (isDecendantOfSvgElement(parent)) {
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
// Box backgroundColor prop accepts token names directly - don't lint against this
|
|
142
|
-
if (isDecendantOfPrimitive(
|
|
142
|
+
if (isDecendantOfPrimitive(parent, context)) {
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
|
-
if (['alt', 'src', 'label', 'key', 'appearance'].includes(
|
|
145
|
+
if (['alt', 'src', 'label', 'key', 'appearance'].includes(typeof parent.name.name === 'string' ? parent.name.name : parent.name.name.name)) {
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
var isException = getIsException(config.exceptions);
|
|
149
|
-
if (isException(
|
|
149
|
+
if (isException(parent)) {
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -210,13 +210,13 @@ export var getTokenSuggestion = function getTokenSuggestion(node, reference, con
|
|
|
210
210
|
shouldReturnSuggestion: !isDecendantOfGlobalToken(node) && config.shouldEnforceFallbacks === false,
|
|
211
211
|
desc: "Convert to token",
|
|
212
212
|
fix: function fix(fixer) {
|
|
213
|
-
return fixer.replaceText(node, "token('')");
|
|
213
|
+
return fixer.replaceText(isNodeOfType(node.parent, 'MemberExpression') ? node.parent : node, "token('')");
|
|
214
214
|
}
|
|
215
215
|
}, {
|
|
216
216
|
shouldReturnSuggestion: !isDecendantOfGlobalToken(node) && config.shouldEnforceFallbacks === true,
|
|
217
217
|
desc: "Convert to token with fallback",
|
|
218
218
|
fix: function fix(fixer) {
|
|
219
|
-
return fixer.replaceText(node, isNodeOfType(node.parent, 'JSXAttribute') ? "{token('', ".concat(reference, ")}") : "token('', ".concat(reference, ")"));
|
|
219
|
+
return fixer.replaceText(isNodeOfType(node.parent, 'MemberExpression') ? node.parent : node, isNodeOfType(node.parent, 'JSXAttribute') ? "{token('', ".concat(reference, ")}") : "token('', ".concat(reference, ")"));
|
|
220
220
|
}
|
|
221
221
|
}].filter(filterSuggestion);
|
|
222
222
|
};
|
|
@@ -2,8 +2,8 @@ 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 { getScope, getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
5
6
|
import { getImportSources } from '@atlaskit/eslint-utils/is-supported-import';
|
|
6
|
-
import { getScope, getSourceCode } from '../utils/context-compat';
|
|
7
7
|
import { createLintRule } from '../utils/create-rule';
|
|
8
8
|
import { errorBoundary } from '../utils/error-boundary';
|
|
9
9
|
import { includesHardCodedColor } from '../utils/is-color';
|
|
@@ -37,7 +37,7 @@ var createWithConfig = function createWithConfig(initialConfig) {
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
// For expressions within template literals (e.g. `color: ${red}`) - color only
|
|
40
|
-
'TemplateLiteral > Identifier': function
|
|
40
|
+
'TemplateLiteral > Identifier': function TemplateLiteral__Identifier(node) {
|
|
41
41
|
if (config.domains.includes('color')) {
|
|
42
42
|
return lintTemplateIdentifierForColor(node, context, config);
|
|
43
43
|
}
|
|
@@ -269,21 +269,28 @@ var createWithConfig = function createWithConfig(initialConfig) {
|
|
|
269
269
|
}
|
|
270
270
|
},
|
|
271
271
|
// For inline JSX styles - literals (e.g. <Test color="red"/>) - color only
|
|
272
|
-
'JSXAttribute > Literal': function
|
|
272
|
+
'JSXAttribute > Literal': function JSXAttribute__Literal(node) {
|
|
273
|
+
if (config.domains.includes('color')) {
|
|
274
|
+
return lintJSXLiteralForColor(node, context, config);
|
|
275
|
+
}
|
|
276
|
+
return;
|
|
277
|
+
},
|
|
278
|
+
// Add handling for JSXExpressionContainer with string literals
|
|
279
|
+
'JSXAttribute > JSXExpressionContainer > Literal': function JSXAttribute__JSXExpressionContainer__Literal(node) {
|
|
273
280
|
if (config.domains.includes('color')) {
|
|
274
281
|
return lintJSXLiteralForColor(node, context, config);
|
|
275
282
|
}
|
|
276
283
|
return;
|
|
277
284
|
},
|
|
278
285
|
// For inline JSX styles - members (e.g. <Test color={color.red}/>) - color only
|
|
279
|
-
'JSXExpressionContainer > MemberExpression': function
|
|
286
|
+
'JSXExpressionContainer > MemberExpression': function JSXExpressionContainer__MemberExpression(node) {
|
|
280
287
|
if (config.domains.includes('color')) {
|
|
281
288
|
return lintJSXMemberForColor(node, context, config);
|
|
282
289
|
}
|
|
283
290
|
return;
|
|
284
291
|
},
|
|
285
292
|
// For inline JSX styles - identifiers (e.g. <Test color={red}/>) - color only
|
|
286
|
-
'JSXExpressionContainer > Identifier': function
|
|
293
|
+
'JSXExpressionContainer > Identifier': function JSXExpressionContainer__Identifier(node) {
|
|
287
294
|
if (config.domains.includes('color')) {
|
|
288
295
|
return lintJSXIdentifierForColor(node, context, config);
|
|
289
296
|
}
|
|
@@ -2,8 +2,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
3
|
|
|
4
4
|
import { callExpression, identifier, insertAtStartOfFile, insertImportDeclaration, isNodeOfType, literal } from 'eslint-codemod-utils';
|
|
5
|
+
import { getScope, getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
5
6
|
import { spacing as spacingScale } from '@atlaskit/tokens/tokens-raw';
|
|
6
|
-
import { getScope, getSourceCode } from '../utils/context-compat';
|
|
7
7
|
import { findIdentifierInParentScope } from '../utils/find-in-parent';
|
|
8
8
|
import { isColorCssPropertyName, isCurrentSurfaceCustomPropertyName } from '../utils/is-color';
|
|
9
9
|
import { borderWidthValueToToken, isBorderRadius, isBorderSizeProperty, isShapeProperty, radiusValueToToken } from './shape';
|
|
@@ -294,7 +294,7 @@ export var convertHyphenatedNameToCamelCase = function convertHyphenatedNameToCa
|
|
|
294
294
|
* @param node
|
|
295
295
|
* @returns The furthest parent node that is on the same line as the input node.
|
|
296
296
|
*/
|
|
297
|
-
|
|
297
|
+
var _findParentNodeForLine = function findParentNodeForLine(node) {
|
|
298
298
|
var _node$loc, _node$parent$loc;
|
|
299
299
|
if (!node.parent) {
|
|
300
300
|
return node;
|
|
@@ -302,7 +302,7 @@ export var findParentNodeForLine = function findParentNodeForLine(node) {
|
|
|
302
302
|
if (((_node$loc = node.loc) === null || _node$loc === void 0 ? void 0 : _node$loc.start.line) !== ((_node$parent$loc = node.parent.loc) === null || _node$parent$loc === void 0 ? void 0 : _node$parent$loc.start.line)) {
|
|
303
303
|
return node;
|
|
304
304
|
} else {
|
|
305
|
-
return
|
|
305
|
+
return _findParentNodeForLine(node.parent);
|
|
306
306
|
}
|
|
307
307
|
};
|
|
308
308
|
|
|
@@ -317,6 +317,7 @@ export var findParentNodeForLine = function findParentNodeForLine(node) {
|
|
|
317
317
|
* propertyName: backgroundColor, targetOptions: ['color', 'spacing'] -> returns ['color']
|
|
318
318
|
* ```
|
|
319
319
|
*/
|
|
320
|
+
export { _findParentNodeForLine as findParentNodeForLine };
|
|
320
321
|
export function getDomainsForProperty(propertyName, targetOptions) {
|
|
321
322
|
var domains = [];
|
|
322
323
|
if ((isColorCssPropertyName(propertyName) || isCurrentSurfaceCustomPropertyName(propertyName)) && targetOptions.includes('color')) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
-
import { getSourceCode } from '
|
|
2
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
3
3
|
import { createLintRule } from '../utils/create-rule';
|
|
4
4
|
import { getConfig } from '../utils/get-deprecated-config';
|
|
5
5
|
import { isDeprecatedJSXAttributeConfig } from '../utils/types';
|
package/dist/esm/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind-all.js
CHANGED
|
@@ -4,7 +4,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
4
4
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
5
5
|
|
|
6
6
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
7
|
-
import { getSourceCode } from '
|
|
7
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
8
8
|
import { getModuleOfIdentifier } from '../../utils/get-import-node-by-source';
|
|
9
9
|
import { isBlockedEventBinding } from '../shared/is-blocked-event-binding';
|
|
10
10
|
export function isBlockedBindAll(context, node) {
|
package/dist/esm/rules/no-direct-use-of-web-platform-drag-and-drop/checks/is-blocked-bind.js
CHANGED
|
@@ -4,7 +4,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
4
4
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
5
5
|
|
|
6
6
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
7
|
-
import { getSourceCode } from '
|
|
7
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
8
8
|
import { getModuleOfIdentifier } from '../../utils/get-import-node-by-source';
|
|
9
9
|
import { isBlockedEventBinding } from '../shared/is-blocked-event-binding';
|
|
10
10
|
export function isBlockedBind(context, node) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
-
import { getSourceCode } from '
|
|
4
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
5
5
|
import { getModuleOfIdentifier } from '../../utils/get-import-node-by-source';
|
|
6
6
|
import { blockedJSXAttributeLookup } from '../shared/blocked';
|
|
7
7
|
function getJSXElementNameFromAttribute(attribute) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { getScope } from '@atlaskit/eslint-utils/context-compat';
|
|
2
3
|
import { getImportSources, isStyled } from '@atlaskit/eslint-utils/is-supported-import';
|
|
3
|
-
import { getScope } from '../utils/context-compat';
|
|
4
4
|
import { createLintRule } from '../utils/create-rule';
|
|
5
5
|
var isEmptyStyledExpression = function isEmptyStyledExpression(node) {
|
|
6
6
|
var _node$arguments = _slicedToArray(node.arguments, 1),
|
|
@@ -3,8 +3,8 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
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
4
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
5
5
|
|
|
6
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
6
7
|
import * as ast from '../../../../ast-nodes';
|
|
7
|
-
import { getSourceCode } from '../../../utils/context-compat';
|
|
8
8
|
import { isSupportedForLint } from '../supported';
|
|
9
9
|
function isImportDeclaration(node) {
|
|
10
10
|
return node.type === 'ImportDeclaration';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
-
import { getScope } from '
|
|
4
|
+
import { getScope } from '@atlaskit/eslint-utils/context-compat';
|
|
5
5
|
import { getJsxElementByName } from '../../utils/get-jsx-element-by-name';
|
|
6
6
|
import { isSupportedForLint } from '../supported';
|
|
7
7
|
import { getStyledComponentCall } from './get-styled-component-call';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
2
|
|
|
3
3
|
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
4
|
-
import { getScope } from '
|
|
4
|
+
import { getScope } from '@atlaskit/eslint-utils/context-compat';
|
|
5
5
|
import { getJsxElementByName } from '../../utils/get-jsx-element-by-name';
|
|
6
6
|
import { isSupportedForLint } from '../supported';
|
|
7
7
|
import { getStyledComponentCall } from './get-styled-component-call';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { getScope, getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
1
2
|
import { CSS_IN_JS_IMPORTS, isCssMap } from '@atlaskit/eslint-utils/is-supported-import';
|
|
2
|
-
import { getScope, getSourceCode } from '../utils/context-compat';
|
|
3
3
|
import { checkIfSupportedExport } from '../utils/create-no-exported-rule/check-if-supported-export';
|
|
4
4
|
import { createLintRule } from '../utils/create-rule';
|
|
5
5
|
import { CssMapObjectChecker, getCssMapObject } from './utils';
|
|
@@ -4,8 +4,8 @@ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol
|
|
|
4
4
|
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; } }
|
|
5
5
|
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; }
|
|
6
6
|
import { getAllowedFunctionCalls, isAllowListedVariable } from '@atlaskit/eslint-utils/allowed-function-calls';
|
|
7
|
+
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
7
8
|
import { findVariable } from '@atlaskit/eslint-utils/find-variable';
|
|
8
|
-
import { getSourceCode } from '../utils/context-compat';
|
|
9
9
|
export var getCssMapObject = function getCssMapObject(node) {
|
|
10
10
|
// We assume the argument `node` is already a cssMap() call.
|
|
11
11
|
|