@atlaskit/eslint-plugin-ui-styling-standard 0.3.0 → 0.4.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +18 -5
  3. package/build/tsconfig.json +2 -4
  4. package/constellation/consistent-css-prop-usage/usage.mdx +5 -0
  5. package/constellation/index/overview.mdx +29 -11
  6. package/constellation/local-cx-xcss/usage.mdx +37 -0
  7. package/constellation/no-css-tagged-template-expression/usage.mdx +5 -0
  8. package/constellation/no-empty-styled-expression/usage.mdx +5 -0
  9. package/constellation/no-exported-css/usage.mdx +5 -0
  10. package/constellation/no-exported-keyframes/usage.mdx +5 -0
  11. package/constellation/no-invalid-css-map/usage.mdx +5 -0
  12. package/constellation/no-js-xcss/usage.mdx +5 -0
  13. package/constellation/no-keyframes-tagged-template-expression/usage.mdx +5 -0
  14. package/constellation/no-styled-tagged-template-expression/usage.mdx +5 -0
  15. package/constellation/no-suppress-xcss/usage.mdx +25 -0
  16. package/dist/cjs/index.codegen.js +26 -0
  17. package/dist/cjs/index.js +12 -33
  18. package/dist/cjs/presets/all.codegen.js +39 -0
  19. package/dist/cjs/presets/recommended.codegen.js +39 -0
  20. package/dist/cjs/rules/external-rules.js +169 -0
  21. package/dist/cjs/rules/index.codegen.js +16 -0
  22. package/dist/cjs/rules/local-cx-xcss/index.js +51 -0
  23. package/dist/cjs/rules/utils/create-rule.js +43 -0
  24. package/dist/cjs/rules/utils/is-supported-import.js +98 -0
  25. package/dist/es2019/index.codegen.js +12 -0
  26. package/dist/es2019/index.js +1 -33
  27. package/dist/es2019/presets/all.codegen.js +33 -0
  28. package/dist/es2019/presets/recommended.codegen.js +33 -0
  29. package/dist/es2019/rules/external-rules.js +164 -0
  30. package/dist/es2019/rules/index.codegen.js +9 -0
  31. package/dist/es2019/rules/local-cx-xcss/index.js +45 -0
  32. package/dist/es2019/rules/utils/create-rule.js +33 -0
  33. package/dist/es2019/rules/utils/is-supported-import.js +87 -0
  34. package/dist/esm/index.codegen.js +12 -0
  35. package/dist/esm/index.js +1 -33
  36. package/dist/esm/presets/all.codegen.js +33 -0
  37. package/dist/esm/presets/recommended.codegen.js +33 -0
  38. package/dist/esm/rules/external-rules.js +164 -0
  39. package/dist/esm/rules/index.codegen.js +9 -0
  40. package/dist/esm/rules/local-cx-xcss/index.js +45 -0
  41. package/dist/esm/rules/utils/create-rule.js +35 -0
  42. package/dist/esm/rules/utils/is-supported-import.js +90 -0
  43. package/dist/types/index.codegen.d.ts +59 -0
  44. package/dist/types/index.d.ts +1 -0
  45. package/dist/types/presets/all.codegen.d.ts +34 -0
  46. package/dist/types/presets/recommended.codegen.d.ts +34 -0
  47. package/dist/types/rules/external-rules.d.ts +11 -0
  48. package/dist/types/rules/index.codegen.d.ts +4 -0
  49. package/dist/types/rules/local-cx-xcss/index.d.ts +3 -0
  50. package/dist/types/rules/utils/create-rule.d.ts +64 -0
  51. package/dist/types/rules/utils/is-supported-import.d.ts +34 -0
  52. package/dist/types-ts4.5/index.codegen.d.ts +59 -0
  53. package/dist/types-ts4.5/index.d.ts +1 -0
  54. package/dist/types-ts4.5/presets/all.codegen.d.ts +34 -0
  55. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +34 -0
  56. package/dist/types-ts4.5/rules/external-rules.d.ts +11 -0
  57. package/dist/types-ts4.5/rules/index.codegen.d.ts +4 -0
  58. package/dist/types-ts4.5/rules/local-cx-xcss/index.d.ts +3 -0
  59. package/dist/types-ts4.5/rules/utils/create-rule.d.ts +64 -0
  60. package/dist/types-ts4.5/rules/utils/is-supported-import.d.ts +34 -0
  61. package/package.json +13 -4
  62. package/scripts/codegen.tsx +439 -0
  63. package/src/index.codegen.tsx +14 -0
  64. package/src/index.tsx +1 -51
  65. package/src/presets/all.codegen.tsx +78 -0
  66. package/src/presets/recommended.codegen.tsx +78 -0
  67. package/src/rules/TEMPLATE.md +29 -0
  68. package/src/rules/__tests__/utils/_tester.tsx +40 -0
  69. package/src/rules/external-rules.tsx +205 -0
  70. package/src/rules/index.codegen.tsx +10 -0
  71. package/src/rules/local-cx-xcss/README.md +35 -0
  72. package/src/rules/local-cx-xcss/__tests__/rule.test.tsx +102 -0
  73. package/src/rules/local-cx-xcss/index.tsx +69 -0
  74. package/src/rules/utils/create-rule.tsx +80 -0
  75. package/src/rules/utils/is-supported-import.tsx +130 -0
  76. package/tsconfig.app.json +5 -1
  77. package/tsconfig.dev.json +5 -1
  78. package/tsconfig.json +7 -6
  79. package/dist/types/src/index.d.ts +0 -29
  80. package/dist/types-ts4.5/src/index.d.ts +0 -29
@@ -0,0 +1,439 @@
1
+ import { existsSync } from 'fs';
2
+ import fs from 'fs/promises';
3
+ import { extname, join, relative } from 'path';
4
+
5
+ import camelCase from 'lodash/camelCase';
6
+ import outdent from 'outdent';
7
+ import { format, resolveConfig } from 'prettier';
8
+
9
+ import { createSignedArtifact } from '@atlassian/codegen';
10
+
11
+ import { type LintRule, getPathSafeName } from '../src/rules/utils/create-rule';
12
+ import {
13
+ externalRules,
14
+ type ExternalRuleMeta,
15
+ } from '../src/rules/external-rules';
16
+
17
+ const packagePluginName = '@atlaskit/eslint-plugin-ui-styling-standard';
18
+ const pluginName = packagePluginName.replace('/eslint-plugin-', '/');
19
+ const codegenCommand = `yarn workspace ${packagePluginName} codegen`;
20
+
21
+ interface FoundRule {
22
+ module: LintRule | { meta: ExternalRuleMeta };
23
+ /**
24
+ * This is used for the directory name, import path, and urls
25
+ */
26
+ pathSafeName: string;
27
+ /**
28
+ * Friendly name that can include special characters
29
+ */
30
+ ruleName: string;
31
+ }
32
+
33
+ /**
34
+ * A rule that is externally referenced and distributed via dependencies rather than local.
35
+ * These come from `rules/external-rules.tsx`
36
+ */
37
+ interface ExternalRule extends FoundRule {
38
+ module: { meta: ExternalRuleMeta };
39
+ }
40
+ interface InternalRule extends FoundRule {
41
+ module: LintRule;
42
+ }
43
+
44
+ interface GeneratedConfig {
45
+ name: string;
46
+ path: string;
47
+ }
48
+
49
+ const ignoreList = [
50
+ 'index.codegen.tsx',
51
+ 'TEMPLATE.md',
52
+ '__tests__',
53
+ 'utils',
54
+ 'external-rules.tsx',
55
+ ];
56
+ const srcDir = join(__dirname, '../src');
57
+ const rulesDir = join(srcDir, 'rules');
58
+ const presetsDir = join(srcDir, 'presets');
59
+ const generatedConfigs: GeneratedConfig[] = [];
60
+
61
+ function ruleIsExternal(rule: FoundRule | ExternalRule): rule is ExternalRule {
62
+ return 'isExternal' in rule.module.meta && !!rule.module.meta.isExternal;
63
+ }
64
+ function ruleIsInternal(rule: FoundRule | ExternalRule): rule is InternalRule {
65
+ return !ruleIsExternal(rule);
66
+ }
67
+
68
+ /**
69
+ * Get the path to, and file contents for, a rule's README.md file.
70
+ */
71
+ async function ruleDocsPath(name: string) {
72
+ const absolutePath = join(rulesDir, name, 'README.md');
73
+ const relativePath = '.' + absolutePath.replace(process.cwd(), '');
74
+
75
+ try {
76
+ const file = await fs.readFile(absolutePath, 'utf-8');
77
+ return { path: relativePath, file };
78
+ } catch (_) {
79
+ throw new Error(
80
+ `invariant: rule ${name} should have docs at ${absolutePath}`,
81
+ );
82
+ }
83
+ }
84
+
85
+ /**
86
+ * Generates the preset config, eg. `src/presets/all.codegen.tsx` and `src/presets/recommended.codegen.tsx`
87
+ */
88
+ async function generatePresetConfig(
89
+ name: 'all' | 'recommended',
90
+ rules: FoundRule[],
91
+ ) {
92
+ const externalScopes = externalRules
93
+ .filter((rule) => rule.name?.includes('/'))
94
+ .map((rule) => {
95
+ // Take the first part of the name, eg. `@atlaskit/design-system` and wrap it in quotes to be
96
+ const groups = rule.name.split('/');
97
+ return `'${groups.slice(0, groups.length - 1).join('/')}'`;
98
+ });
99
+
100
+ // NOTE: Given we have external plugins, we must include them as plugins as well./
101
+ const pluginList = [
102
+ `'${pluginName}'`,
103
+ ...Array.from(new Set(externalScopes)),
104
+ ];
105
+
106
+ const code = outdent`
107
+ export default {
108
+ plugins: [
109
+ ${pluginList.join(',\n')}],
110
+ rules: {
111
+ ${rules
112
+ .map((rule) => {
113
+ const { severity, recommended, pluginConfig } =
114
+ rule.module.meta?.docs || {};
115
+
116
+ // `recommended` is a snowflake at this stage ... it can be a string at runtime
117
+ // because of legacy `import { createRule } from 'utils/create-rule'` so we take
118
+ // into account this possibility (as a fallback) until everything is moved over
119
+ // to the new syntax
120
+ const calculatedSeverity =
121
+ severity ??
122
+ (typeof recommended === 'string' ? String(recommended) : 'error');
123
+
124
+ let ruleName = rule.ruleName;
125
+ if (ruleIsInternal(rule)) {
126
+ ruleName = `${pluginName}/${rule.ruleName}`;
127
+ }
128
+
129
+ if (typeof pluginConfig === 'object' && pluginConfig) {
130
+ return `'${ruleName}': ['${calculatedSeverity}', ${JSON.stringify(
131
+ pluginConfig,
132
+ )}]`;
133
+ }
134
+
135
+ return `'${ruleName}': '${calculatedSeverity}'`;
136
+ })
137
+ .join(',')}
138
+ },
139
+ }
140
+ `;
141
+
142
+ const filepath = join(presetsDir, `${name}.codegen.tsx`);
143
+ await writeFile(filepath, code);
144
+
145
+ generatedConfigs.push({
146
+ name: camelCase(name),
147
+ path: './' + relative(srcDir, join(presetsDir, `${name}.codegen`)),
148
+ });
149
+ }
150
+
151
+ /**
152
+ * Write contents to a given file, creating a signed artifact if it's not a markdown file.
153
+ */
154
+ async function writeFile(filepath: string, code: string) {
155
+ const config = await resolveConfig(filepath);
156
+ await fs.writeFile(
157
+ filepath,
158
+ extname(filepath).includes('.md')
159
+ ? format(code, {
160
+ ...config,
161
+ filepath,
162
+ })
163
+ : createSignedArtifact(
164
+ format(code, {
165
+ ...config,
166
+ filepath,
167
+ }),
168
+ codegenCommand,
169
+ ),
170
+ );
171
+ }
172
+
173
+ /**
174
+ * Generates the `src/rules/index.codegen.tsx` entrypoint, exporting all rules.
175
+ */
176
+ async function generateRuleIndex(rules: FoundRule[]) {
177
+ const internalRules = rules.filter(ruleIsInternal);
178
+
179
+ const code = outdent`
180
+ ${internalRules
181
+ .map(
182
+ (rule) =>
183
+ `import ${camelCase(rule.pathSafeName)} from './${
184
+ rule.pathSafeName
185
+ }'`,
186
+ )
187
+ .join('\n')}
188
+
189
+ export default {
190
+ ${internalRules
191
+ .map((rule) => `'${rule.ruleName}': ${camelCase(rule.pathSafeName)}`)
192
+ .join(',')}
193
+ }
194
+ `;
195
+
196
+ const filepath = join(rulesDir, 'index.codegen.tsx');
197
+ await writeFile(filepath, code);
198
+ }
199
+
200
+ /**
201
+ * Generates the `src/index.codegen.tsx` entrypoint, exporting all the preset configs.
202
+ */
203
+ async function generatePluginIndex() {
204
+ const code = outdent`
205
+ ${generatedConfigs
206
+ .map((config) => `import ${config.name} from '${config.path}'`)
207
+ .join('\n')}
208
+
209
+ export { default as rules } from './rules/index.codegen'
210
+
211
+ export const configs = {
212
+ ${generatedConfigs.map((config) => `${config.name}`).join(',')}
213
+ }
214
+ `;
215
+
216
+ const filepath = join(srcDir, 'index.codegen.tsx');
217
+ await writeFile(filepath, code);
218
+ }
219
+
220
+ const conditional = (cond: string, content?: boolean | string) =>
221
+ content ? cond : '';
222
+ const optionallyLinkTo = (content: string, url?: string) =>
223
+ url ? `<a href="${url}">${content}</a>` : content;
224
+
225
+ /**
226
+ * Generate each individual rules' documentation pages, eg. `constellation/icon-label/usage.mdx`
227
+ */
228
+ async function generateRulePages(rules: FoundRule[]): Promise<void> {
229
+ const docsDir = join(srcDir, '../constellation');
230
+
231
+ for await (const rule of rules) {
232
+ const ruleDir = join(docsDir, rule.pathSafeName);
233
+ const destination = join(ruleDir, 'usage.mdx');
234
+ await fs.mkdir(ruleDir, { recursive: true });
235
+
236
+ if (ruleIsExternal(rule)) {
237
+ await generateExternalRulePage(rule, destination);
238
+ } else if (ruleIsInternal(rule)) {
239
+ await generateInternalRulePage(rule, destination);
240
+ } else {
241
+ throw new Error(
242
+ `invariant: found an unexpected rule type ${rule.ruleName}`,
243
+ );
244
+ }
245
+ }
246
+ }
247
+
248
+ async function generateExternalRulePage(
249
+ rule: ExternalRule,
250
+ destination: string,
251
+ ) {
252
+ if (existsSync(destination)) {
253
+ return true;
254
+ }
255
+
256
+ const ruleContent = outdent`
257
+ # ${rule.ruleName}
258
+ ${rule.module.meta?.docs?.description || ''}
259
+
260
+ ${
261
+ rule.module.meta?.docs?.externalUrl
262
+ ? `This rule is maintained by another package and configured here; refer to ${rule.module.meta.docs.externalUrl} for more details.`
263
+ : ''
264
+ }
265
+ `;
266
+
267
+ await writeFile(destination, ruleContent);
268
+ }
269
+
270
+ async function generateInternalRulePage(
271
+ rule: InternalRule,
272
+ destination: string,
273
+ ) {
274
+ const { file } = await ruleDocsPath(rule.pathSafeName);
275
+ if (file.match(/^# /)) {
276
+ throw new Error(
277
+ `invariant: ${rule.pathSafeName} README doc should not include a h1 heading as it is injected automatically.`,
278
+ );
279
+ }
280
+
281
+ const ruleContent = outdent`
282
+ # ${rule.ruleName}
283
+ ${file}
284
+ `;
285
+
286
+ await writeFile(destination, ruleContent);
287
+ }
288
+
289
+ /**
290
+ * Generates the `RULE_TABLE_CODEGEN` in `constellation/index/usage.mdx` and `README.md`.
291
+ * This is the list of all rules and their metadata.
292
+ */
293
+ async function generateRuleTable(
294
+ filepath: string,
295
+ linkTo: 'docs' | 'repo',
296
+ rules: FoundRule[],
297
+ ) {
298
+ const file = await fs.readFile(filepath, 'utf-8');
299
+ const rows: string[] = [];
300
+
301
+ for (const rule of rules) {
302
+ let docsPath: string | undefined;
303
+
304
+ if (linkTo === 'docs') {
305
+ // We want `<a href="consistent-css-prop-usage/usage">consistent-css-prop-usage</a>` for the link
306
+ // to resolve to `/components/eslint-plugin-design-system/consistent-css-prop-usage/usage`
307
+ docsPath = `${rule.pathSafeName}/usage`;
308
+ } else if (ruleIsInternal(rule)) {
309
+ const result = await ruleDocsPath(rule.pathSafeName);
310
+ docsPath = result.path;
311
+ } else {
312
+ docsPath = rule.module.meta?.docs?.url;
313
+ }
314
+
315
+ const link = optionallyLinkTo(rule.ruleName, docsPath);
316
+ const description = rule.module.meta?.docs?.description || '';
317
+ const recommended = conditional('Yes', rule.module.meta?.docs?.recommended);
318
+ const fixable = conditional('Yes', rule.module.meta?.fixable);
319
+ const suggestions = conditional('Yes', rule.module.meta?.hasSuggestions);
320
+
321
+ rows.push(outdent`
322
+ | ${link} | ${description} | ${recommended} | ${fixable} | ${suggestions} |
323
+ `);
324
+ }
325
+
326
+ const code = outdent`
327
+ | Rule | Description | Recommended | Fixable | Suggestions |
328
+ | ---- | -- | -- | -- | -- |
329
+ ${rows.join('\n')}
330
+ `;
331
+
332
+ const found =
333
+ /<!-- START_RULE_TABLE_CODEGEN -->(.|\n)*<!-- END_RULE_TABLE_CODEGEN -->/.exec(
334
+ file,
335
+ );
336
+
337
+ if (!found) {
338
+ throw new Error(
339
+ `invariant: could not find the partial codegen section in ${filepath}`,
340
+ );
341
+ }
342
+
343
+ const updatedFile = file.replace(
344
+ found[0],
345
+ outdent`
346
+ <!-- START_RULE_TABLE_CODEGEN -->
347
+ <!-- @codegenCommand ${codegenCommand} -->
348
+ ${code}
349
+ <!-- END_RULE_TABLE_CODEGEN -->
350
+ `,
351
+ );
352
+
353
+ await writeFile(filepath, updatedFile);
354
+ }
355
+
356
+ const validateInternalRule = (rule: InternalRule) => {
357
+ if (typeof rule.ruleName !== 'string' || !rule.ruleName) {
358
+ throw new Error(
359
+ `invariant: The ${rule.pathSafeName} rule must use the createLintRule() function`,
360
+ );
361
+ }
362
+
363
+ if (ruleIsInternal(rule) && rule.pathSafeName !== rule.ruleName) {
364
+ throw new Error(
365
+ `invariant: module name ${rule.pathSafeName} does not match lint rule name ${rule.ruleName}`,
366
+ );
367
+ }
368
+
369
+ if (rule.pathSafeName.includes('@') || rule.pathSafeName.includes('/')) {
370
+ throw new Error(
371
+ `invariant: name ${rule.pathSafeName} is not valid, specify a path-safe name`,
372
+ );
373
+ }
374
+ };
375
+
376
+ /**
377
+ * Fetch all rules in `rules/*` and generate all associated contents.
378
+ */
379
+ async function generate() {
380
+ const rulePaths = await fs.readdir(rulesDir);
381
+ const recommended: FoundRule[] = [];
382
+ const rules: FoundRule[] = [];
383
+
384
+ for (const filename of rulePaths) {
385
+ if (ignoreList.includes(filename)) {
386
+ continue;
387
+ }
388
+
389
+ const dirname = filename.replace(extname(filename), '');
390
+ const filenameWithExt = filename.endsWith('.tsx')
391
+ ? filename + '.tsx'
392
+ : filename;
393
+
394
+ const rule: LintRule = (await import(join(rulesDir, filenameWithExt)))
395
+ .default;
396
+
397
+ const foundRule: InternalRule = {
398
+ module: rule,
399
+ pathSafeName: dirname,
400
+ ruleName: rule.name || rule.meta.name,
401
+ };
402
+
403
+ validateInternalRule(foundRule);
404
+
405
+ rules.push(foundRule);
406
+ }
407
+
408
+ for (const rule of externalRules) {
409
+ const foundRule: ExternalRule = {
410
+ module: { meta: rule },
411
+ pathSafeName: rule.displayName || getPathSafeName(rule.name),
412
+ ruleName: rule.name,
413
+ };
414
+
415
+ // We don't validate these; types should do their job instead.
416
+ rules.push(foundRule);
417
+ }
418
+
419
+ rules.forEach((rule) => {
420
+ if (rule.module.meta?.docs?.recommended) {
421
+ recommended.push(rule);
422
+ }
423
+ });
424
+
425
+ // NOTE: Some of these could be awaited in parallel, but it's not worth the complexity for <1s diff.
426
+ await generateRuleIndex(rules);
427
+ await generatePresetConfig('all', rules);
428
+ await generatePresetConfig('recommended', recommended);
429
+ await generatePluginIndex();
430
+ await generateRulePages(rules);
431
+ await generateRuleTable(join(srcDir, '../README.md'), 'repo', rules);
432
+ await generateRuleTable(
433
+ join(srcDir, '../constellation/index/overview.mdx'),
434
+ 'docs',
435
+ rules,
436
+ );
437
+ }
438
+
439
+ generate();
@@ -0,0 +1,14 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ * @codegen <<SignedSource::3fd41935576c9346ca1f1e0c787a0a48>>
4
+ * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
+ */
6
+ import all from './presets/all.codegen';
7
+ import recommended from './presets/recommended.codegen';
8
+
9
+ export { default as rules } from './rules/index.codegen';
10
+
11
+ export const configs = {
12
+ all,
13
+ recommended,
14
+ };
package/src/index.tsx CHANGED
@@ -1,51 +1 @@
1
- export const rules = {};
2
-
3
- const importSources: readonly string[] = [
4
- '@compiled/react',
5
- '@atlaskit/css',
6
- '@emotion/core',
7
- '@emotion/styled',
8
- 'styled-components',
9
- ];
10
-
11
- export const configs = {
12
- recommended: {
13
- plugins: [
14
- '@atlaskit/ui-styling-standard',
15
- '@atlaskit/design-system',
16
- '@compiled',
17
- ],
18
- rules: {
19
- '@atlaskit/design-system/consistent-css-prop-usage': [
20
- 'warn',
21
- {
22
- // When passing a css prop to a React component, we don't know whether the component
23
- // is Emotion or Compiled. Hence it is not safe to run autofixes like wrapping it in
24
- // a `css` function call.
25
- excludeReactComponents: true,
26
- },
27
- ],
28
- '@atlaskit/design-system/local-cx-xcss': 'warn',
29
- '@atlaskit/design-system/no-css-tagged-template-expression': 'warn',
30
- '@atlaskit/design-system/no-keyframes-tagged-template-expression': 'warn',
31
- '@atlaskit/design-system/no-styled-tagged-template-expression': 'warn',
32
- '@compiled/no-suppress-xcss': 'error',
33
- '@compiled/no-js-xcss': 'error',
34
- '@atlaskit/design-system/no-empty-styled-expression': [
35
- 'warn',
36
- { importSources },
37
- ],
38
- '@atlaskit/design-system/no-exported-css': ['warn', { importSources }],
39
- '@atlaskit/design-system/no-exported-keyframes': [
40
- 'warn',
41
- { importSources },
42
- ],
43
- '@atlaskit/design-system/no-invalid-css-map': [
44
- 'warn',
45
- {
46
- allowedFunctionCalls: [['@atlaskit/tokens', 'token']],
47
- },
48
- ],
49
- },
50
- },
51
- };
1
+ export { configs, rules } from './index.codegen';
@@ -0,0 +1,78 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ * @codegen <<SignedSource::9869b1757ca915f74b471fe04f72e5ea>>
4
+ * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
+ */
6
+ export default {
7
+ plugins: [
8
+ '@atlaskit/ui-styling-standard',
9
+ '@atlaskit/design-system',
10
+ '@compiled',
11
+ ],
12
+ rules: {
13
+ '@atlaskit/ui-styling-standard/local-cx-xcss': 'warn',
14
+ '@atlaskit/design-system/consistent-css-prop-usage': [
15
+ 'warn',
16
+ { excludeReactComponents: true },
17
+ ],
18
+ '@atlaskit/design-system/no-css-tagged-template-expression': 'warn',
19
+ '@atlaskit/design-system/no-keyframes-tagged-template-expression': 'warn',
20
+ '@atlaskit/design-system/no-styled-tagged-template-expression': [
21
+ 'warn',
22
+ {
23
+ importSources: [
24
+ '@compiled/react',
25
+ '@atlaskit/css',
26
+ '@emotion/core',
27
+ '@emotion/react',
28
+ '@emotion/styled',
29
+ ],
30
+ },
31
+ ],
32
+ '@compiled/no-suppress-xcss': 'warn',
33
+ '@compiled/no-js-xcss': 'warn',
34
+ '@atlaskit/design-system/no-empty-styled-expression': [
35
+ 'warn',
36
+ {
37
+ importSources: [
38
+ '@compiled/react',
39
+ '@atlaskit/css',
40
+ '@emotion/core',
41
+ '@emotion/react',
42
+ '@emotion/styled',
43
+ 'styled-components',
44
+ ],
45
+ },
46
+ ],
47
+ '@atlaskit/design-system/no-exported-css': [
48
+ 'warn',
49
+ {
50
+ importSources: [
51
+ '@compiled/react',
52
+ '@atlaskit/css',
53
+ '@emotion/core',
54
+ '@emotion/react',
55
+ '@emotion/styled',
56
+ 'styled-components',
57
+ ],
58
+ },
59
+ ],
60
+ '@atlaskit/design-system/no-exported-keyframes': [
61
+ 'warn',
62
+ {
63
+ importSources: [
64
+ '@compiled/react',
65
+ '@atlaskit/css',
66
+ '@emotion/core',
67
+ '@emotion/react',
68
+ '@emotion/styled',
69
+ 'styled-components',
70
+ ],
71
+ },
72
+ ],
73
+ '@atlaskit/design-system/no-invalid-css-map': [
74
+ 'warn',
75
+ { allowedFunctionCalls: [['@atlaskit/tokens', 'token']] },
76
+ ],
77
+ },
78
+ };
@@ -0,0 +1,78 @@
1
+ /**
2
+ * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
+ * @codegen <<SignedSource::9869b1757ca915f74b471fe04f72e5ea>>
4
+ * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
+ */
6
+ export default {
7
+ plugins: [
8
+ '@atlaskit/ui-styling-standard',
9
+ '@atlaskit/design-system',
10
+ '@compiled',
11
+ ],
12
+ rules: {
13
+ '@atlaskit/ui-styling-standard/local-cx-xcss': 'warn',
14
+ '@atlaskit/design-system/consistent-css-prop-usage': [
15
+ 'warn',
16
+ { excludeReactComponents: true },
17
+ ],
18
+ '@atlaskit/design-system/no-css-tagged-template-expression': 'warn',
19
+ '@atlaskit/design-system/no-keyframes-tagged-template-expression': 'warn',
20
+ '@atlaskit/design-system/no-styled-tagged-template-expression': [
21
+ 'warn',
22
+ {
23
+ importSources: [
24
+ '@compiled/react',
25
+ '@atlaskit/css',
26
+ '@emotion/core',
27
+ '@emotion/react',
28
+ '@emotion/styled',
29
+ ],
30
+ },
31
+ ],
32
+ '@compiled/no-suppress-xcss': 'warn',
33
+ '@compiled/no-js-xcss': 'warn',
34
+ '@atlaskit/design-system/no-empty-styled-expression': [
35
+ 'warn',
36
+ {
37
+ importSources: [
38
+ '@compiled/react',
39
+ '@atlaskit/css',
40
+ '@emotion/core',
41
+ '@emotion/react',
42
+ '@emotion/styled',
43
+ 'styled-components',
44
+ ],
45
+ },
46
+ ],
47
+ '@atlaskit/design-system/no-exported-css': [
48
+ 'warn',
49
+ {
50
+ importSources: [
51
+ '@compiled/react',
52
+ '@atlaskit/css',
53
+ '@emotion/core',
54
+ '@emotion/react',
55
+ '@emotion/styled',
56
+ 'styled-components',
57
+ ],
58
+ },
59
+ ],
60
+ '@atlaskit/design-system/no-exported-keyframes': [
61
+ 'warn',
62
+ {
63
+ importSources: [
64
+ '@compiled/react',
65
+ '@atlaskit/css',
66
+ '@emotion/core',
67
+ '@emotion/react',
68
+ '@emotion/styled',
69
+ 'styled-components',
70
+ ],
71
+ },
72
+ ],
73
+ '@atlaskit/design-system/no-invalid-css-map': [
74
+ 'warn',
75
+ { allowedFunctionCalls: [['@atlaskit/tokens', 'token']] },
76
+ ],
77
+ },
78
+ };
@@ -0,0 +1,29 @@
1
+ <!-- To fill out -- tell us why this rule exists and any relevant context. -->
2
+
3
+ ## Examples
4
+
5
+ <!-- To fill out -- tell us when this rule will mark violations. -->
6
+
7
+ ### Incorrect
8
+
9
+ ```tsx
10
+ // To fill out: incorrect code
11
+ // Have one code block for all incorrect examples
12
+ ```
13
+
14
+ ### Correct
15
+
16
+ ```tsx
17
+ // To fill out: correct code
18
+ // Have one code block for all correct examples
19
+ ```
20
+
21
+ ## Options
22
+
23
+ <!-- To fill out -- delete section if rule doesn't take any options. -->
24
+
25
+ This rule accepts...
26
+
27
+ ## When not to use it
28
+
29
+ <!-- To fill out -- delete section if this should should always be used. -->