@atlaskit/eslint-plugin-ui-styling-standard 1.4.6 → 1.5.1
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 +18 -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-important-styles/index.js +95 -28
- package/dist/cjs/rules/no-unsafe-selectors/constants.js +49 -2
- package/dist/cjs/rules/no-unsafe-selectors/walk-css-map.js +10 -5
- package/dist/cjs/rules/no-unused-cssmap-properties/index.js +192 -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-important-styles/index.js +65 -13
- package/dist/es2019/rules/no-unsafe-selectors/constants.js +48 -1
- package/dist/es2019/rules/no-unsafe-selectors/walk-css-map.js +10 -5
- package/dist/es2019/rules/no-unused-cssmap-properties/index.js +182 -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-important-styles/index.js +95 -27
- package/dist/esm/rules/no-unsafe-selectors/constants.js +48 -1
- package/dist/esm/rules/no-unsafe-selectors/walk-css-map.js +10 -5
- package/dist/esm/rules/no-unused-cssmap-properties/index.js +186 -0
- 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/index.codegen.d.ts +1 -1
- package/dist/types/rules/no-array-arguments/index.d.ts +1 -1
- package/dist/types/rules/no-classname-prop/index.d.ts +1 -1
- package/dist/types/rules/no-container-queries/index.d.ts +1 -1
- package/dist/types/rules/no-dynamic-styles/index.d.ts +1 -1
- package/dist/types/rules/no-exported-styles/index.d.ts +1 -1
- package/dist/types/rules/no-global-styles/index.d.ts +1 -1
- package/dist/types/rules/no-important-styles/index.d.ts +1 -1
- package/dist/types/rules/no-nested-selectors/index.d.ts +1 -1
- package/dist/types/rules/no-styled/index.d.ts +1 -1
- package/dist/types/rules/no-unsafe-selectors/constants.d.ts +45 -0
- package/dist/types/rules/no-unsafe-values/index.d.ts +1 -1
- package/dist/types/rules/no-unused-cssmap-properties/index.d.ts +3 -0
- package/dist/types-ts4.5/presets/all-flat.codegen.d.ts +1 -1
- package/dist/types-ts4.5/presets/all.codegen.d.ts +1 -1
- package/dist/types-ts4.5/presets/recommended-flat.codegen.d.ts +1 -1
- package/dist/types-ts4.5/presets/recommended.codegen.d.ts +1 -1
- package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -1
- package/dist/types-ts4.5/rules/no-array-arguments/index.d.ts +1 -1
- package/dist/types-ts4.5/rules/no-classname-prop/index.d.ts +1 -1
- package/dist/types-ts4.5/rules/no-container-queries/index.d.ts +1 -1
- package/dist/types-ts4.5/rules/no-dynamic-styles/index.d.ts +1 -1
- package/dist/types-ts4.5/rules/no-exported-styles/index.d.ts +1 -1
- package/dist/types-ts4.5/rules/no-global-styles/index.d.ts +1 -1
- package/dist/types-ts4.5/rules/no-important-styles/index.d.ts +1 -1
- package/dist/types-ts4.5/rules/no-nested-selectors/index.d.ts +1 -1
- package/dist/types-ts4.5/rules/no-styled/index.d.ts +1 -1
- package/dist/types-ts4.5/rules/no-unsafe-selectors/constants.d.ts +45 -0
- package/dist/types-ts4.5/rules/no-unsafe-values/index.d.ts +1 -1
- package/dist/types-ts4.5/rules/no-unused-cssmap-properties/index.d.ts +3 -0
- package/package.json +2 -2
|
@@ -6,6 +6,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
9
|
+
import { allowedGroupedAtRules } from './constants';
|
|
9
10
|
export function walkCssMap(_ref) {
|
|
10
11
|
var context = _ref.context,
|
|
11
12
|
importSources = _ref.importSources,
|
|
@@ -103,11 +104,15 @@ function walkCssMapAtRuleGrouping(_ref4) {
|
|
|
103
104
|
if (!atRule) {
|
|
104
105
|
return;
|
|
105
106
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
|
|
108
|
+
// Skip reporting if the at-rule is allowed to be grouped
|
|
109
|
+
if (!allowedGroupedAtRules.has(atRule)) {
|
|
110
|
+
visitor({
|
|
111
|
+
type: 'grouped-at-rules',
|
|
112
|
+
node: atRuleGrouping,
|
|
113
|
+
atRule: atRule
|
|
114
|
+
});
|
|
115
|
+
}
|
|
111
116
|
if (atRuleGrouping.value.type !== 'ObjectExpression') {
|
|
112
117
|
return;
|
|
113
118
|
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { getScope, getSourceCode } from '@atlaskit/eslint-utils/context-compat';
|
|
2
|
+
import { CSS_IN_JS_IMPORTS, isCssMap } from '@atlaskit/eslint-utils/is-supported-import';
|
|
3
|
+
import { createLintRule } from '../utils/create-rule';
|
|
4
|
+
var IMPORT_SOURCES = [CSS_IN_JS_IMPORTS.compiled, CSS_IN_JS_IMPORTS.atlaskitCss];
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Gets the key name from a property node
|
|
8
|
+
*/
|
|
9
|
+
function getPropertyKeyName(property) {
|
|
10
|
+
if (property.key.type === 'Identifier') {
|
|
11
|
+
return property.key.name;
|
|
12
|
+
}
|
|
13
|
+
if (property.key.type === 'Literal' && typeof property.key.value === 'string') {
|
|
14
|
+
return property.key.value;
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Checks if a variable is exported from the module
|
|
21
|
+
*/
|
|
22
|
+
function isExported(node, context) {
|
|
23
|
+
var parent = node.parent;
|
|
24
|
+
|
|
25
|
+
// Walk up to find VariableDeclaration
|
|
26
|
+
while (parent && parent.type !== 'VariableDeclaration') {
|
|
27
|
+
parent = parent.parent;
|
|
28
|
+
}
|
|
29
|
+
if (!parent) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Check if the VariableDeclaration is an ExportNamedDeclaration
|
|
34
|
+
var grandParent = parent.parent;
|
|
35
|
+
if (grandParent && grandParent.type === 'ExportNamedDeclaration') {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Check if the variable is exported elsewhere in the file via `export { styles }`
|
|
40
|
+
if (node.id.type === 'Identifier') {
|
|
41
|
+
var scope = getScope(context, node);
|
|
42
|
+
var variableName = node.id.name;
|
|
43
|
+
var variable = scope.variables.find(function (v) {
|
|
44
|
+
return v.name === variableName;
|
|
45
|
+
});
|
|
46
|
+
if (variable) {
|
|
47
|
+
// Check if any reference is a direct export specifier (e.g., `export { styles }`)
|
|
48
|
+
return variable.references.some(function (ref) {
|
|
49
|
+
var refParent = ref.identifier.parent;
|
|
50
|
+
// Check for direct export: `export { styles }` or `export { styles as something }`
|
|
51
|
+
// In this case, the identifier's parent is an ExportSpecifier
|
|
52
|
+
if (refParent && refParent.type === 'ExportSpecifier') {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
// Check for default export: `export default styles`
|
|
56
|
+
if (refParent && refParent.type === 'ExportDefaultDeclaration') {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
export var rule = createLintRule({
|
|
66
|
+
meta: {
|
|
67
|
+
name: 'no-unused-cssmap-properties',
|
|
68
|
+
docs: {
|
|
69
|
+
description: 'Detects unused properties in cssMap style objects that are not exported. Helps maintain clean code by identifying style variants that are defined but never used.',
|
|
70
|
+
recommended: true,
|
|
71
|
+
severity: 'warn'
|
|
72
|
+
},
|
|
73
|
+
messages: {
|
|
74
|
+
'unused-property': 'The "{{propertyName}}" style is defined but never used.'
|
|
75
|
+
},
|
|
76
|
+
type: 'problem'
|
|
77
|
+
},
|
|
78
|
+
create: function create(context) {
|
|
79
|
+
return {
|
|
80
|
+
VariableDeclarator: function VariableDeclarator(node) {
|
|
81
|
+
var _getSourceCode$scopeM;
|
|
82
|
+
if (node.type !== 'VariableDeclarator') {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Only process if the initializer is a cssMap call
|
|
87
|
+
if (!node.init || node.init.type !== 'CallExpression' || !isCssMap(node.init.callee, getScope(context, node).references, IMPORT_SOURCES)) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Skip if the cssMap is exported
|
|
92
|
+
if (isExported(node, context)) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Get the cssMap argument (should be an object expression)
|
|
97
|
+
var cssMapArg = node.init.arguments[0];
|
|
98
|
+
if (!cssMapArg || cssMapArg.type !== 'ObjectExpression') {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Get the variable name
|
|
103
|
+
if (node.id.type !== 'Identifier') {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
var variableName = node.id.name;
|
|
107
|
+
|
|
108
|
+
// Use getDeclaredVariables to get the variable with all its references
|
|
109
|
+
// across all scopes (including nested function components)
|
|
110
|
+
var declaredVariables = (_getSourceCode$scopeM = getSourceCode(context).scopeManager) === null || _getSourceCode$scopeM === void 0 ? void 0 : _getSourceCode$scopeM.getDeclaredVariables(node);
|
|
111
|
+
var variable = declaredVariables === null || declaredVariables === void 0 ? void 0 : declaredVariables.find(function (v) {
|
|
112
|
+
return v.name === variableName;
|
|
113
|
+
});
|
|
114
|
+
if (!variable) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Track which properties are defined
|
|
119
|
+
var definedProperties = new Set();
|
|
120
|
+
cssMapArg.properties.forEach(function (prop) {
|
|
121
|
+
if (prop.type === 'Property') {
|
|
122
|
+
var keyName = getPropertyKeyName(prop);
|
|
123
|
+
if (keyName) {
|
|
124
|
+
definedProperties.add(keyName);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// Track which properties are used
|
|
130
|
+
var usedProperties = new Set();
|
|
131
|
+
var hasNonPropertyAccess = false;
|
|
132
|
+
variable.references.forEach(function (reference) {
|
|
133
|
+
// Skip the declaration itself
|
|
134
|
+
if (reference.init) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
var identifier = reference.identifier;
|
|
138
|
+
var parent = identifier.parent;
|
|
139
|
+
|
|
140
|
+
// Check if it's a member access (e.g., styles.root)
|
|
141
|
+
if (parent && parent.type === 'MemberExpression' && parent.object === identifier) {
|
|
142
|
+
// Check if it's computed (dynamic) property access like styles[dynamicKey]
|
|
143
|
+
if (parent.computed) {
|
|
144
|
+
// Dynamic access - we can't determine which properties are used
|
|
145
|
+
hasNonPropertyAccess = true;
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Static property access
|
|
150
|
+
if (parent.property.type === 'Identifier') {
|
|
151
|
+
usedProperties.add(parent.property.name);
|
|
152
|
+
} else if (parent.property.type === 'Literal' && typeof parent.property.value === 'string') {
|
|
153
|
+
usedProperties.add(parent.property.value);
|
|
154
|
+
}
|
|
155
|
+
} else {
|
|
156
|
+
// The cssMap object is used as a whole (e.g., spread, passed to function, etc.)
|
|
157
|
+
// In this case, we can't determine which properties are used, so mark all as used
|
|
158
|
+
hasNonPropertyAccess = true;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// If the object is used as a whole (not just property access), skip checks
|
|
163
|
+
if (hasNonPropertyAccess) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Report unused properties
|
|
168
|
+
cssMapArg.properties.forEach(function (prop) {
|
|
169
|
+
if (prop.type === 'Property') {
|
|
170
|
+
var keyName = getPropertyKeyName(prop);
|
|
171
|
+
if (keyName && !usedProperties.has(keyName)) {
|
|
172
|
+
context.report({
|
|
173
|
+
node: prop.key,
|
|
174
|
+
messageId: 'unused-property',
|
|
175
|
+
data: {
|
|
176
|
+
propertyName: keyName
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
export default rule;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::f99588f71d6b353cefbed97fd172e433>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard 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::8f28dfef84548edbe33f59201f295cc5>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard 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::f99588f71d6b353cefbed97fd172e433>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard 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::8f28dfef84548edbe33f59201f295cc5>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard 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::2eab912b0c44d0fcbdc2f0b79cb42fa9>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { Rule } from 'eslint';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -17,4 +17,49 @@ declare const cssPseudos: readonly ["&:active", "&:autofill", "&:blank", "&:chec
|
|
|
17
17
|
export declare const allowedPseudos: Set<string>;
|
|
18
18
|
export declare const legacyPseudoElements: Set<string>;
|
|
19
19
|
export declare const ignoredAtRules: Set<string>;
|
|
20
|
+
/**
|
|
21
|
+
* At-rules that are allowed to be used in "grouped" form within cssMap.
|
|
22
|
+
*
|
|
23
|
+
* "Grouped" refers to the legacy Compiled syntax where an at-rule key with no parameters
|
|
24
|
+
* (matching `/^@[A-z-]+$/`) contains nested variant keys, like:
|
|
25
|
+
*
|
|
26
|
+
* ```typescript
|
|
27
|
+
* // ❌ GROUPED (not allowed for @media):
|
|
28
|
+
* cssMap({
|
|
29
|
+
* variant: {
|
|
30
|
+
* '@media': { // at-rule key with no parameters
|
|
31
|
+
* '(min-width: 900px)': {}, // nested variants
|
|
32
|
+
* '(min-width: 1200px)': {},
|
|
33
|
+
* }
|
|
34
|
+
* }
|
|
35
|
+
* })
|
|
36
|
+
*
|
|
37
|
+
* // ✅ FLAT (preferred for @media):
|
|
38
|
+
* cssMap({
|
|
39
|
+
* variant: {
|
|
40
|
+
* '@media (min-width: 900px)': {}, // at-rule with parameters
|
|
41
|
+
* '@media (min-width: 1200px)': {},
|
|
42
|
+
* }
|
|
43
|
+
* })
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* However, some at-rules like `@starting-style` have no parameters and can only be
|
|
47
|
+
* written in the "grouped" form at the variant level:
|
|
48
|
+
*
|
|
49
|
+
* ```typescript
|
|
50
|
+
* // ✅ ALLOWED (only valid syntax for @starting-style):
|
|
51
|
+
* cssMap({
|
|
52
|
+
* fade: {
|
|
53
|
+
* '@starting-style': { // at-rule with no parameters
|
|
54
|
+
* opacity: 0, // styles to apply
|
|
55
|
+
* }
|
|
56
|
+
* }
|
|
57
|
+
* })
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* Note: This only applies to at-rules at the variant level. Nested at-rules inside
|
|
61
|
+
* other rulesets (e.g., `@starting-style` inside `@media (...)`) are handled by
|
|
62
|
+
* `walkStyleRuleset` and are not considered "grouped".
|
|
63
|
+
*/
|
|
64
|
+
export declare const allowedGroupedAtRules: Set<string>;
|
|
20
65
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
-
* @codegen <<SignedSource::
|
|
3
|
+
* @codegen <<SignedSource::f99588f71d6b353cefbed97fd172e433>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard 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::8f28dfef84548edbe33f59201f295cc5>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard 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::f99588f71d6b353cefbed97fd172e433>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard 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::8f28dfef84548edbe33f59201f295cc5>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard 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::2eab912b0c44d0fcbdc2f0b79cb42fa9>>
|
|
4
4
|
* @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
|
|
5
5
|
*/
|
|
6
6
|
import type { Rule } from 'eslint';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
|
@@ -82,4 +82,49 @@ declare const cssPseudos: readonly [
|
|
|
82
82
|
export declare const allowedPseudos: Set<string>;
|
|
83
83
|
export declare const legacyPseudoElements: Set<string>;
|
|
84
84
|
export declare const ignoredAtRules: Set<string>;
|
|
85
|
+
/**
|
|
86
|
+
* At-rules that are allowed to be used in "grouped" form within cssMap.
|
|
87
|
+
*
|
|
88
|
+
* "Grouped" refers to the legacy Compiled syntax where an at-rule key with no parameters
|
|
89
|
+
* (matching `/^@[A-z-]+$/`) contains nested variant keys, like:
|
|
90
|
+
*
|
|
91
|
+
* ```typescript
|
|
92
|
+
* // ❌ GROUPED (not allowed for @media):
|
|
93
|
+
* cssMap({
|
|
94
|
+
* variant: {
|
|
95
|
+
* '@media': { // at-rule key with no parameters
|
|
96
|
+
* '(min-width: 900px)': {}, // nested variants
|
|
97
|
+
* '(min-width: 1200px)': {},
|
|
98
|
+
* }
|
|
99
|
+
* }
|
|
100
|
+
* })
|
|
101
|
+
*
|
|
102
|
+
* // ✅ FLAT (preferred for @media):
|
|
103
|
+
* cssMap({
|
|
104
|
+
* variant: {
|
|
105
|
+
* '@media (min-width: 900px)': {}, // at-rule with parameters
|
|
106
|
+
* '@media (min-width: 1200px)': {},
|
|
107
|
+
* }
|
|
108
|
+
* })
|
|
109
|
+
* ```
|
|
110
|
+
*
|
|
111
|
+
* However, some at-rules like `@starting-style` have no parameters and can only be
|
|
112
|
+
* written in the "grouped" form at the variant level:
|
|
113
|
+
*
|
|
114
|
+
* ```typescript
|
|
115
|
+
* // ✅ ALLOWED (only valid syntax for @starting-style):
|
|
116
|
+
* cssMap({
|
|
117
|
+
* fade: {
|
|
118
|
+
* '@starting-style': { // at-rule with no parameters
|
|
119
|
+
* opacity: 0, // styles to apply
|
|
120
|
+
* }
|
|
121
|
+
* }
|
|
122
|
+
* })
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* Note: This only applies to at-rules at the variant level. Nested at-rules inside
|
|
126
|
+
* other rulesets (e.g., `@starting-style` inside `@media (...)`) are handled by
|
|
127
|
+
* `walkStyleRuleset` and are not considered "grouped".
|
|
128
|
+
*/
|
|
129
|
+
export declare const allowedGroupedAtRules: Set<string>;
|
|
85
130
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const rule: import(
|
|
1
|
+
export declare const rule: import('eslint').Rule.RuleModule;
|
|
2
2
|
export default rule;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/eslint-plugin-ui-styling-standard",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"author": "Atlassian Pty Ltd",
|
|
5
5
|
"description": "The eslint plugin to enforce and educate on Atlassian's UI Styling Standard",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
],
|
|
37
37
|
"atlaskit:src": "src/index.tsx",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@atlaskit/eslint-plugin-design-system": "^13.
|
|
39
|
+
"@atlaskit/eslint-plugin-design-system": "^13.40.0",
|
|
40
40
|
"@atlaskit/eslint-utils": "^2.0.0",
|
|
41
41
|
"@babel/runtime": "^7.0.0",
|
|
42
42
|
"@typescript-eslint/utils": "^7.1.0",
|