@atlaskit/eslint-plugin-platform 2.1.1 → 2.2.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 +16 -0
- package/dist/cjs/index.js +105 -63
- package/dist/cjs/rules/compiled/expand-spacing-shorthand/index.js +6 -5
- package/dist/es2019/index.js +116 -74
- package/dist/es2019/rules/compiled/expand-spacing-shorthand/index.js +6 -3
- package/dist/esm/index.js +106 -64
- package/dist/esm/rules/compiled/expand-spacing-shorthand/index.js +6 -5
- package/dist/types/index.d.ts +233 -35
- package/dist/types-ts4.5/index.d.ts +276 -42
- package/package.json +1 -1
- package/src/index.tsx +120 -79
- package/src/rules/compiled/expand-spacing-shorthand/__tests__/rule.test.ts +17 -1
- package/src/rules/compiled/expand-spacing-shorthand/index.ts +6 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Linter } from 'eslint';
|
|
2
|
-
|
|
1
|
+
import type { ESLint, Linter } from 'eslint';
|
|
2
|
+
declare const rules: {
|
|
3
3
|
'ensure-feature-flag-registration': import("eslint").Rule.RuleModule;
|
|
4
4
|
'ensure-feature-flag-prefix': import("eslint").Rule.RuleModule;
|
|
5
5
|
'ensure-test-runner-arguments': import("eslint").Rule.RuleModule;
|
|
@@ -27,57 +27,291 @@ export declare const rules: {
|
|
|
27
27
|
'use-entrypoints-in-examples': import("eslint").Rule.RuleModule;
|
|
28
28
|
'use-recommended-utils': import("eslint").Rule.RuleModule;
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
declare const plugin: {
|
|
31
|
+
meta: {
|
|
32
|
+
name: string;
|
|
33
|
+
version: string;
|
|
34
|
+
};
|
|
35
|
+
rules: {
|
|
36
|
+
'ensure-feature-flag-registration': import("eslint").Rule.RuleModule;
|
|
37
|
+
'ensure-feature-flag-prefix': import("eslint").Rule.RuleModule;
|
|
38
|
+
'ensure-test-runner-arguments': import("eslint").Rule.RuleModule;
|
|
39
|
+
'ensure-test-runner-nested-count': import("eslint").Rule.RuleModule;
|
|
40
|
+
'ensure-atlassian-team': import("eslint").Rule.RuleModule;
|
|
41
|
+
'ensure-critical-dependency-resolutions': import("eslint").Rule.RuleModule;
|
|
42
|
+
'ensure-valid-platform-yarn-protocol-usage': import("eslint").Rule.RuleModule;
|
|
43
|
+
'ensure-valid-bin-values': import("eslint").Rule.RuleModule;
|
|
44
|
+
'expand-border-shorthand': import("eslint").Rule.RuleModule;
|
|
45
|
+
'expand-background-shorthand': import("eslint").Rule.RuleModule;
|
|
46
|
+
'expand-spacing-shorthand': import("eslint").Rule.RuleModule;
|
|
47
|
+
'no-duplicate-dependencies': import("eslint").Rule.RuleModule;
|
|
48
|
+
'no-invalid-feature-flag-usage': import("eslint").Rule.RuleModule;
|
|
49
|
+
'no-pre-post-install-scripts': import("eslint").Rule.RuleModule;
|
|
50
|
+
'no-invalid-storybook-decorator-usage': import("eslint").Rule.RuleModule;
|
|
51
|
+
'ensure-publish-valid': import("eslint").Rule.RuleModule;
|
|
52
|
+
'ensure-native-and-af-exports-synced': import("eslint").Rule.RuleModule;
|
|
53
|
+
'no-module-level-eval': import("eslint").Rule.RuleModule;
|
|
54
|
+
'no-module-level-eval-nav4': import("eslint").Rule.RuleModule;
|
|
55
|
+
'static-feature-flags': import("eslint").Rule.RuleModule;
|
|
56
|
+
'no-preconditioning': import("eslint").Rule.RuleModule;
|
|
57
|
+
'inline-usage': import("eslint").Rule.RuleModule;
|
|
58
|
+
'prefer-fg': import("eslint").Rule.RuleModule;
|
|
59
|
+
'no-alias': import("eslint").Rule.RuleModule;
|
|
60
|
+
'use-entrypoints-in-examples': import("eslint").Rule.RuleModule;
|
|
61
|
+
'use-recommended-utils': import("eslint").Rule.RuleModule;
|
|
62
|
+
};
|
|
63
|
+
configs: {
|
|
64
|
+
recommended: {
|
|
65
|
+
plugins: string[];
|
|
66
|
+
rules: {
|
|
67
|
+
'@atlaskit/platform/no-module-level-eval': "error";
|
|
68
|
+
'@atlaskit/platform/static-feature-flags': "error";
|
|
69
|
+
'@atlaskit/platform/no-preconditioning': "error";
|
|
70
|
+
'@atlaskit/platform/inline-usage': "error";
|
|
71
|
+
'@atlaskit/platform/prefer-fg': "error";
|
|
72
|
+
'@atlaskit/platform/no-alias': "error";
|
|
73
|
+
'@atlaskit/platform/ensure-feature-flag-registration': "error";
|
|
74
|
+
'@atlaskit/platform/ensure-feature-flag-prefix': [
|
|
75
|
+
"warn",
|
|
76
|
+
{
|
|
77
|
+
allowedPrefixes: string[];
|
|
78
|
+
}
|
|
79
|
+
];
|
|
80
|
+
'@atlaskit/platform/ensure-test-runner-arguments': "error";
|
|
81
|
+
'@atlaskit/platform/ensure-test-runner-nested-count': "warn";
|
|
82
|
+
'@atlaskit/platform/no-invalid-feature-flag-usage': "error";
|
|
83
|
+
'@atlaskit/platform/no-invalid-storybook-decorator-usage': "error";
|
|
84
|
+
'@atlaskit/platform/ensure-atlassian-team': "error";
|
|
85
|
+
'@atlaskit/platform/no-module-level-eval-nav4': "error";
|
|
86
|
+
'@atlaskit/platform/expand-border-shorthand': "error";
|
|
87
|
+
'@atlaskit/platform/expand-background-shorthand': "error";
|
|
88
|
+
'@atlaskit/platform/expand-spacing-shorthand': "off";
|
|
89
|
+
'@compiled/jsx-pragma': [
|
|
90
|
+
"error",
|
|
91
|
+
{
|
|
92
|
+
importSources: string[];
|
|
93
|
+
onlyRunIfImportingCompiled: boolean;
|
|
94
|
+
runtime: string;
|
|
95
|
+
}
|
|
96
|
+
];
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
'recommended/flat': {
|
|
100
|
+
plugins: {
|
|
101
|
+
readonly '@atlaskit/platform': ESLint.Plugin;
|
|
102
|
+
'@compiled': ESLint.Plugin;
|
|
103
|
+
};
|
|
104
|
+
rules: {
|
|
105
|
+
'@atlaskit/platform/no-module-level-eval': "error";
|
|
106
|
+
'@atlaskit/platform/static-feature-flags': "error";
|
|
107
|
+
'@atlaskit/platform/no-preconditioning': "error";
|
|
108
|
+
'@atlaskit/platform/inline-usage': "error";
|
|
109
|
+
'@atlaskit/platform/prefer-fg': "error";
|
|
110
|
+
'@atlaskit/platform/no-alias': "error";
|
|
111
|
+
'@atlaskit/platform/ensure-feature-flag-registration': "error";
|
|
112
|
+
'@atlaskit/platform/ensure-feature-flag-prefix': [
|
|
113
|
+
"warn",
|
|
114
|
+
{
|
|
115
|
+
allowedPrefixes: string[];
|
|
116
|
+
}
|
|
117
|
+
];
|
|
118
|
+
'@atlaskit/platform/ensure-test-runner-arguments': "error";
|
|
119
|
+
'@atlaskit/platform/ensure-test-runner-nested-count': "warn";
|
|
120
|
+
'@atlaskit/platform/no-invalid-feature-flag-usage': "error";
|
|
121
|
+
'@atlaskit/platform/no-invalid-storybook-decorator-usage': "error";
|
|
122
|
+
'@atlaskit/platform/ensure-atlassian-team': "error";
|
|
123
|
+
'@atlaskit/platform/no-module-level-eval-nav4': "error";
|
|
124
|
+
'@atlaskit/platform/expand-border-shorthand': "error";
|
|
125
|
+
'@atlaskit/platform/expand-background-shorthand': "error";
|
|
126
|
+
'@atlaskit/platform/expand-spacing-shorthand': "off";
|
|
127
|
+
'@compiled/jsx-pragma': [
|
|
128
|
+
"error",
|
|
129
|
+
{
|
|
130
|
+
importSources: string[];
|
|
131
|
+
onlyRunIfImportingCompiled: boolean;
|
|
132
|
+
runtime: string;
|
|
133
|
+
}
|
|
134
|
+
];
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
jira: {
|
|
138
|
+
plugins: string[];
|
|
139
|
+
rules: {
|
|
140
|
+
'@atlaskit/platform/ensure-test-runner-arguments': "error";
|
|
141
|
+
'@atlaskit/platform/ensure-test-runner-nested-count': "warn";
|
|
142
|
+
'@atlaskit/platform/no-invalid-feature-flag-usage': "error";
|
|
143
|
+
'@atlaskit/platform/no-invalid-storybook-decorator-usage': "error";
|
|
144
|
+
'@atlaskit/platform/ensure-atlassian-team': "error";
|
|
145
|
+
'@atlaskit/platform/no-module-level-eval-nav4': "error";
|
|
146
|
+
'@atlaskit/platform/expand-border-shorthand': "error";
|
|
147
|
+
'@atlaskit/platform/expand-background-shorthand': "error";
|
|
148
|
+
'@atlaskit/platform/expand-spacing-shorthand': "off";
|
|
149
|
+
'@compiled/jsx-pragma': [
|
|
150
|
+
"error",
|
|
151
|
+
{
|
|
152
|
+
importSources: string[];
|
|
153
|
+
onlyRunIfImportingCompiled: boolean;
|
|
154
|
+
runtime: string;
|
|
155
|
+
}
|
|
156
|
+
];
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
'jira/flat': {
|
|
160
|
+
plugins: {
|
|
161
|
+
readonly '@atlaskit/platform': ESLint.Plugin;
|
|
162
|
+
'@compiled': ESLint.Plugin;
|
|
163
|
+
};
|
|
164
|
+
rules: {
|
|
165
|
+
'@atlaskit/platform/ensure-test-runner-arguments': "error";
|
|
166
|
+
'@atlaskit/platform/ensure-test-runner-nested-count': "warn";
|
|
167
|
+
'@atlaskit/platform/no-invalid-feature-flag-usage': "error";
|
|
168
|
+
'@atlaskit/platform/no-invalid-storybook-decorator-usage': "error";
|
|
169
|
+
'@atlaskit/platform/ensure-atlassian-team': "error";
|
|
170
|
+
'@atlaskit/platform/no-module-level-eval-nav4': "error";
|
|
171
|
+
'@atlaskit/platform/expand-border-shorthand': "error";
|
|
172
|
+
'@atlaskit/platform/expand-background-shorthand': "error";
|
|
173
|
+
'@atlaskit/platform/expand-spacing-shorthand': "off";
|
|
174
|
+
'@compiled/jsx-pragma': [
|
|
175
|
+
"error",
|
|
176
|
+
{
|
|
177
|
+
importSources: string[];
|
|
178
|
+
onlyRunIfImportingCompiled: boolean;
|
|
179
|
+
runtime: string;
|
|
180
|
+
}
|
|
181
|
+
];
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
processors: {
|
|
186
|
+
'package-json-processor': Linter.Processor<string | Linter.ProcessorFile>;
|
|
187
|
+
'package-json-processor-for-flat-config': Linter.Processor<string | Linter.ProcessorFile>;
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
declare const configs: {
|
|
31
191
|
recommended: {
|
|
32
192
|
plugins: string[];
|
|
33
193
|
rules: {
|
|
34
|
-
'@atlaskit/platform/no-module-level-eval':
|
|
35
|
-
'@atlaskit/platform/static-feature-flags':
|
|
36
|
-
'@atlaskit/platform/no-preconditioning':
|
|
37
|
-
'@atlaskit/platform/inline-usage':
|
|
38
|
-
'@atlaskit/platform/prefer-fg':
|
|
39
|
-
'@atlaskit/platform/no-alias':
|
|
40
|
-
'@atlaskit/platform/ensure-feature-flag-registration':
|
|
41
|
-
'@atlaskit/platform/ensure-feature-flag-prefix':
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
'@atlaskit/platform/
|
|
48
|
-
'@atlaskit/platform/ensure-
|
|
49
|
-
'@atlaskit/platform/no-
|
|
50
|
-
'@atlaskit/platform/
|
|
51
|
-
'@atlaskit/platform/
|
|
52
|
-
'@atlaskit/platform/
|
|
53
|
-
'@
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
194
|
+
'@atlaskit/platform/no-module-level-eval': "error";
|
|
195
|
+
'@atlaskit/platform/static-feature-flags': "error";
|
|
196
|
+
'@atlaskit/platform/no-preconditioning': "error";
|
|
197
|
+
'@atlaskit/platform/inline-usage': "error";
|
|
198
|
+
'@atlaskit/platform/prefer-fg': "error";
|
|
199
|
+
'@atlaskit/platform/no-alias': "error";
|
|
200
|
+
'@atlaskit/platform/ensure-feature-flag-registration': "error";
|
|
201
|
+
'@atlaskit/platform/ensure-feature-flag-prefix': [
|
|
202
|
+
"warn",
|
|
203
|
+
{
|
|
204
|
+
allowedPrefixes: string[];
|
|
205
|
+
}
|
|
206
|
+
];
|
|
207
|
+
'@atlaskit/platform/ensure-test-runner-arguments': "error";
|
|
208
|
+
'@atlaskit/platform/ensure-test-runner-nested-count': "warn";
|
|
209
|
+
'@atlaskit/platform/no-invalid-feature-flag-usage': "error";
|
|
210
|
+
'@atlaskit/platform/no-invalid-storybook-decorator-usage': "error";
|
|
211
|
+
'@atlaskit/platform/ensure-atlassian-team': "error";
|
|
212
|
+
'@atlaskit/platform/no-module-level-eval-nav4': "error";
|
|
213
|
+
'@atlaskit/platform/expand-border-shorthand': "error";
|
|
214
|
+
'@atlaskit/platform/expand-background-shorthand': "error";
|
|
215
|
+
'@atlaskit/platform/expand-spacing-shorthand': "off";
|
|
216
|
+
'@compiled/jsx-pragma': [
|
|
217
|
+
"error",
|
|
218
|
+
{
|
|
219
|
+
importSources: string[];
|
|
220
|
+
onlyRunIfImportingCompiled: boolean;
|
|
221
|
+
runtime: string;
|
|
222
|
+
}
|
|
223
|
+
];
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
'recommended/flat': {
|
|
227
|
+
plugins: {
|
|
228
|
+
readonly '@atlaskit/platform': ESLint.Plugin;
|
|
229
|
+
'@compiled': ESLint.Plugin;
|
|
230
|
+
};
|
|
231
|
+
rules: {
|
|
232
|
+
'@atlaskit/platform/no-module-level-eval': "error";
|
|
233
|
+
'@atlaskit/platform/static-feature-flags': "error";
|
|
234
|
+
'@atlaskit/platform/no-preconditioning': "error";
|
|
235
|
+
'@atlaskit/platform/inline-usage': "error";
|
|
236
|
+
'@atlaskit/platform/prefer-fg': "error";
|
|
237
|
+
'@atlaskit/platform/no-alias': "error";
|
|
238
|
+
'@atlaskit/platform/ensure-feature-flag-registration': "error";
|
|
239
|
+
'@atlaskit/platform/ensure-feature-flag-prefix': [
|
|
240
|
+
"warn",
|
|
241
|
+
{
|
|
242
|
+
allowedPrefixes: string[];
|
|
243
|
+
}
|
|
244
|
+
];
|
|
245
|
+
'@atlaskit/platform/ensure-test-runner-arguments': "error";
|
|
246
|
+
'@atlaskit/platform/ensure-test-runner-nested-count': "warn";
|
|
247
|
+
'@atlaskit/platform/no-invalid-feature-flag-usage': "error";
|
|
248
|
+
'@atlaskit/platform/no-invalid-storybook-decorator-usage': "error";
|
|
249
|
+
'@atlaskit/platform/ensure-atlassian-team': "error";
|
|
250
|
+
'@atlaskit/platform/no-module-level-eval-nav4': "error";
|
|
251
|
+
'@atlaskit/platform/expand-border-shorthand': "error";
|
|
252
|
+
'@atlaskit/platform/expand-background-shorthand': "error";
|
|
253
|
+
'@atlaskit/platform/expand-spacing-shorthand': "off";
|
|
254
|
+
'@compiled/jsx-pragma': [
|
|
255
|
+
"error",
|
|
256
|
+
{
|
|
257
|
+
importSources: string[];
|
|
258
|
+
onlyRunIfImportingCompiled: boolean;
|
|
259
|
+
runtime: string;
|
|
260
|
+
}
|
|
261
|
+
];
|
|
58
262
|
};
|
|
59
263
|
};
|
|
60
264
|
jira: {
|
|
61
265
|
plugins: string[];
|
|
62
266
|
rules: {
|
|
63
|
-
'@atlaskit/platform/ensure-test-runner-arguments':
|
|
64
|
-
'@atlaskit/platform/ensure-test-runner-nested-count':
|
|
65
|
-
'@atlaskit/platform/no-invalid-feature-flag-usage':
|
|
66
|
-
'@atlaskit/platform/no-invalid-storybook-decorator-usage':
|
|
67
|
-
'@atlaskit/platform/ensure-atlassian-team':
|
|
68
|
-
'@atlaskit/platform/no-module-level-eval-nav4':
|
|
69
|
-
'@atlaskit/platform/expand-border-shorthand':
|
|
70
|
-
'@atlaskit/platform/expand-background-shorthand':
|
|
71
|
-
'@atlaskit/platform/expand-spacing-shorthand':
|
|
72
|
-
'@compiled/jsx-pragma':
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
267
|
+
'@atlaskit/platform/ensure-test-runner-arguments': "error";
|
|
268
|
+
'@atlaskit/platform/ensure-test-runner-nested-count': "warn";
|
|
269
|
+
'@atlaskit/platform/no-invalid-feature-flag-usage': "error";
|
|
270
|
+
'@atlaskit/platform/no-invalid-storybook-decorator-usage': "error";
|
|
271
|
+
'@atlaskit/platform/ensure-atlassian-team': "error";
|
|
272
|
+
'@atlaskit/platform/no-module-level-eval-nav4': "error";
|
|
273
|
+
'@atlaskit/platform/expand-border-shorthand': "error";
|
|
274
|
+
'@atlaskit/platform/expand-background-shorthand': "error";
|
|
275
|
+
'@atlaskit/platform/expand-spacing-shorthand': "off";
|
|
276
|
+
'@compiled/jsx-pragma': [
|
|
277
|
+
"error",
|
|
278
|
+
{
|
|
279
|
+
importSources: string[];
|
|
280
|
+
onlyRunIfImportingCompiled: boolean;
|
|
281
|
+
runtime: string;
|
|
282
|
+
}
|
|
283
|
+
];
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
'jira/flat': {
|
|
287
|
+
plugins: {
|
|
288
|
+
readonly '@atlaskit/platform': ESLint.Plugin;
|
|
289
|
+
'@compiled': ESLint.Plugin;
|
|
290
|
+
};
|
|
291
|
+
rules: {
|
|
292
|
+
'@atlaskit/platform/ensure-test-runner-arguments': "error";
|
|
293
|
+
'@atlaskit/platform/ensure-test-runner-nested-count': "warn";
|
|
294
|
+
'@atlaskit/platform/no-invalid-feature-flag-usage': "error";
|
|
295
|
+
'@atlaskit/platform/no-invalid-storybook-decorator-usage': "error";
|
|
296
|
+
'@atlaskit/platform/ensure-atlassian-team': "error";
|
|
297
|
+
'@atlaskit/platform/no-module-level-eval-nav4': "error";
|
|
298
|
+
'@atlaskit/platform/expand-border-shorthand': "error";
|
|
299
|
+
'@atlaskit/platform/expand-background-shorthand': "error";
|
|
300
|
+
'@atlaskit/platform/expand-spacing-shorthand': "off";
|
|
301
|
+
'@compiled/jsx-pragma': [
|
|
302
|
+
"error",
|
|
303
|
+
{
|
|
304
|
+
importSources: string[];
|
|
305
|
+
onlyRunIfImportingCompiled: boolean;
|
|
306
|
+
runtime: string;
|
|
307
|
+
}
|
|
308
|
+
];
|
|
77
309
|
};
|
|
78
310
|
};
|
|
79
311
|
};
|
|
80
|
-
|
|
312
|
+
declare const processors: {
|
|
81
313
|
'package-json-processor': Linter.Processor<string | Linter.ProcessorFile>;
|
|
82
314
|
'package-json-processor-for-flat-config': Linter.Processor<string | Linter.ProcessorFile>;
|
|
83
315
|
};
|
|
316
|
+
export { configs, plugin, processors, rules };
|
|
317
|
+
export default plugin;
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
-
import
|
|
2
|
+
import compiledPlugin from '@compiled/eslint-plugin';
|
|
3
|
+
import type { ESLint, Linter } from 'eslint';
|
|
3
4
|
import ensureFeatureFlagRegistration from './rules/ensure-feature-flag-registration';
|
|
4
5
|
import noPreAndPostInstallScripts from './rules/no-pre-post-installs';
|
|
5
6
|
import ensureTestRunnerArguments from './rules/ensure-test-runner-arguments';
|
|
@@ -27,7 +28,13 @@ import useRecommendedUtils from './rules/feature-gating/use-recommended-utils';
|
|
|
27
28
|
import expandBackgroundShorthand from './rules/compiled/expand-background-shorthand';
|
|
28
29
|
import expandSpacingShorthand from './rules/compiled/expand-spacing-shorthand';
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
const packageJson: {
|
|
32
|
+
name: string;
|
|
33
|
+
version: string;
|
|
34
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
35
|
+
} = require('@atlaskit/eslint-plugin-platform/package.json');
|
|
36
|
+
|
|
37
|
+
const rules = {
|
|
31
38
|
'ensure-feature-flag-registration': ensureFeatureFlagRegistration,
|
|
32
39
|
'ensure-feature-flag-prefix': ensureFeatureFlagPrefix,
|
|
33
40
|
'ensure-test-runner-arguments': ensureTestRunnerArguments,
|
|
@@ -75,36 +82,27 @@ const commonConfig = {
|
|
|
75
82
|
runtime: 'classic',
|
|
76
83
|
},
|
|
77
84
|
],
|
|
78
|
-
};
|
|
85
|
+
} satisfies Linter.RulesRecord;
|
|
79
86
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
jira: {
|
|
102
|
-
plugins: ['@atlaskit/platform', '@compiled'],
|
|
103
|
-
rules: {
|
|
104
|
-
...commonConfig,
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
};
|
|
87
|
+
const recommendedRules = {
|
|
88
|
+
...commonConfig,
|
|
89
|
+
// See platform/packages/platform/eslint-plugin/src/rules/feature-gating/README.md
|
|
90
|
+
// These rules are specific to `platform` and seem a WIP; jira and confluence currently have their own rules
|
|
91
|
+
'@atlaskit/platform/no-module-level-eval': 'error',
|
|
92
|
+
'@atlaskit/platform/static-feature-flags': 'error',
|
|
93
|
+
'@atlaskit/platform/no-preconditioning': 'error',
|
|
94
|
+
'@atlaskit/platform/inline-usage': 'error',
|
|
95
|
+
'@atlaskit/platform/prefer-fg': 'error',
|
|
96
|
+
'@atlaskit/platform/no-alias': 'error',
|
|
97
|
+
// end: feature-gating rules
|
|
98
|
+
'@atlaskit/platform/ensure-feature-flag-registration': 'error',
|
|
99
|
+
'@atlaskit/platform/ensure-feature-flag-prefix': [
|
|
100
|
+
'warn',
|
|
101
|
+
{ allowedPrefixes: ['platform.', 'platform_'] },
|
|
102
|
+
],
|
|
103
|
+
} satisfies Linter.RulesRecord;
|
|
104
|
+
|
|
105
|
+
const jiraRules = commonConfig;
|
|
108
106
|
|
|
109
107
|
const jsonPrefix =
|
|
110
108
|
'/* eslint-disable quote-props, comma-dangle, quotes, semi, eol-last, @typescript-eslint/semi, no-template-curly-in-string */ module.exports = ';
|
|
@@ -112,55 +110,98 @@ const jsonPrefix =
|
|
|
112
110
|
const jsonPrefixForFlatConfig =
|
|
113
111
|
'/* eslint-disable quote-props, comma-dangle, quotes, semi, eol-last, no-template-curly-in-string */ module.exports = ';
|
|
114
112
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
113
|
+
const { name, version } = packageJson;
|
|
114
|
+
const plugin = {
|
|
115
|
+
meta: {
|
|
116
|
+
name,
|
|
117
|
+
version,
|
|
118
|
+
},
|
|
119
|
+
rules,
|
|
120
|
+
configs: {
|
|
121
|
+
recommended: {
|
|
122
|
+
plugins: ['@atlaskit/platform', '@compiled'],
|
|
123
|
+
rules: recommendedRules,
|
|
120
124
|
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
...message,
|
|
131
|
-
fix: {
|
|
132
|
-
...fix,
|
|
133
|
-
range: [fix.range[0] - offset, fix.range[1] - offset],
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
|
-
});
|
|
125
|
+
'recommended/flat': {
|
|
126
|
+
plugins: {
|
|
127
|
+
get '@atlaskit/platform'(): ESLint.Plugin {
|
|
128
|
+
return plugin;
|
|
129
|
+
},
|
|
130
|
+
// @ts-expect-error there's an issue with the types for @compiled/eslint-plugin ('no-css-prop-without-css-function' specifically)
|
|
131
|
+
'@compiled': { meta: compiledPlugin.meta, rules: compiledPlugin.rules } as ESLint.Plugin,
|
|
132
|
+
},
|
|
133
|
+
rules: recommendedRules,
|
|
137
134
|
},
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
// once we roll out FlatConfig, we can remove the above processor
|
|
142
|
-
'package-json-processor-for-flat-config': {
|
|
143
|
-
preprocess: (source: string) => {
|
|
144
|
-
// augment the json into a js file
|
|
145
|
-
return [jsonPrefixForFlatConfig + source.trim()];
|
|
135
|
+
jira: {
|
|
136
|
+
plugins: ['@atlaskit/platform', '@compiled'],
|
|
137
|
+
rules: jiraRules,
|
|
146
138
|
},
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
...message,
|
|
157
|
-
fix: {
|
|
158
|
-
...fix,
|
|
159
|
-
range: [fix.range[0] - offset, fix.range[1] - offset],
|
|
160
|
-
},
|
|
161
|
-
};
|
|
162
|
-
});
|
|
139
|
+
'jira/flat': {
|
|
140
|
+
plugins: {
|
|
141
|
+
get '@atlaskit/platform'(): ESLint.Plugin {
|
|
142
|
+
return plugin;
|
|
143
|
+
},
|
|
144
|
+
// @ts-expect-error there's an issue with the types for @compiled/eslint-plugin ('no-css-prop-without-css-function' specifically)
|
|
145
|
+
'@compiled': { meta: compiledPlugin.meta, rules: compiledPlugin.rules } as ESLint.Plugin,
|
|
146
|
+
},
|
|
147
|
+
rules: jiraRules,
|
|
163
148
|
},
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
149
|
+
},
|
|
150
|
+
processors: {
|
|
151
|
+
'package-json-processor': {
|
|
152
|
+
preprocess: (source: string) => {
|
|
153
|
+
// augment the json into a js file
|
|
154
|
+
return [jsonPrefix + source.trim()];
|
|
155
|
+
},
|
|
156
|
+
postprocess: (messages) => {
|
|
157
|
+
return messages[0].map((message) => {
|
|
158
|
+
const { fix } = message;
|
|
159
|
+
if (!fix) {
|
|
160
|
+
return message;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const offset = jsonPrefix.length;
|
|
164
|
+
return {
|
|
165
|
+
...message,
|
|
166
|
+
fix: {
|
|
167
|
+
...fix,
|
|
168
|
+
range: [fix.range[0] - offset, fix.range[1] - offset],
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
supportsAutofix: true,
|
|
174
|
+
} as Linter.Processor,
|
|
175
|
+
// This processor is used for ESLint FlatConfig,
|
|
176
|
+
// once we roll out FlatConfig, we can remove the above processor
|
|
177
|
+
'package-json-processor-for-flat-config': {
|
|
178
|
+
preprocess: (source: string) => {
|
|
179
|
+
// augment the json into a js file
|
|
180
|
+
return [jsonPrefixForFlatConfig + source.trim()];
|
|
181
|
+
},
|
|
182
|
+
postprocess: (messages) => {
|
|
183
|
+
return messages[0].map((message) => {
|
|
184
|
+
const { fix } = message;
|
|
185
|
+
if (!fix) {
|
|
186
|
+
return message;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const offset = jsonPrefixForFlatConfig.length;
|
|
190
|
+
return {
|
|
191
|
+
...message,
|
|
192
|
+
fix: {
|
|
193
|
+
...fix,
|
|
194
|
+
range: [fix.range[0] - offset, fix.range[1] - offset],
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
});
|
|
198
|
+
},
|
|
199
|
+
supportsAutofix: true,
|
|
200
|
+
} as Linter.Processor,
|
|
201
|
+
},
|
|
202
|
+
} satisfies ESLint.Plugin;
|
|
203
|
+
const configs = plugin.configs;
|
|
204
|
+
const processors = plugin.processors;
|
|
205
|
+
|
|
206
|
+
export { configs, plugin, processors, rules };
|
|
207
|
+
export default plugin;
|
|
@@ -355,6 +355,13 @@ const invalidTestCases = (property: string) => {
|
|
|
355
355
|
${property}: \`\${token('space.100')} \${token('space.200')}
|
|
356
356
|
\${token('space.300')} \${token('space.400')}\`,
|
|
357
357
|
});
|
|
358
|
+
const styles2 = css({
|
|
359
|
+
paddingBottom: token('space.050', '4px'),
|
|
360
|
+
'&& > span': {
|
|
361
|
+
padding: \`\${token('space.100', '8px')} \${token('space.150', '12px')} 7px
|
|
362
|
+
\${token('space.150', '12px')}\`,
|
|
363
|
+
},
|
|
364
|
+
});
|
|
358
365
|
`,
|
|
359
366
|
output: outdent`
|
|
360
367
|
import {css} from '@compiled/react';
|
|
@@ -364,8 +371,17 @@ const invalidTestCases = (property: string) => {
|
|
|
364
371
|
${property}Bottom: token('space.300'),
|
|
365
372
|
${property}Left: token('space.400'),
|
|
366
373
|
});
|
|
374
|
+
const styles2 = css({
|
|
375
|
+
paddingBottom: token('space.050', '4px'),
|
|
376
|
+
'&& > span': {
|
|
377
|
+
paddingTop: token('space.100', '8px'),
|
|
378
|
+
paddingRight: token('space.150', '12px'),
|
|
379
|
+
paddingBottom: '7px',
|
|
380
|
+
paddingLeft: token('space.150', '12px'),
|
|
381
|
+
},
|
|
382
|
+
});
|
|
367
383
|
`,
|
|
368
|
-
errors:
|
|
384
|
+
errors: Array.from(Array(2), () => ({ messageId: 'expandSpacingShorthand' })),
|
|
369
385
|
},
|
|
370
386
|
// TODO (AFB-1022): Resolve this failing test
|
|
371
387
|
// {
|
|
@@ -32,9 +32,12 @@ const parseTemplateLiteral = (templateLiteral: TemplateLiteral, context: Rule.Ru
|
|
|
32
32
|
if (i < quasis.length) {
|
|
33
33
|
const cookedQuasi = quasis[i].value.cooked;
|
|
34
34
|
if (cookedQuasi) {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
const splitQuasis = cookedQuasi.split(' ');
|
|
36
|
+
splitQuasis.forEach((str) => {
|
|
37
|
+
str = str.trim().replace("'", '');
|
|
38
|
+
if (str.length > 0) {
|
|
39
|
+
propertyValues.push(isNaN(Number(str)) ? `'${str}'` : str);
|
|
40
|
+
}
|
|
38
41
|
});
|
|
39
42
|
}
|
|
40
43
|
}
|