@atlaskit/eslint-plugin-design-system 8.25.1 → 8.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +4 -0
- package/constellation/index/usage.mdx +362 -0
- package/dist/cjs/ast-nodes/object.js +8 -1
- package/dist/cjs/presets/all.codegen.js +5 -1
- package/dist/cjs/presets/recommended.codegen.js +5 -1
- package/dist/cjs/rules/index.codegen.js +9 -1
- package/dist/cjs/rules/no-empty-styled-expression/index.js +75 -0
- package/dist/cjs/rules/no-exported-css/index.js +37 -0
- package/dist/cjs/rules/no-exported-keyframes/index.js +37 -0
- package/dist/cjs/rules/no-invalid-css-map/index.js +102 -0
- package/dist/cjs/rules/no-invalid-css-map/utils.js +193 -0
- package/dist/cjs/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +5 -0
- package/dist/cjs/rules/utils/create-no-exported-rule/check-if-supported-export.js +158 -0
- package/dist/cjs/rules/utils/create-no-exported-rule/is-styled-component.js +84 -0
- package/dist/cjs/rules/utils/create-no-exported-rule/main.js +66 -0
- package/dist/cjs/rules/utils/is-supported-import.js +51 -15
- package/dist/es2019/ast-nodes/object.js +8 -1
- package/dist/es2019/presets/all.codegen.js +5 -1
- package/dist/es2019/presets/recommended.codegen.js +5 -1
- package/dist/es2019/rules/index.codegen.js +9 -1
- package/dist/es2019/rules/no-empty-styled-expression/index.js +65 -0
- package/dist/es2019/rules/no-exported-css/index.js +31 -0
- package/dist/es2019/rules/no-exported-keyframes/index.js +31 -0
- package/dist/es2019/rules/no-invalid-css-map/index.js +95 -0
- package/dist/es2019/rules/no-invalid-css-map/utils.js +134 -0
- package/dist/es2019/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +5 -0
- package/dist/es2019/rules/utils/create-no-exported-rule/check-if-supported-export.js +142 -0
- package/dist/es2019/rules/utils/create-no-exported-rule/is-styled-component.js +74 -0
- package/dist/es2019/rules/utils/create-no-exported-rule/main.js +59 -0
- package/dist/es2019/rules/utils/is-supported-import.js +48 -14
- package/dist/esm/ast-nodes/object.js +8 -1
- package/dist/esm/presets/all.codegen.js +5 -1
- package/dist/esm/presets/recommended.codegen.js +5 -1
- package/dist/esm/rules/index.codegen.js +9 -1
- package/dist/esm/rules/no-empty-styled-expression/index.js +68 -0
- package/dist/esm/rules/no-exported-css/index.js +31 -0
- package/dist/esm/rules/no-exported-keyframes/index.js +31 -0
- package/dist/esm/rules/no-invalid-css-map/index.js +96 -0
- package/dist/esm/rules/no-invalid-css-map/utils.js +186 -0
- package/dist/esm/rules/use-primitives/utils/is-valid-css-properties-to-transform.js +5 -0
- package/dist/esm/rules/utils/create-no-exported-rule/check-if-supported-export.js +151 -0
- package/dist/esm/rules/utils/create-no-exported-rule/is-styled-component.js +78 -0
- package/dist/esm/rules/utils/create-no-exported-rule/main.js +60 -0
- package/dist/esm/rules/utils/is-supported-import.js +49 -14
- package/dist/types/ast-nodes/object.d.ts +7 -2
- package/dist/types/index.codegen.d.ts +8 -0
- package/dist/types/presets/all.codegen.d.ts +5 -1
- package/dist/types/presets/recommended.codegen.d.ts +5 -1
- package/dist/types/rules/index.codegen.d.ts +4 -0
- package/dist/types/rules/no-empty-styled-expression/index.d.ts +3 -0
- package/dist/types/rules/no-exported-css/index.d.ts +3 -0
- package/dist/types/rules/no-exported-keyframes/index.d.ts +3 -0
- package/dist/types/rules/no-invalid-css-map/index.d.ts +3 -0
- package/dist/types/rules/no-invalid-css-map/utils.d.ts +14 -0
- package/dist/types/rules/utils/create-no-exported-rule/check-if-supported-export.d.ts +15 -0
- package/dist/types/rules/utils/create-no-exported-rule/is-styled-component.d.ts +14 -0
- package/dist/types/rules/utils/create-no-exported-rule/main.d.ts +19 -0
- package/dist/types/rules/utils/create-rule.d.ts +1 -1
- package/dist/types/rules/utils/is-supported-import.d.ts +25 -8
- package/dist/types-ts4.5/ast-nodes/object.d.ts +7 -2
- package/dist/types-ts4.5/index.codegen.d.ts +8 -0
- package/dist/types-ts4.5/presets/all.codegen.d.ts +5 -1
- package/dist/types-ts4.5/presets/recommended.codegen.d.ts +5 -1
- package/dist/types-ts4.5/rules/index.codegen.d.ts +4 -0
- package/dist/types-ts4.5/rules/no-empty-styled-expression/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/no-exported-css/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/no-exported-keyframes/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/no-invalid-css-map/index.d.ts +3 -0
- package/dist/types-ts4.5/rules/no-invalid-css-map/utils.d.ts +14 -0
- package/dist/types-ts4.5/rules/utils/create-no-exported-rule/check-if-supported-export.d.ts +15 -0
- package/dist/types-ts4.5/rules/utils/create-no-exported-rule/is-styled-component.d.ts +14 -0
- package/dist/types-ts4.5/rules/utils/create-no-exported-rule/main.d.ts +19 -0
- package/dist/types-ts4.5/rules/utils/create-rule.d.ts +1 -1
- package/dist/types-ts4.5/rules/utils/is-supported-import.d.ts +25 -8
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { ObjectExpression, Property } from 'eslint-codemod-utils';
|
|
2
|
+
import { ObjectExpression, Property, SpreadElement } from 'eslint-codemod-utils';
|
|
3
3
|
declare const ASTObjectExpression: {
|
|
4
4
|
/**
|
|
5
5
|
* Returns `true` if an object contains a property with the specified name, `false` otherwise.
|
|
@@ -19,9 +19,14 @@ declare const ASTObjectExpression: {
|
|
|
19
19
|
getEntryByPropertyName(node: ObjectExpression, name: string): Property | undefined;
|
|
20
20
|
deleteEntry(node: ObjectExpression, name: string, fixer: Rule.RuleFixer): Rule.Fix[];
|
|
21
21
|
/**
|
|
22
|
-
* Returns
|
|
22
|
+
* Returns only the property @type {Property['key']} like: `padding` from: `{ padding: '8px' }`.
|
|
23
|
+
* If you want the key/value pair, use `getEntryByPropertyName`.
|
|
23
24
|
*/
|
|
24
25
|
getProperty(node: ObjectExpression, name: string): Property['key'] | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Gets the array of key/value pairs in an ObjectExpression.
|
|
28
|
+
*/
|
|
29
|
+
getEntries(node: ObjectExpression): (Property | SpreadElement)[];
|
|
25
30
|
/**
|
|
26
31
|
* Returns a only the property @type {Property['value']} like: `'8px` from: `{ padding: '8px' }`.
|
|
27
32
|
*
|
|
@@ -13,6 +13,10 @@ export declare const configs: {
|
|
|
13
13
|
'@atlaskit/design-system/no-deprecated-apis': string;
|
|
14
14
|
'@atlaskit/design-system/no-deprecated-design-token-usage': string;
|
|
15
15
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
16
|
+
'@atlaskit/design-system/no-empty-styled-expression': string;
|
|
17
|
+
'@atlaskit/design-system/no-exported-css': string;
|
|
18
|
+
'@atlaskit/design-system/no-exported-keyframes': string;
|
|
19
|
+
'@atlaskit/design-system/no-invalid-css-map': string;
|
|
16
20
|
'@atlaskit/design-system/no-margin': string;
|
|
17
21
|
'@atlaskit/design-system/no-nested-styles': string;
|
|
18
22
|
'@atlaskit/design-system/no-physical-properties': string;
|
|
@@ -39,6 +43,10 @@ export declare const configs: {
|
|
|
39
43
|
'@atlaskit/design-system/no-deprecated-apis': string;
|
|
40
44
|
'@atlaskit/design-system/no-deprecated-design-token-usage': string;
|
|
41
45
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
46
|
+
'@atlaskit/design-system/no-empty-styled-expression': string;
|
|
47
|
+
'@atlaskit/design-system/no-exported-css': string;
|
|
48
|
+
'@atlaskit/design-system/no-exported-keyframes': string;
|
|
49
|
+
'@atlaskit/design-system/no-invalid-css-map': string;
|
|
42
50
|
'@atlaskit/design-system/no-nested-styles': string;
|
|
43
51
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
44
52
|
'@atlaskit/design-system/no-unsafe-style-overrides': string;
|
|
@@ -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::914085544778f4543f43e3e30d0982e0>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -16,6 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'@atlaskit/design-system/no-deprecated-apis': string;
|
|
17
17
|
'@atlaskit/design-system/no-deprecated-design-token-usage': string;
|
|
18
18
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
19
|
+
'@atlaskit/design-system/no-empty-styled-expression': string;
|
|
20
|
+
'@atlaskit/design-system/no-exported-css': string;
|
|
21
|
+
'@atlaskit/design-system/no-exported-keyframes': string;
|
|
22
|
+
'@atlaskit/design-system/no-invalid-css-map': string;
|
|
19
23
|
'@atlaskit/design-system/no-margin': string;
|
|
20
24
|
'@atlaskit/design-system/no-nested-styles': string;
|
|
21
25
|
'@atlaskit/design-system/no-physical-properties': string;
|
|
@@ -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::577269c832952ce359cde6a50f26f4e0>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -14,6 +14,10 @@ declare const _default: {
|
|
|
14
14
|
'@atlaskit/design-system/no-deprecated-apis': string;
|
|
15
15
|
'@atlaskit/design-system/no-deprecated-design-token-usage': string;
|
|
16
16
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
17
|
+
'@atlaskit/design-system/no-empty-styled-expression': string;
|
|
18
|
+
'@atlaskit/design-system/no-exported-css': string;
|
|
19
|
+
'@atlaskit/design-system/no-exported-keyframes': string;
|
|
20
|
+
'@atlaskit/design-system/no-invalid-css-map': string;
|
|
17
21
|
'@atlaskit/design-system/no-nested-styles': string;
|
|
18
22
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
19
23
|
'@atlaskit/design-system/no-unsafe-style-overrides': string;
|
|
@@ -13,6 +13,10 @@ declare const _default: {
|
|
|
13
13
|
'no-deprecated-imports': import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<string, [{
|
|
14
14
|
deprecatedConfig: import("./utils/types").DeprecatedConfig;
|
|
15
15
|
}], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
16
|
+
'no-empty-styled-expression': import("eslint").Rule.RuleModule;
|
|
17
|
+
'no-exported-css': import("eslint").Rule.RuleModule;
|
|
18
|
+
'no-exported-keyframes': import("eslint").Rule.RuleModule;
|
|
19
|
+
'no-invalid-css-map': import("eslint").Rule.RuleModule;
|
|
16
20
|
'no-margin': import("eslint").Rule.RuleModule;
|
|
17
21
|
'no-nested-styles': import("eslint").Rule.RuleModule;
|
|
18
22
|
'no-physical-properties': import("eslint").Rule.RuleModule;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import type { CallExpression, ObjectExpression } from 'estree';
|
|
3
|
+
export declare const getCssMapObject: (node: CallExpression) => ObjectExpression | undefined;
|
|
4
|
+
export declare class CssMapObjectChecker {
|
|
5
|
+
private readonly allowedFunctionCalls;
|
|
6
|
+
private readonly cssMapObject;
|
|
7
|
+
private readonly report;
|
|
8
|
+
private readonly references;
|
|
9
|
+
constructor(cssMapObject: ObjectExpression, context: Rule.RuleContext);
|
|
10
|
+
private isNotWhitelistedFunction;
|
|
11
|
+
private checkCssMapObjectValue;
|
|
12
|
+
private checkCssMapObject;
|
|
13
|
+
run(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Rule, Scope as ScopeNamespace } from 'eslint';
|
|
2
|
+
import { ImportSource } from '../is-supported-import';
|
|
3
|
+
type Node = Rule.Node;
|
|
4
|
+
type RuleContext = Rule.RuleContext;
|
|
5
|
+
type Scope = ScopeNamespace.Scope;
|
|
6
|
+
type Yes = {
|
|
7
|
+
isExport: true;
|
|
8
|
+
node: Node;
|
|
9
|
+
};
|
|
10
|
+
type No = {
|
|
11
|
+
isExport: false;
|
|
12
|
+
};
|
|
13
|
+
type IsSupportedExport = Yes | No;
|
|
14
|
+
export declare const checkIfSupportedExport: (context: RuleContext, node: Node, importSources: ImportSource[], scope?: Scope) => IsSupportedExport;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import type { ImportSource } from '../is-supported-import';
|
|
3
|
+
type Node = Rule.Node;
|
|
4
|
+
type RuleContext = Rule.RuleContext;
|
|
5
|
+
/**
|
|
6
|
+
* Returns whether the node is a usage of the `styled` API in the libraries we support.
|
|
7
|
+
*
|
|
8
|
+
* @param nodes Nodes to check.
|
|
9
|
+
* @param context Rule context.
|
|
10
|
+
* @param importSources A list of libraries we support.
|
|
11
|
+
* @returns Whether the node is a usage of the `styled` API.
|
|
12
|
+
*/
|
|
13
|
+
export declare const isStyledComponent: (nodes: Node[], context: RuleContext, importSources: ImportSource[]) => boolean;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import { type SupportedNameChecker } from '../is-supported-import';
|
|
3
|
+
type RuleModule = Rule.RuleModule;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a new ESLint rule for banning exporting certain function calls, e.g.
|
|
6
|
+
* `css` and `keyframes`.
|
|
7
|
+
*
|
|
8
|
+
* Copied from the `utils/create-no-exported-rule/` folder in @compiled/eslint-plugin.
|
|
9
|
+
*
|
|
10
|
+
* Requires an importSources option defined on the rule, which is used to define additional
|
|
11
|
+
* packages which should be checked as part of this rule.
|
|
12
|
+
*
|
|
13
|
+
* @param isUsage A function that checks whether the current node matches the desired
|
|
14
|
+
* function call to check.
|
|
15
|
+
* @param messageId The ESLint error message to use for lint violations.
|
|
16
|
+
* @returns An eslint rule.
|
|
17
|
+
*/
|
|
18
|
+
export declare const createNoExportedRule: (isUsage: SupportedNameChecker, messageId: string) => RuleModule['create'];
|
|
19
|
+
export {};
|
|
@@ -30,7 +30,7 @@ export interface LintRuleMeta extends Omit<Rule.RuleMetaData, 'docs'> {
|
|
|
30
30
|
*/
|
|
31
31
|
description: string;
|
|
32
32
|
/**
|
|
33
|
-
* Specifies the URL at which the full documentation can be accessed
|
|
33
|
+
* Specifies the URL at which the full documentation can be accessed.
|
|
34
34
|
*/
|
|
35
35
|
url?: string | undefined;
|
|
36
36
|
/**
|
|
@@ -1,16 +1,33 @@
|
|
|
1
|
-
import type { Scope } from 'eslint';
|
|
1
|
+
import type { Rule, Scope } from 'eslint';
|
|
2
2
|
import type { CallExpression } from 'estree';
|
|
3
3
|
type Callee = CallExpression['callee'];
|
|
4
4
|
type Reference = Scope.Reference;
|
|
5
5
|
export declare const CSS_IN_JS_IMPORTS: {
|
|
6
|
-
compiled:
|
|
7
|
-
emotionReact:
|
|
8
|
-
emotionCore:
|
|
9
|
-
styledComponents:
|
|
10
|
-
atlaskitCss:
|
|
6
|
+
readonly compiled: "@compiled/react";
|
|
7
|
+
readonly emotionReact: "@emotion/react";
|
|
8
|
+
readonly emotionCore: "@emotion/core";
|
|
9
|
+
readonly styledComponents: "styled-components";
|
|
10
|
+
readonly atlaskitCss: "@atlaskit/css";
|
|
11
11
|
};
|
|
12
|
-
type
|
|
13
|
-
export type SupportedNameChecker = (nodeToCheck: Callee, referencesInScope: Reference[], importSources:
|
|
12
|
+
export type ImportSource = string;
|
|
13
|
+
export type SupportedNameChecker = (nodeToCheck: Callee, referencesInScope: Reference[], importSources: ImportSource[]) => boolean;
|
|
14
|
+
export declare const DEFAULT_IMPORT_SOURCES: ImportSource[];
|
|
15
|
+
/**
|
|
16
|
+
* Given the ESLint rule context, extract and parse the value of the importSources rule option.
|
|
17
|
+
* The importSources option is used to define additional libraries for which an ESLint rule
|
|
18
|
+
* should apply to.
|
|
19
|
+
*
|
|
20
|
+
* Note that `@compiled/react` and `@atlaskit/css` are always included in importSources, regardless
|
|
21
|
+
* of what importSources is configured to by the user.
|
|
22
|
+
*
|
|
23
|
+
* @param context The rule context.
|
|
24
|
+
* @returns An array of strings representing what CSS-in-JS packages that should be checked, based
|
|
25
|
+
* on the rule options configuration.
|
|
26
|
+
*/
|
|
27
|
+
export declare const getImportSources: (context: Rule.RuleContext) => ImportSource[];
|
|
14
28
|
export declare const isCss: SupportedNameChecker;
|
|
15
29
|
export declare const isCxFunction: SupportedNameChecker;
|
|
30
|
+
export declare const isCssMap: SupportedNameChecker;
|
|
31
|
+
export declare const isKeyframes: SupportedNameChecker;
|
|
32
|
+
export declare const isStyled: SupportedNameChecker;
|
|
16
33
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule } from 'eslint';
|
|
2
|
-
import { ObjectExpression, Property } from 'eslint-codemod-utils';
|
|
2
|
+
import { ObjectExpression, Property, SpreadElement } from 'eslint-codemod-utils';
|
|
3
3
|
declare const ASTObjectExpression: {
|
|
4
4
|
/**
|
|
5
5
|
* Returns `true` if an object contains a property with the specified name, `false` otherwise.
|
|
@@ -19,9 +19,14 @@ declare const ASTObjectExpression: {
|
|
|
19
19
|
getEntryByPropertyName(node: ObjectExpression, name: string): Property | undefined;
|
|
20
20
|
deleteEntry(node: ObjectExpression, name: string, fixer: Rule.RuleFixer): Rule.Fix[];
|
|
21
21
|
/**
|
|
22
|
-
* Returns
|
|
22
|
+
* Returns only the property @type {Property['key']} like: `padding` from: `{ padding: '8px' }`.
|
|
23
|
+
* If you want the key/value pair, use `getEntryByPropertyName`.
|
|
23
24
|
*/
|
|
24
25
|
getProperty(node: ObjectExpression, name: string): Property['key'] | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Gets the array of key/value pairs in an ObjectExpression.
|
|
28
|
+
*/
|
|
29
|
+
getEntries(node: ObjectExpression): (Property | SpreadElement)[];
|
|
25
30
|
/**
|
|
26
31
|
* Returns a only the property @type {Property['value']} like: `'8px` from: `{ padding: '8px' }`.
|
|
27
32
|
*
|
|
@@ -13,6 +13,10 @@ export declare const configs: {
|
|
|
13
13
|
'@atlaskit/design-system/no-deprecated-apis': string;
|
|
14
14
|
'@atlaskit/design-system/no-deprecated-design-token-usage': string;
|
|
15
15
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
16
|
+
'@atlaskit/design-system/no-empty-styled-expression': string;
|
|
17
|
+
'@atlaskit/design-system/no-exported-css': string;
|
|
18
|
+
'@atlaskit/design-system/no-exported-keyframes': string;
|
|
19
|
+
'@atlaskit/design-system/no-invalid-css-map': string;
|
|
16
20
|
'@atlaskit/design-system/no-margin': string;
|
|
17
21
|
'@atlaskit/design-system/no-nested-styles': string;
|
|
18
22
|
'@atlaskit/design-system/no-physical-properties': string;
|
|
@@ -39,6 +43,10 @@ export declare const configs: {
|
|
|
39
43
|
'@atlaskit/design-system/no-deprecated-apis': string;
|
|
40
44
|
'@atlaskit/design-system/no-deprecated-design-token-usage': string;
|
|
41
45
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
46
|
+
'@atlaskit/design-system/no-empty-styled-expression': string;
|
|
47
|
+
'@atlaskit/design-system/no-exported-css': string;
|
|
48
|
+
'@atlaskit/design-system/no-exported-keyframes': string;
|
|
49
|
+
'@atlaskit/design-system/no-invalid-css-map': string;
|
|
42
50
|
'@atlaskit/design-system/no-nested-styles': string;
|
|
43
51
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
44
52
|
'@atlaskit/design-system/no-unsafe-style-overrides': string;
|
|
@@ -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::914085544778f4543f43e3e30d0982e0>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -16,6 +16,10 @@ declare const _default: {
|
|
|
16
16
|
'@atlaskit/design-system/no-deprecated-apis': string;
|
|
17
17
|
'@atlaskit/design-system/no-deprecated-design-token-usage': string;
|
|
18
18
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
19
|
+
'@atlaskit/design-system/no-empty-styled-expression': string;
|
|
20
|
+
'@atlaskit/design-system/no-exported-css': string;
|
|
21
|
+
'@atlaskit/design-system/no-exported-keyframes': string;
|
|
22
|
+
'@atlaskit/design-system/no-invalid-css-map': string;
|
|
19
23
|
'@atlaskit/design-system/no-margin': string;
|
|
20
24
|
'@atlaskit/design-system/no-nested-styles': string;
|
|
21
25
|
'@atlaskit/design-system/no-physical-properties': string;
|
|
@@ -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::577269c832952ce359cde6a50f26f4e0>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-design-system codegen
|
|
5
5
|
*/
|
|
6
6
|
declare const _default: {
|
|
@@ -14,6 +14,10 @@ declare const _default: {
|
|
|
14
14
|
'@atlaskit/design-system/no-deprecated-apis': string;
|
|
15
15
|
'@atlaskit/design-system/no-deprecated-design-token-usage': string;
|
|
16
16
|
'@atlaskit/design-system/no-deprecated-imports': string;
|
|
17
|
+
'@atlaskit/design-system/no-empty-styled-expression': string;
|
|
18
|
+
'@atlaskit/design-system/no-exported-css': string;
|
|
19
|
+
'@atlaskit/design-system/no-exported-keyframes': string;
|
|
20
|
+
'@atlaskit/design-system/no-invalid-css-map': string;
|
|
17
21
|
'@atlaskit/design-system/no-nested-styles': string;
|
|
18
22
|
'@atlaskit/design-system/no-unsafe-design-token-usage': string;
|
|
19
23
|
'@atlaskit/design-system/no-unsafe-style-overrides': string;
|
|
@@ -17,6 +17,10 @@ declare const _default: {
|
|
|
17
17
|
deprecatedConfig: import("./utils/types").DeprecatedConfig;
|
|
18
18
|
}
|
|
19
19
|
], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
20
|
+
'no-empty-styled-expression': import("eslint").Rule.RuleModule;
|
|
21
|
+
'no-exported-css': import("eslint").Rule.RuleModule;
|
|
22
|
+
'no-exported-keyframes': import("eslint").Rule.RuleModule;
|
|
23
|
+
'no-invalid-css-map': import("eslint").Rule.RuleModule;
|
|
20
24
|
'no-margin': import("eslint").Rule.RuleModule;
|
|
21
25
|
'no-nested-styles': import("eslint").Rule.RuleModule;
|
|
22
26
|
'no-physical-properties': import("eslint").Rule.RuleModule;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import type { CallExpression, ObjectExpression } from 'estree';
|
|
3
|
+
export declare const getCssMapObject: (node: CallExpression) => ObjectExpression | undefined;
|
|
4
|
+
export declare class CssMapObjectChecker {
|
|
5
|
+
private readonly allowedFunctionCalls;
|
|
6
|
+
private readonly cssMapObject;
|
|
7
|
+
private readonly report;
|
|
8
|
+
private readonly references;
|
|
9
|
+
constructor(cssMapObject: ObjectExpression, context: Rule.RuleContext);
|
|
10
|
+
private isNotWhitelistedFunction;
|
|
11
|
+
private checkCssMapObjectValue;
|
|
12
|
+
private checkCssMapObject;
|
|
13
|
+
run(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Rule, Scope as ScopeNamespace } from 'eslint';
|
|
2
|
+
import { ImportSource } from '../is-supported-import';
|
|
3
|
+
type Node = Rule.Node;
|
|
4
|
+
type RuleContext = Rule.RuleContext;
|
|
5
|
+
type Scope = ScopeNamespace.Scope;
|
|
6
|
+
type Yes = {
|
|
7
|
+
isExport: true;
|
|
8
|
+
node: Node;
|
|
9
|
+
};
|
|
10
|
+
type No = {
|
|
11
|
+
isExport: false;
|
|
12
|
+
};
|
|
13
|
+
type IsSupportedExport = Yes | No;
|
|
14
|
+
export declare const checkIfSupportedExport: (context: RuleContext, node: Node, importSources: ImportSource[], scope?: Scope) => IsSupportedExport;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import type { ImportSource } from '../is-supported-import';
|
|
3
|
+
type Node = Rule.Node;
|
|
4
|
+
type RuleContext = Rule.RuleContext;
|
|
5
|
+
/**
|
|
6
|
+
* Returns whether the node is a usage of the `styled` API in the libraries we support.
|
|
7
|
+
*
|
|
8
|
+
* @param nodes Nodes to check.
|
|
9
|
+
* @param context Rule context.
|
|
10
|
+
* @param importSources A list of libraries we support.
|
|
11
|
+
* @returns Whether the node is a usage of the `styled` API.
|
|
12
|
+
*/
|
|
13
|
+
export declare const isStyledComponent: (nodes: Node[], context: RuleContext, importSources: ImportSource[]) => boolean;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import { type SupportedNameChecker } from '../is-supported-import';
|
|
3
|
+
type RuleModule = Rule.RuleModule;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a new ESLint rule for banning exporting certain function calls, e.g.
|
|
6
|
+
* `css` and `keyframes`.
|
|
7
|
+
*
|
|
8
|
+
* Copied from the `utils/create-no-exported-rule/` folder in @compiled/eslint-plugin.
|
|
9
|
+
*
|
|
10
|
+
* Requires an importSources option defined on the rule, which is used to define additional
|
|
11
|
+
* packages which should be checked as part of this rule.
|
|
12
|
+
*
|
|
13
|
+
* @param isUsage A function that checks whether the current node matches the desired
|
|
14
|
+
* function call to check.
|
|
15
|
+
* @param messageId The ESLint error message to use for lint violations.
|
|
16
|
+
* @returns An eslint rule.
|
|
17
|
+
*/
|
|
18
|
+
export declare const createNoExportedRule: (isUsage: SupportedNameChecker, messageId: string) => RuleModule['create'];
|
|
19
|
+
export {};
|
|
@@ -30,7 +30,7 @@ export interface LintRuleMeta extends Omit<Rule.RuleMetaData, 'docs'> {
|
|
|
30
30
|
*/
|
|
31
31
|
description: string;
|
|
32
32
|
/**
|
|
33
|
-
* Specifies the URL at which the full documentation can be accessed
|
|
33
|
+
* Specifies the URL at which the full documentation can be accessed.
|
|
34
34
|
*/
|
|
35
35
|
url?: string | undefined;
|
|
36
36
|
/**
|
|
@@ -1,16 +1,33 @@
|
|
|
1
|
-
import type { Scope } from 'eslint';
|
|
1
|
+
import type { Rule, Scope } from 'eslint';
|
|
2
2
|
import type { CallExpression } from 'estree';
|
|
3
3
|
type Callee = CallExpression['callee'];
|
|
4
4
|
type Reference = Scope.Reference;
|
|
5
5
|
export declare const CSS_IN_JS_IMPORTS: {
|
|
6
|
-
compiled:
|
|
7
|
-
emotionReact:
|
|
8
|
-
emotionCore:
|
|
9
|
-
styledComponents:
|
|
10
|
-
atlaskitCss:
|
|
6
|
+
readonly compiled: "@compiled/react";
|
|
7
|
+
readonly emotionReact: "@emotion/react";
|
|
8
|
+
readonly emotionCore: "@emotion/core";
|
|
9
|
+
readonly styledComponents: "styled-components";
|
|
10
|
+
readonly atlaskitCss: "@atlaskit/css";
|
|
11
11
|
};
|
|
12
|
-
type
|
|
13
|
-
export type SupportedNameChecker = (nodeToCheck: Callee, referencesInScope: Reference[], importSources:
|
|
12
|
+
export type ImportSource = string;
|
|
13
|
+
export type SupportedNameChecker = (nodeToCheck: Callee, referencesInScope: Reference[], importSources: ImportSource[]) => boolean;
|
|
14
|
+
export declare const DEFAULT_IMPORT_SOURCES: ImportSource[];
|
|
15
|
+
/**
|
|
16
|
+
* Given the ESLint rule context, extract and parse the value of the importSources rule option.
|
|
17
|
+
* The importSources option is used to define additional libraries for which an ESLint rule
|
|
18
|
+
* should apply to.
|
|
19
|
+
*
|
|
20
|
+
* Note that `@compiled/react` and `@atlaskit/css` are always included in importSources, regardless
|
|
21
|
+
* of what importSources is configured to by the user.
|
|
22
|
+
*
|
|
23
|
+
* @param context The rule context.
|
|
24
|
+
* @returns An array of strings representing what CSS-in-JS packages that should be checked, based
|
|
25
|
+
* on the rule options configuration.
|
|
26
|
+
*/
|
|
27
|
+
export declare const getImportSources: (context: Rule.RuleContext) => ImportSource[];
|
|
14
28
|
export declare const isCss: SupportedNameChecker;
|
|
15
29
|
export declare const isCxFunction: SupportedNameChecker;
|
|
30
|
+
export declare const isCssMap: SupportedNameChecker;
|
|
31
|
+
export declare const isKeyframes: SupportedNameChecker;
|
|
32
|
+
export declare const isStyled: SupportedNameChecker;
|
|
16
33
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/eslint-plugin-design-system",
|
|
3
3
|
"description": "The essential plugin for use with the Atlassian Design System.",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.26.0",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"registry": "https://registry.npmjs.org/"
|