@atlaskit/eslint-plugin-design-system 13.5.0 → 13.6.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 +8 -0
- package/README.md +1 -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-html-checkbox/index.js +34 -0
- package/dist/cjs/rules/no-html-checkbox/node-types/index.js +12 -0
- package/dist/cjs/rules/no-html-checkbox/node-types/jsx-element/index.js +27 -0
- package/dist/cjs/rules/no-html-checkbox/node-types/supported.js +70 -0
- package/dist/cjs/rules/utils/get-jsx-element-by-name.js +53 -0
- package/dist/cjs/rules/utils/get-styled-component-call.js +47 -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-html-checkbox/index.js +28 -0
- package/dist/es2019/rules/no-html-checkbox/node-types/index.js +1 -0
- package/dist/es2019/rules/no-html-checkbox/node-types/jsx-element/index.js +19 -0
- package/dist/es2019/rules/no-html-checkbox/node-types/supported.js +60 -0
- package/dist/es2019/rules/utils/get-jsx-element-by-name.js +39 -0
- package/dist/es2019/rules/utils/get-styled-component-call.js +42 -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-html-checkbox/index.js +28 -0
- package/dist/esm/rules/no-html-checkbox/node-types/index.js +1 -0
- package/dist/esm/rules/no-html-checkbox/node-types/jsx-element/index.js +18 -0
- package/dist/esm/rules/no-html-checkbox/node-types/supported.js +61 -0
- package/dist/esm/rules/utils/get-jsx-element-by-name.js +47 -0
- package/dist/esm/rules/utils/get-styled-component-call.js +42 -0
- 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/no-html-checkbox/index.d.ts +3 -0
- package/dist/types/rules/no-html-checkbox/node-types/index.d.ts +1 -0
- package/dist/types/rules/no-html-checkbox/node-types/jsx-element/index.d.ts +8 -0
- package/dist/types/rules/no-html-checkbox/node-types/supported.d.ts +7 -0
- package/dist/types/rules/utils/get-jsx-element-by-name.d.ts +6 -0
- package/dist/types/rules/utils/get-styled-component-call.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/no-html-checkbox/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/no-html-checkbox/node-types/index.d.ts +1 -0
- package/dist/types-ts4.5/rules/no-html-checkbox/node-types/jsx-element/index.d.ts +8 -0
- package/dist/types-ts4.5/rules/no-html-checkbox/node-types/supported.d.ts +7 -0
- package/dist/types-ts4.5/rules/utils/get-jsx-element-by-name.d.ts +6 -0
- package/dist/types-ts4.5/rules/utils/get-styled-component-call.d.ts +6 -0
- package/package.json +2 -2
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { closestOfType, isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns a styled component
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const getStyledComponentCall = node => {
|
|
8
|
+
// halts unless we are dealing with a styled component
|
|
9
|
+
if (!isStyledCallExpression(node)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
// halts if the component is being exported directly
|
|
13
|
+
if (closestOfType(node, 'ExportNamedDeclaration')) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const styledComponentVariableRef = node.parent;
|
|
17
|
+
// halts if the styled component is not assigned to a variable immediately
|
|
18
|
+
if (!isNodeOfType(styledComponentVariableRef, 'VariableDeclarator')) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
return styledComponentVariableRef;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Some verbose precondition checks but all it does is check
|
|
26
|
+
* a call expression is of form `styled.a` or `styled2.a`
|
|
27
|
+
*/
|
|
28
|
+
const isStyledCallExpression = call => {
|
|
29
|
+
if (!isNodeOfType(call, 'CallExpression')) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
if (!isNodeOfType(call.callee, 'MemberExpression')) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
if (!isNodeOfType(call.callee.object, 'Identifier') || !isNodeOfType(call.callee.property, 'Identifier')) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
if (/^styled2?$/.test(call.callee.object.name)) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
};
|
|
@@ -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::c78819ddb772edbd8d5e2dc246c52d11>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -24,6 +24,7 @@ export default {
|
|
|
24
24
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': 'error',
|
|
25
25
|
'@atlaskit/design-system/no-html-anchor': 'warn',
|
|
26
26
|
'@atlaskit/design-system/no-html-button': 'warn',
|
|
27
|
+
'@atlaskit/design-system/no-html-checkbox': 'warn',
|
|
27
28
|
'@atlaskit/design-system/no-invalid-css-map': ['error', {
|
|
28
29
|
allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
|
|
29
30
|
}],
|
|
@@ -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::d35975a64956ac336de205b1272c43f1>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -23,6 +23,7 @@ export default {
|
|
|
23
23
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': 'error',
|
|
24
24
|
'@atlaskit/design-system/no-html-anchor': 'warn',
|
|
25
25
|
'@atlaskit/design-system/no-html-button': 'warn',
|
|
26
|
+
'@atlaskit/design-system/no-html-checkbox': 'warn',
|
|
26
27
|
'@atlaskit/design-system/no-invalid-css-map': ['error', {
|
|
27
28
|
allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
|
|
28
29
|
}],
|
|
@@ -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::b96889a18bb45c45fa23ed42442732ba>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -19,6 +19,7 @@ export default {
|
|
|
19
19
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': 'error',
|
|
20
20
|
'@atlaskit/design-system/no-html-anchor': 'warn',
|
|
21
21
|
'@atlaskit/design-system/no-html-button': 'warn',
|
|
22
|
+
'@atlaskit/design-system/no-html-checkbox': 'warn',
|
|
22
23
|
'@atlaskit/design-system/no-invalid-css-map': ['error', {
|
|
23
24
|
allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
|
|
24
25
|
}],
|
|
@@ -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::bd1d631a2db18da8a0726bec36044a51>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -18,6 +18,7 @@ export default {
|
|
|
18
18
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': 'error',
|
|
19
19
|
'@atlaskit/design-system/no-html-anchor': 'warn',
|
|
20
20
|
'@atlaskit/design-system/no-html-button': 'warn',
|
|
21
|
+
'@atlaskit/design-system/no-html-checkbox': 'warn',
|
|
21
22
|
'@atlaskit/design-system/no-invalid-css-map': ['error', {
|
|
22
23
|
allowedFunctionCalls: [['@atlaskit/tokens', 'token']]
|
|
23
24
|
}],
|
|
@@ -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::622bf05b9ade457d05e872b25c71ba5d>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import consistentCssPropUsage from './consistent-css-prop-usage';
|
|
@@ -22,6 +22,7 @@ import noExportedCss from './no-exported-css';
|
|
|
22
22
|
import noExportedKeyframes from './no-exported-keyframes';
|
|
23
23
|
import noHtmlAnchor from './no-html-anchor';
|
|
24
24
|
import noHtmlButton from './no-html-button';
|
|
25
|
+
import noHtmlCheckbox from './no-html-checkbox';
|
|
25
26
|
import noInvalidCssMap from './no-invalid-css-map';
|
|
26
27
|
import noKeyframesTaggedTemplateExpression from './no-keyframes-tagged-template-expression';
|
|
27
28
|
import noLegacyIcons from './no-legacy-icons';
|
|
@@ -74,6 +75,7 @@ export var rules = {
|
|
|
74
75
|
'no-exported-keyframes': noExportedKeyframes,
|
|
75
76
|
'no-html-anchor': noHtmlAnchor,
|
|
76
77
|
'no-html-button': noHtmlButton,
|
|
78
|
+
'no-html-checkbox': noHtmlCheckbox,
|
|
77
79
|
'no-invalid-css-map': noInvalidCssMap,
|
|
78
80
|
'no-keyframes-tagged-template-expression': noKeyframesTaggedTemplateExpression,
|
|
79
81
|
'no-legacy-icons': noLegacyIcons,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createLintRule } from '../utils/create-rule';
|
|
2
|
+
import { JSXElement as _JSXElement } from './node-types';
|
|
3
|
+
var rule = createLintRule({
|
|
4
|
+
meta: {
|
|
5
|
+
name: 'no-html-checkbox',
|
|
6
|
+
type: 'suggestion',
|
|
7
|
+
hasSuggestions: true,
|
|
8
|
+
docs: {
|
|
9
|
+
description: 'Discourage direct usage of HTML checkbox elements in favor of the Atlassian Design System checkbox component.',
|
|
10
|
+
recommended: true,
|
|
11
|
+
severity: 'warn'
|
|
12
|
+
},
|
|
13
|
+
messages: {
|
|
14
|
+
noHtmlCheckbox: "This <{{ name }}> should be replaced with a checkbox component from the Atlassian Design System. ADS components include event tracking, ensure accessible implementations, and provide access to ADS styling features like design tokens."
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
create: function create(context) {
|
|
18
|
+
return {
|
|
19
|
+
// transforms <input type="checkbox" css={...}> usages
|
|
20
|
+
JSXElement: function JSXElement(node) {
|
|
21
|
+
_JSXElement.lint(node, {
|
|
22
|
+
context: context
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
export default rule;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { JSXElement } from './jsx-element';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as ast from '../../../../ast-nodes';
|
|
2
|
+
import { isSupportedForLint } from '../supported';
|
|
3
|
+
export var JSXElement = {
|
|
4
|
+
lint: function lint(node, _ref) {
|
|
5
|
+
var context = _ref.context;
|
|
6
|
+
if (!isSupportedForLint(node)) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
var nodeName = ast.JSXElement.getName(node);
|
|
10
|
+
context.report({
|
|
11
|
+
node: node.openingElement,
|
|
12
|
+
messageId: 'noHtmlCheckbox',
|
|
13
|
+
data: {
|
|
14
|
+
name: nodeName
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
+
import * as ast from '../../../ast-nodes';
|
|
3
|
+
var supportedElements = [{
|
|
4
|
+
name: 'input',
|
|
5
|
+
attributes: [{
|
|
6
|
+
name: 'type',
|
|
7
|
+
values: ['checkbox']
|
|
8
|
+
}]
|
|
9
|
+
}];
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Determines if the given JSX element is a supported element to lint with this rule.
|
|
13
|
+
*/
|
|
14
|
+
export function isSupportedForLint(jsxNode, elementName) {
|
|
15
|
+
if (!isNodeOfType(jsxNode, 'JSXElement')) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Allow passing in the element name because the jsxNode doesn't
|
|
20
|
+
// represent the element name with styled components
|
|
21
|
+
var elName = elementName || ast.JSXElement.getName(jsxNode);
|
|
22
|
+
if (!elName) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Only check native HTML elements, not components
|
|
27
|
+
if (elName[0] !== elName[0].toLowerCase()) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
var supportedElement = supportedElements.find(function (_ref) {
|
|
31
|
+
var name = _ref.name;
|
|
32
|
+
return name === elName;
|
|
33
|
+
});
|
|
34
|
+
if (!supportedElement) {
|
|
35
|
+
supportedElement = supportedElements.find(function (_ref2) {
|
|
36
|
+
var name = _ref2.name;
|
|
37
|
+
return name === '*';
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (!supportedElement) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Check if the element has any attributes that are not supported
|
|
45
|
+
var attributes = ast.JSXElement.getAttributes(jsxNode);
|
|
46
|
+
if (supportedElement.attributes && !supportedElement.attributes.every(function (_ref3) {
|
|
47
|
+
var name = _ref3.name,
|
|
48
|
+
values = _ref3.values;
|
|
49
|
+
return attributes.some(function (attribute) {
|
|
50
|
+
if (attribute.type === 'JSXSpreadAttribute') {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
var isMatchingName = attribute.name.name === name;
|
|
54
|
+
var isMatchingValues = values && attribute.value && attribute.value.type === 'Literal' && typeof attribute.value.value === 'string' && (values === null || values === void 0 ? void 0 : values.includes(attribute.value.value));
|
|
55
|
+
return isMatchingName && isMatchingValues;
|
|
56
|
+
});
|
|
57
|
+
})) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Given a component name finds its JSX usage
|
|
6
|
+
*/
|
|
7
|
+
export var getJsxElementByName = function getJsxElementByName(componentName, scope) {
|
|
8
|
+
var _variableDeclaration$;
|
|
9
|
+
var variableDeclaration = scope.variables.find(function (v) {
|
|
10
|
+
return v.name === componentName;
|
|
11
|
+
});
|
|
12
|
+
if (!variableDeclaration) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// length here should be exactly 2 to indicate only two references:
|
|
17
|
+
// one being the variable declaration itself
|
|
18
|
+
// second being the JSX call site
|
|
19
|
+
// we might consider handling multiple local JSX call sites in the future
|
|
20
|
+
// but "this is good enough for now"™️
|
|
21
|
+
if (variableDeclaration.references.length !== 2) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
var jsxUsage = (_variableDeclaration$ = variableDeclaration.references[1]) === null || _variableDeclaration$ === void 0 ? void 0 : _variableDeclaration$.identifier;
|
|
25
|
+
var _variableDeclaration$2 = variableDeclaration.references.map(function (ref) {
|
|
26
|
+
return ref === null || ref === void 0 ? void 0 : ref.identifier;
|
|
27
|
+
}),
|
|
28
|
+
_variableDeclaration$3 = _slicedToArray(_variableDeclaration$2, 2),
|
|
29
|
+
firstIdentifier = _variableDeclaration$3[0],
|
|
30
|
+
secondIdentifier = _variableDeclaration$3[1];
|
|
31
|
+
// Check if the first reference is a JSXOpeningElement and the second is not or vice versa
|
|
32
|
+
if (isNodeOfType(firstIdentifier, 'JSXIdentifier') && !isNodeOfType(secondIdentifier, 'JSXIdentifier')) {
|
|
33
|
+
jsxUsage = firstIdentifier;
|
|
34
|
+
} else if (isNodeOfType(secondIdentifier, 'JSXIdentifier') && !isNodeOfType(firstIdentifier, 'JSXIdentifier')) {
|
|
35
|
+
jsxUsage = secondIdentifier;
|
|
36
|
+
} else {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (!isNodeOfType(jsxUsage, 'JSXIdentifier')) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
var jsxOpeningElement = jsxUsage.parent;
|
|
43
|
+
if (!isNodeOfType(jsxOpeningElement, 'JSXOpeningElement')) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
return jsxOpeningElement;
|
|
47
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { closestOfType, isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns a styled component
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export var getStyledComponentCall = function getStyledComponentCall(node) {
|
|
8
|
+
// halts unless we are dealing with a styled component
|
|
9
|
+
if (!isStyledCallExpression(node)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
// halts if the component is being exported directly
|
|
13
|
+
if (closestOfType(node, 'ExportNamedDeclaration')) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
var styledComponentVariableRef = node.parent;
|
|
17
|
+
// halts if the styled component is not assigned to a variable immediately
|
|
18
|
+
if (!isNodeOfType(styledComponentVariableRef, 'VariableDeclarator')) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
return styledComponentVariableRef;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Some verbose precondition checks but all it does is check
|
|
26
|
+
* a call expression is of form `styled.a` or `styled2.a`
|
|
27
|
+
*/
|
|
28
|
+
var isStyledCallExpression = function isStyledCallExpression(call) {
|
|
29
|
+
if (!isNodeOfType(call, 'CallExpression')) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
if (!isNodeOfType(call.callee, 'MemberExpression')) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
if (!isNodeOfType(call.callee.object, 'Identifier') || !isNodeOfType(call.callee.property, 'Identifier')) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
if (/^styled2?$/.test(call.callee.object.name)) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
};
|
|
@@ -34,6 +34,7 @@ export declare const plugin: {
|
|
|
34
34
|
'no-exported-keyframes': import("eslint").Rule.RuleModule;
|
|
35
35
|
'no-html-anchor': import("eslint").Rule.RuleModule;
|
|
36
36
|
'no-html-button': import("eslint").Rule.RuleModule;
|
|
37
|
+
'no-html-checkbox': import("eslint").Rule.RuleModule;
|
|
37
38
|
'no-invalid-css-map': import("eslint").Rule.RuleModule;
|
|
38
39
|
'no-keyframes-tagged-template-expression': import("eslint").Rule.RuleModule;
|
|
39
40
|
'no-legacy-icons': import("eslint").Rule.RuleModule;
|
|
@@ -87,6 +88,7 @@ export declare const plugin: {
|
|
|
87
88
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
88
89
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
89
90
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
91
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
90
92
|
'@atlaskit/design-system/no-invalid-css-map': ["error", {
|
|
91
93
|
allowedFunctionCalls: string[][];
|
|
92
94
|
}];
|
|
@@ -144,6 +146,7 @@ export declare const plugin: {
|
|
|
144
146
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
145
147
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
146
148
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
149
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
147
150
|
'@atlaskit/design-system/no-invalid-css-map': ["error", {
|
|
148
151
|
allowedFunctionCalls: string[][];
|
|
149
152
|
}];
|
|
@@ -194,6 +197,7 @@ export declare const plugin: {
|
|
|
194
197
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
195
198
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
196
199
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
200
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
197
201
|
'@atlaskit/design-system/no-invalid-css-map': ["error", {
|
|
198
202
|
allowedFunctionCalls: string[][];
|
|
199
203
|
}];
|
|
@@ -235,6 +239,7 @@ export declare const plugin: {
|
|
|
235
239
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
236
240
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
237
241
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
242
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
238
243
|
'@atlaskit/design-system/no-invalid-css-map': ["error", {
|
|
239
244
|
allowedFunctionCalls: string[][];
|
|
240
245
|
}];
|
|
@@ -282,6 +287,7 @@ declare const configs: {
|
|
|
282
287
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
283
288
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
284
289
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
290
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
285
291
|
'@atlaskit/design-system/no-invalid-css-map': ["error", {
|
|
286
292
|
allowedFunctionCalls: string[][];
|
|
287
293
|
}];
|
|
@@ -339,6 +345,7 @@ declare const configs: {
|
|
|
339
345
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
340
346
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
341
347
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
348
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
342
349
|
'@atlaskit/design-system/no-invalid-css-map': ["error", {
|
|
343
350
|
allowedFunctionCalls: string[][];
|
|
344
351
|
}];
|
|
@@ -389,6 +396,7 @@ declare const configs: {
|
|
|
389
396
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
390
397
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
391
398
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
399
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
392
400
|
'@atlaskit/design-system/no-invalid-css-map': ["error", {
|
|
393
401
|
allowedFunctionCalls: string[][];
|
|
394
402
|
}];
|
|
@@ -430,6 +438,7 @@ declare const configs: {
|
|
|
430
438
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
431
439
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
432
440
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
441
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
433
442
|
'@atlaskit/design-system/no-invalid-css-map': ["error", {
|
|
434
443
|
allowedFunctionCalls: string[][];
|
|
435
444
|
}];
|
|
@@ -17,6 +17,7 @@ declare const _default: {
|
|
|
17
17
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
18
18
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
19
19
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
20
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
20
21
|
'@atlaskit/design-system/no-invalid-css-map': ["error", {
|
|
21
22
|
allowedFunctionCalls: string[][];
|
|
22
23
|
}];
|
|
@@ -17,6 +17,7 @@ declare const _default: {
|
|
|
17
17
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
18
18
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
19
19
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
20
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
20
21
|
'@atlaskit/design-system/no-invalid-css-map': ["error", {
|
|
21
22
|
allowedFunctionCalls: string[][];
|
|
22
23
|
}];
|
|
@@ -12,6 +12,7 @@ declare const _default: {
|
|
|
12
12
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
13
13
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
14
14
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
15
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
15
16
|
'@atlaskit/design-system/no-invalid-css-map': ["error", {
|
|
16
17
|
allowedFunctionCalls: string[][];
|
|
17
18
|
}];
|
|
@@ -12,6 +12,7 @@ declare const _default: {
|
|
|
12
12
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
13
13
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
14
14
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
15
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
15
16
|
'@atlaskit/design-system/no-invalid-css-map': ["error", {
|
|
16
17
|
allowedFunctionCalls: string[][];
|
|
17
18
|
}];
|
|
@@ -18,6 +18,7 @@ export declare const rules: {
|
|
|
18
18
|
'no-exported-keyframes': import("eslint").Rule.RuleModule;
|
|
19
19
|
'no-html-anchor': import("eslint").Rule.RuleModule;
|
|
20
20
|
'no-html-button': import("eslint").Rule.RuleModule;
|
|
21
|
+
'no-html-checkbox': import("eslint").Rule.RuleModule;
|
|
21
22
|
'no-invalid-css-map': import("eslint").Rule.RuleModule;
|
|
22
23
|
'no-keyframes-tagged-template-expression': import("eslint").Rule.RuleModule;
|
|
23
24
|
'no-legacy-icons': import("eslint").Rule.RuleModule;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { JSXElement } from './jsx-element';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type EslintNode } from 'eslint-codemod-utils';
|
|
2
|
+
/**
|
|
3
|
+
* Determines if the given JSX element is a supported element to lint with this rule.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isSupportedForLint(jsxNode: EslintNode, elementName?: string): jsxNode is Extract<EslintNode, {
|
|
6
|
+
type: 'JSXElement';
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Rule, Scope } from 'eslint';
|
|
2
|
+
import { type JSXOpeningElement } from 'eslint-codemod-utils';
|
|
3
|
+
/**
|
|
4
|
+
* Given a component name finds its JSX usage
|
|
5
|
+
*/
|
|
6
|
+
export declare const getJsxElementByName: (componentName: string, scope: Scope.Scope) => (JSXOpeningElement & Rule.NodeParentExtension) | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import { type VariableDeclarator } from 'eslint-codemod-utils';
|
|
3
|
+
/**
|
|
4
|
+
* Returns a styled component
|
|
5
|
+
*/
|
|
6
|
+
export declare const getStyledComponentCall: (node: Rule.Node) => (VariableDeclarator & Rule.NodeParentExtension) | undefined;
|
|
@@ -34,6 +34,7 @@ export declare const plugin: {
|
|
|
34
34
|
'no-exported-keyframes': import("eslint").Rule.RuleModule;
|
|
35
35
|
'no-html-anchor': import("eslint").Rule.RuleModule;
|
|
36
36
|
'no-html-button': import("eslint").Rule.RuleModule;
|
|
37
|
+
'no-html-checkbox': import("eslint").Rule.RuleModule;
|
|
37
38
|
'no-invalid-css-map': import("eslint").Rule.RuleModule;
|
|
38
39
|
'no-keyframes-tagged-template-expression': import("eslint").Rule.RuleModule;
|
|
39
40
|
'no-legacy-icons': import("eslint").Rule.RuleModule;
|
|
@@ -87,6 +88,7 @@ export declare const plugin: {
|
|
|
87
88
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
88
89
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
89
90
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
91
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
90
92
|
'@atlaskit/design-system/no-invalid-css-map': [
|
|
91
93
|
"error",
|
|
92
94
|
{
|
|
@@ -147,6 +149,7 @@ export declare const plugin: {
|
|
|
147
149
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
148
150
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
149
151
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
152
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
150
153
|
'@atlaskit/design-system/no-invalid-css-map': [
|
|
151
154
|
"error",
|
|
152
155
|
{
|
|
@@ -200,6 +203,7 @@ export declare const plugin: {
|
|
|
200
203
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
201
204
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
202
205
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
206
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
203
207
|
'@atlaskit/design-system/no-invalid-css-map': [
|
|
204
208
|
"error",
|
|
205
209
|
{
|
|
@@ -244,6 +248,7 @@ export declare const plugin: {
|
|
|
244
248
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
245
249
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
246
250
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
251
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
247
252
|
'@atlaskit/design-system/no-invalid-css-map': [
|
|
248
253
|
"error",
|
|
249
254
|
{
|
|
@@ -294,6 +299,7 @@ declare const configs: {
|
|
|
294
299
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
295
300
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
296
301
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
302
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
297
303
|
'@atlaskit/design-system/no-invalid-css-map': [
|
|
298
304
|
"error",
|
|
299
305
|
{
|
|
@@ -354,6 +360,7 @@ declare const configs: {
|
|
|
354
360
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
355
361
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
356
362
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
363
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
357
364
|
'@atlaskit/design-system/no-invalid-css-map': [
|
|
358
365
|
"error",
|
|
359
366
|
{
|
|
@@ -407,6 +414,7 @@ declare const configs: {
|
|
|
407
414
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
408
415
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
409
416
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
417
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
410
418
|
'@atlaskit/design-system/no-invalid-css-map': [
|
|
411
419
|
"error",
|
|
412
420
|
{
|
|
@@ -451,6 +459,7 @@ declare const configs: {
|
|
|
451
459
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
452
460
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
453
461
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
462
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
454
463
|
'@atlaskit/design-system/no-invalid-css-map': [
|
|
455
464
|
"error",
|
|
456
465
|
{
|
|
@@ -17,6 +17,7 @@ declare const _default: {
|
|
|
17
17
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
18
18
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
19
19
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
20
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
20
21
|
'@atlaskit/design-system/no-invalid-css-map': [
|
|
21
22
|
"error",
|
|
22
23
|
{
|
|
@@ -17,6 +17,7 @@ declare const _default: {
|
|
|
17
17
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
18
18
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
19
19
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
20
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
20
21
|
'@atlaskit/design-system/no-invalid-css-map': [
|
|
21
22
|
"error",
|
|
22
23
|
{
|
|
@@ -12,6 +12,7 @@ declare const _default: {
|
|
|
12
12
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
13
13
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
14
14
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
15
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
15
16
|
'@atlaskit/design-system/no-invalid-css-map': [
|
|
16
17
|
"error",
|
|
17
18
|
{
|
|
@@ -12,6 +12,7 @@ declare const _default: {
|
|
|
12
12
|
'@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop': "error";
|
|
13
13
|
'@atlaskit/design-system/no-html-anchor': "warn";
|
|
14
14
|
'@atlaskit/design-system/no-html-button': "warn";
|
|
15
|
+
'@atlaskit/design-system/no-html-checkbox': "warn";
|
|
15
16
|
'@atlaskit/design-system/no-invalid-css-map': [
|
|
16
17
|
"error",
|
|
17
18
|
{
|
|
@@ -18,6 +18,7 @@ export declare const rules: {
|
|
|
18
18
|
'no-exported-keyframes': import("eslint").Rule.RuleModule;
|
|
19
19
|
'no-html-anchor': import("eslint").Rule.RuleModule;
|
|
20
20
|
'no-html-button': import("eslint").Rule.RuleModule;
|
|
21
|
+
'no-html-checkbox': import("eslint").Rule.RuleModule;
|
|
21
22
|
'no-invalid-css-map': import("eslint").Rule.RuleModule;
|
|
22
23
|
'no-keyframes-tagged-template-expression': import("eslint").Rule.RuleModule;
|
|
23
24
|
'no-legacy-icons': import("eslint").Rule.RuleModule;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { JSXElement } from './jsx-element';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type EslintNode } from 'eslint-codemod-utils';
|
|
2
|
+
/**
|
|
3
|
+
* Determines if the given JSX element is a supported element to lint with this rule.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isSupportedForLint(jsxNode: EslintNode, elementName?: string): jsxNode is Extract<EslintNode, {
|
|
6
|
+
type: 'JSXElement';
|
|
7
|
+
}>;
|