@atlaskit/eslint-plugin-design-system 15.2.0 → 15.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +1 -1
- package/compass.yml +2 -2
- package/dist/cjs/presets/all-flat.codegen.js +2 -2
- package/dist/cjs/presets/all.codegen.js +2 -2
- package/dist/cjs/presets/recommended-flat.codegen.js +1 -2
- package/dist/cjs/presets/recommended.codegen.js +1 -2
- package/dist/cjs/rules/expand-motion-shorthand/index.js +285 -0
- package/dist/cjs/rules/index.codegen.js +3 -3
- package/dist/es2019/presets/all-flat.codegen.js +2 -2
- package/dist/es2019/presets/all.codegen.js +2 -2
- package/dist/es2019/presets/recommended-flat.codegen.js +1 -2
- package/dist/es2019/presets/recommended.codegen.js +1 -2
- package/dist/es2019/rules/expand-motion-shorthand/index.js +243 -0
- package/dist/es2019/rules/index.codegen.js +3 -3
- package/dist/esm/presets/all-flat.codegen.js +2 -2
- package/dist/esm/presets/all.codegen.js +2 -2
- package/dist/esm/presets/recommended-flat.codegen.js +1 -2
- package/dist/esm/presets/recommended.codegen.js +1 -2
- package/dist/esm/rules/expand-motion-shorthand/index.js +279 -0
- package/dist/esm/rules/index.codegen.js +3 -3
- package/dist/types/presets/all-flat.codegen.d.ts +1 -1
- package/dist/types/presets/all.codegen.d.ts +1 -1
- package/dist/types/presets/recommended-flat.codegen.d.ts +1 -1
- package/dist/types/presets/recommended.codegen.d.ts +1 -1
- package/dist/types/rules/expand-motion-shorthand/index.d.ts +3 -0
- package/dist/types/rules/index.codegen.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/rules/no-boolean-autofocus-on-modal-dialog/index.js +0 -82
- package/dist/es2019/rules/no-boolean-autofocus-on-modal-dialog/index.js +0 -76
- package/dist/esm/rules/no-boolean-autofocus-on-modal-dialog/index.js +0 -76
- package/dist/types/rules/no-boolean-autofocus-on-modal-dialog/index.d.ts +0 -5
|
@@ -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::2e8702ed4d2cd2902fed7fc5a895ea6e>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { ESLint } from 'eslint';
|
|
@@ -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::753093c364736633c291ea7cd16fbb92>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { Linter } from 'eslint';
|
|
@@ -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::7cae0a4365766a3c1b06c8ab29cc7711>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { ESLint } from 'eslint';
|
|
@@ -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::56038bd879a1d1c73de3addd961ade97>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { Rule } from 'eslint';
|
package/package.json
CHANGED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ruleName = exports.message = exports.default = void 0;
|
|
7
|
-
var _eslintCodemodUtils = require("eslint-codemod-utils");
|
|
8
|
-
var _jsxAttribute = require("../../ast-nodes/jsx-attribute");
|
|
9
|
-
var _jsxElementHelper = require("../../ast-nodes/jsx-element-helper");
|
|
10
|
-
var _createLintRule = require("../utils/create-lint-rule");
|
|
11
|
-
var PROP_NAME = 'autoFocus';
|
|
12
|
-
|
|
13
|
-
// Lint rule message
|
|
14
|
-
var message = exports.message = "`autoFocus` should be set to a component's `ref` or left to resolve to the default value of `true`. It is recommended to leave it as is for a maximally accessible experience.";
|
|
15
|
-
var ruleName = exports.ruleName = __dirname.split('/').slice(-1)[0];
|
|
16
|
-
var rule = (0, _createLintRule.createLintRule)({
|
|
17
|
-
meta: {
|
|
18
|
-
name: ruleName,
|
|
19
|
-
type: 'problem',
|
|
20
|
-
docs: {
|
|
21
|
-
description: "Encourages makers to not use boolean values for `autoFocus` on Atlassian Design System's modal dialog component.",
|
|
22
|
-
recommended: true,
|
|
23
|
-
severity: 'warn'
|
|
24
|
-
},
|
|
25
|
-
messages: {
|
|
26
|
-
noBooleanForAutoFocus: message
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
create: function create(context) {
|
|
30
|
-
// List of component's locally imported names that match
|
|
31
|
-
var defaultImportLocalName;
|
|
32
|
-
return {
|
|
33
|
-
// Only run rule in files where the package is imported
|
|
34
|
-
ImportDeclaration: function ImportDeclaration(node) {
|
|
35
|
-
// Ignore non-modal imports
|
|
36
|
-
if (node.source.value !== '@atlaskit/modal-dialog') {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
node.specifiers.filter(function (identifier) {
|
|
40
|
-
return (0, _eslintCodemodUtils.isNodeOfType)(identifier, 'ImportDefaultSpecifier');
|
|
41
|
-
}).forEach(function (identifier) {
|
|
42
|
-
defaultImportLocalName = identifier.local.name;
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
JSXElement: function JSXElement(node) {
|
|
46
|
-
if (!(0, _eslintCodemodUtils.isNodeOfType)(node, 'JSXElement')) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (!(0, _eslintCodemodUtils.isNodeOfType)(node.openingElement.name, 'JSXIdentifier')) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
var name = node.openingElement.name.name;
|
|
53
|
-
if (name !== defaultImportLocalName) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
var prop = _jsxElementHelper.JSXElementHelper.getAttributeByName(node, PROP_NAME);
|
|
57
|
-
|
|
58
|
-
// if no autoFocus attribute exists, skip
|
|
59
|
-
if (!prop) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
var attrValue = _jsxAttribute.JSXAttribute.getValue(prop);
|
|
63
|
-
if (!attrValue) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
var type = attrValue.type,
|
|
67
|
-
value = attrValue.value;
|
|
68
|
-
|
|
69
|
-
// If the value is a boolean with value `false`
|
|
70
|
-
if (type === 'ExpressionStatement Literal' && typeof value === 'boolean') {
|
|
71
|
-
return context.report({
|
|
72
|
-
node: node,
|
|
73
|
-
messageId: 'noBooleanForAutoFocus'
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
82
|
-
var _default = exports.default = rule;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
-
import { JSXAttribute } from '../../ast-nodes/jsx-attribute';
|
|
3
|
-
import { JSXElementHelper } from '../../ast-nodes/jsx-element-helper';
|
|
4
|
-
import { createLintRule } from '../utils/create-lint-rule';
|
|
5
|
-
const PROP_NAME = 'autoFocus';
|
|
6
|
-
|
|
7
|
-
// Lint rule message
|
|
8
|
-
export const message = "`autoFocus` should be set to a component's `ref` or left to resolve to the default value of `true`. It is recommended to leave it as is for a maximally accessible experience.";
|
|
9
|
-
export const ruleName = __dirname.split('/').slice(-1)[0];
|
|
10
|
-
const rule = createLintRule({
|
|
11
|
-
meta: {
|
|
12
|
-
name: ruleName,
|
|
13
|
-
type: 'problem',
|
|
14
|
-
docs: {
|
|
15
|
-
description: "Encourages makers to not use boolean values for `autoFocus` on Atlassian Design System's modal dialog component.",
|
|
16
|
-
recommended: true,
|
|
17
|
-
severity: 'warn'
|
|
18
|
-
},
|
|
19
|
-
messages: {
|
|
20
|
-
noBooleanForAutoFocus: message
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
create(context) {
|
|
24
|
-
// List of component's locally imported names that match
|
|
25
|
-
let defaultImportLocalName;
|
|
26
|
-
return {
|
|
27
|
-
// Only run rule in files where the package is imported
|
|
28
|
-
ImportDeclaration(node) {
|
|
29
|
-
// Ignore non-modal imports
|
|
30
|
-
if (node.source.value !== '@atlaskit/modal-dialog') {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
node.specifiers.filter(identifier => isNodeOfType(identifier, 'ImportDefaultSpecifier')).forEach(identifier => {
|
|
34
|
-
defaultImportLocalName = identifier.local.name;
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
JSXElement(node) {
|
|
38
|
-
if (!isNodeOfType(node, 'JSXElement')) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (!isNodeOfType(node.openingElement.name, 'JSXIdentifier')) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
const name = node.openingElement.name.name;
|
|
45
|
-
if (name !== defaultImportLocalName) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
const prop = JSXElementHelper.getAttributeByName(node, PROP_NAME);
|
|
49
|
-
|
|
50
|
-
// if no autoFocus attribute exists, skip
|
|
51
|
-
if (!prop) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const attrValue = JSXAttribute.getValue(prop);
|
|
55
|
-
if (!attrValue) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const {
|
|
59
|
-
type,
|
|
60
|
-
value
|
|
61
|
-
} = attrValue;
|
|
62
|
-
|
|
63
|
-
// If the value is a boolean with value `false`
|
|
64
|
-
if (type === 'ExpressionStatement Literal' && typeof value === 'boolean') {
|
|
65
|
-
return context.report({
|
|
66
|
-
node,
|
|
67
|
-
messageId: 'noBooleanForAutoFocus'
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
76
|
-
export default rule;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { isNodeOfType } from 'eslint-codemod-utils';
|
|
2
|
-
import { JSXAttribute } from '../../ast-nodes/jsx-attribute';
|
|
3
|
-
import { JSXElementHelper } from '../../ast-nodes/jsx-element-helper';
|
|
4
|
-
import { createLintRule } from '../utils/create-lint-rule';
|
|
5
|
-
var PROP_NAME = 'autoFocus';
|
|
6
|
-
|
|
7
|
-
// Lint rule message
|
|
8
|
-
export var message = "`autoFocus` should be set to a component's `ref` or left to resolve to the default value of `true`. It is recommended to leave it as is for a maximally accessible experience.";
|
|
9
|
-
export var ruleName = __dirname.split('/').slice(-1)[0];
|
|
10
|
-
var rule = createLintRule({
|
|
11
|
-
meta: {
|
|
12
|
-
name: ruleName,
|
|
13
|
-
type: 'problem',
|
|
14
|
-
docs: {
|
|
15
|
-
description: "Encourages makers to not use boolean values for `autoFocus` on Atlassian Design System's modal dialog component.",
|
|
16
|
-
recommended: true,
|
|
17
|
-
severity: 'warn'
|
|
18
|
-
},
|
|
19
|
-
messages: {
|
|
20
|
-
noBooleanForAutoFocus: message
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
create: function create(context) {
|
|
24
|
-
// List of component's locally imported names that match
|
|
25
|
-
var defaultImportLocalName;
|
|
26
|
-
return {
|
|
27
|
-
// Only run rule in files where the package is imported
|
|
28
|
-
ImportDeclaration: function ImportDeclaration(node) {
|
|
29
|
-
// Ignore non-modal imports
|
|
30
|
-
if (node.source.value !== '@atlaskit/modal-dialog') {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
node.specifiers.filter(function (identifier) {
|
|
34
|
-
return isNodeOfType(identifier, 'ImportDefaultSpecifier');
|
|
35
|
-
}).forEach(function (identifier) {
|
|
36
|
-
defaultImportLocalName = identifier.local.name;
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
JSXElement: function JSXElement(node) {
|
|
40
|
-
if (!isNodeOfType(node, 'JSXElement')) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (!isNodeOfType(node.openingElement.name, 'JSXIdentifier')) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
var name = node.openingElement.name.name;
|
|
47
|
-
if (name !== defaultImportLocalName) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
var prop = JSXElementHelper.getAttributeByName(node, PROP_NAME);
|
|
51
|
-
|
|
52
|
-
// if no autoFocus attribute exists, skip
|
|
53
|
-
if (!prop) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
var attrValue = JSXAttribute.getValue(prop);
|
|
57
|
-
if (!attrValue) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
var type = attrValue.type,
|
|
61
|
-
value = attrValue.value;
|
|
62
|
-
|
|
63
|
-
// If the value is a boolean with value `false`
|
|
64
|
-
if (type === 'ExpressionStatement Literal' && typeof value === 'boolean') {
|
|
65
|
-
return context.report({
|
|
66
|
-
node: node,
|
|
67
|
-
messageId: 'noBooleanForAutoFocus'
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
76
|
-
export default rule;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Rule } from 'eslint';
|
|
2
|
-
export declare const message = "`autoFocus` should be set to a component's `ref` or left to resolve to the default value of `true`. It is recommended to leave it as is for a maximally accessible experience.";
|
|
3
|
-
export declare const ruleName: string;
|
|
4
|
-
declare const rule: Rule.RuleModule;
|
|
5
|
-
export default rule;
|