@atlaskit/eslint-plugin-ui-styling-standard 0.18.0 → 0.18.2

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 (140) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/rules/no-imported-style-values/index.js +36 -5
  3. package/dist/es2019/rules/no-imported-style-values/index.js +36 -5
  4. package/dist/esm/rules/no-imported-style-values/index.js +36 -5
  5. package/package.json +1 -1
  6. package/afm-cc/tsconfig.json +0 -28
  7. package/afm-jira/tsconfig.json +0 -27
  8. package/build/tsconfig.json +0 -18
  9. package/constellation/atlaskit-theme/usage.mdx +0 -132
  10. package/constellation/consistent-css-prop-usage/usage.mdx +0 -7
  11. package/constellation/convert-props-syntax/usage.mdx +0 -130
  12. package/constellation/enforce-style-prop/usage.mdx +0 -47
  13. package/constellation/index/migration-guide.mdx +0 -309
  14. package/constellation/index/overview.mdx +0 -250
  15. package/constellation/index/props.mdx +0 -30
  16. package/constellation/local-cx-xcss/usage.mdx +0 -53
  17. package/constellation/no-array-arguments/usage.mdx +0 -49
  18. package/constellation/no-classname-prop/usage.mdx +0 -49
  19. package/constellation/no-container-queries/usage.mdx +0 -101
  20. package/constellation/no-css-tagged-template-expression/usage.mdx +0 -8
  21. package/constellation/no-dynamic-styles/usage.mdx +0 -130
  22. package/constellation/no-empty-styled-expression/usage.mdx +0 -8
  23. package/constellation/no-exported-css/usage.mdx +0 -8
  24. package/constellation/no-exported-keyframes/usage.mdx +0 -8
  25. package/constellation/no-exported-styles/usage.mdx +0 -87
  26. package/constellation/no-global-styles/usage.mdx +0 -60
  27. package/constellation/no-important-styles/usage.mdx +0 -33
  28. package/constellation/no-imported-style-values/usage.mdx +0 -157
  29. package/constellation/no-invalid-css-map/usage.mdx +0 -8
  30. package/constellation/no-js-xcss/usage.mdx +0 -7
  31. package/constellation/no-keyframes-tagged-template-expression/usage.mdx +0 -8
  32. package/constellation/no-nested-selectors/usage.mdx +0 -95
  33. package/constellation/no-styled/usage.mdx +0 -92
  34. package/constellation/no-styled-tagged-template-expression/usage.mdx +0 -8
  35. package/constellation/no-suppress-xcss/usage.mdx +0 -28
  36. package/constellation/no-unsafe-selectors/usage.mdx +0 -370
  37. package/constellation/no-unsafe-values/usage.mdx +0 -318
  38. package/constellation/use-compiled/usage.mdx +0 -54
  39. package/index.js +0 -24
  40. package/scripts/codegen.tsx +0 -373
  41. package/src/index.codegen.tsx +0 -14
  42. package/src/index.tsx +0 -1
  43. package/src/presets/all.codegen.tsx +0 -79
  44. package/src/presets/recommended.codegen.tsx +0 -79
  45. package/src/rules/TEMPLATE.md +0 -29
  46. package/src/rules/__tests__/utils/_tester.tsx +0 -40
  47. package/src/rules/atlaskit-theme/README.md +0 -130
  48. package/src/rules/atlaskit-theme/__tests__/test.ts +0 -133
  49. package/src/rules/atlaskit-theme/index.ts +0 -134
  50. package/src/rules/convert-props-syntax/README.md +0 -128
  51. package/src/rules/convert-props-syntax/__tests__/invalid.test.tsx +0 -76
  52. package/src/rules/convert-props-syntax/__tests__/rule.test.tsx +0 -584
  53. package/src/rules/convert-props-syntax/__tests__/type-annotations.test.tsx +0 -140
  54. package/src/rules/convert-props-syntax/__tests__/unusual-properties.test.tsx +0 -69
  55. package/src/rules/convert-props-syntax/index.tsx +0 -414
  56. package/src/rules/enforce-style-prop/README.md +0 -45
  57. package/src/rules/enforce-style-prop/__tests__/rule.test.tsx +0 -243
  58. package/src/rules/enforce-style-prop/index.tsx +0 -172
  59. package/src/rules/external-rules.tsx +0 -177
  60. package/src/rules/index.codegen.tsx +0 -42
  61. package/src/rules/local-cx-xcss/README.md +0 -51
  62. package/src/rules/local-cx-xcss/__tests__/rule.test.tsx +0 -102
  63. package/src/rules/local-cx-xcss/index.tsx +0 -62
  64. package/src/rules/no-array-arguments/README.md +0 -47
  65. package/src/rules/no-array-arguments/__tests__/rule.test.tsx +0 -107
  66. package/src/rules/no-array-arguments/index.tsx +0 -86
  67. package/src/rules/no-classname-prop/README.md +0 -47
  68. package/src/rules/no-classname-prop/__tests__/rule.test.tsx +0 -39
  69. package/src/rules/no-classname-prop/index.tsx +0 -34
  70. package/src/rules/no-container-queries/README.md +0 -99
  71. package/src/rules/no-container-queries/__tests__/rule.test.tsx +0 -139
  72. package/src/rules/no-container-queries/index.tsx +0 -94
  73. package/src/rules/no-dynamic-styles/README.md +0 -128
  74. package/src/rules/no-dynamic-styles/__tests__/rule.test.tsx +0 -135
  75. package/src/rules/no-dynamic-styles/index.tsx +0 -60
  76. package/src/rules/no-exported-styles/README.md +0 -85
  77. package/src/rules/no-exported-styles/__tests__/rule.test.tsx +0 -216
  78. package/src/rules/no-exported-styles/index.tsx +0 -52
  79. package/src/rules/no-global-styles/README.md +0 -58
  80. package/src/rules/no-global-styles/__tests__/no-css-modules.test.tsx +0 -33
  81. package/src/rules/no-global-styles/__tests__/no-global-styles.test.tsx +0 -46
  82. package/src/rules/no-global-styles/index.tsx +0 -82
  83. package/src/rules/no-important-styles/README.md +0 -31
  84. package/src/rules/no-important-styles/__tests__/rule.test.tsx +0 -165
  85. package/src/rules/no-important-styles/index.tsx +0 -70
  86. package/src/rules/no-imported-style-values/README.md +0 -155
  87. package/src/rules/no-imported-style-values/__tests__/rule.test.tsx +0 -491
  88. package/src/rules/no-imported-style-values/index.tsx +0 -188
  89. package/src/rules/no-nested-selectors/README.md +0 -93
  90. package/src/rules/no-nested-selectors/__tests__/rule.test.tsx +0 -335
  91. package/src/rules/no-nested-selectors/index.tsx +0 -99
  92. package/src/rules/no-styled/README.md +0 -90
  93. package/src/rules/no-styled/__tests__/rule.test.tsx +0 -73
  94. package/src/rules/no-styled/index.tsx +0 -45
  95. package/src/rules/no-unsafe-selectors/README.md +0 -368
  96. package/src/rules/no-unsafe-selectors/__tests__/no-ambiguous-pseudos.test.tsx +0 -368
  97. package/src/rules/no-unsafe-selectors/__tests__/no-grouped-at-rules.test.tsx +0 -57
  98. package/src/rules/no-unsafe-selectors/__tests__/no-increased-specificity.test.tsx +0 -73
  99. package/src/rules/no-unsafe-selectors/__tests__/no-keyframes-at-rules.test.tsx +0 -40
  100. package/src/rules/no-unsafe-selectors/__tests__/no-legacy-pseudo-element-syntax.test.tsx +0 -101
  101. package/src/rules/no-unsafe-selectors/__tests__/no-restricted-at-rules.test.tsx +0 -131
  102. package/src/rules/no-unsafe-selectors/__tests__/no-restricted-pseudos.test.tsx +0 -132
  103. package/src/rules/no-unsafe-selectors/__tests__/no-selectors-object.test.tsx +0 -25
  104. package/src/rules/no-unsafe-selectors/__tests__/no-unparsable-selectors.test.tsx +0 -35
  105. package/src/rules/no-unsafe-selectors/__tests__/rule.test.tsx +0 -257
  106. package/src/rules/no-unsafe-selectors/constants.tsx +0 -91
  107. package/src/rules/no-unsafe-selectors/index.tsx +0 -198
  108. package/src/rules/no-unsafe-selectors/lint-selector.tsx +0 -155
  109. package/src/rules/no-unsafe-selectors/source-position-utils.tsx +0 -55
  110. package/src/rules/no-unsafe-selectors/walk-css-map.tsx +0 -226
  111. package/src/rules/no-unsafe-values/README.md +0 -316
  112. package/src/rules/no-unsafe-values/__tests__/no-array-values.test.tsx +0 -27
  113. package/src/rules/no-unsafe-values/__tests__/no-conditional-values.test.tsx +0 -37
  114. package/src/rules/no-unsafe-values/__tests__/no-dynamic-keys.test.tsx +0 -229
  115. package/src/rules/no-unsafe-values/__tests__/no-function-calls.test.tsx +0 -267
  116. package/src/rules/no-unsafe-values/__tests__/no-identifier-arguments.test.tsx +0 -52
  117. package/src/rules/no-unsafe-values/__tests__/no-object-access.test.tsx +0 -106
  118. package/src/rules/no-unsafe-values/__tests__/no-object-references.test.tsx +0 -44
  119. package/src/rules/no-unsafe-values/__tests__/no-spread-elements.test.tsx +0 -48
  120. package/src/rules/no-unsafe-values/__tests__/no-unsafe-values.test.tsx +0 -75
  121. package/src/rules/no-unsafe-values/__tests__/no-variables.test.tsx +0 -121
  122. package/src/rules/no-unsafe-values/index.tsx +0 -94
  123. package/src/rules/no-unsafe-values/messages.tsx +0 -86
  124. package/src/rules/no-unsafe-values/utils.tsx +0 -387
  125. package/src/rules/use-compiled/README.md +0 -52
  126. package/src/rules/use-compiled/__tests__/can-auto-fix.test.tsx +0 -73
  127. package/src/rules/use-compiled/__tests__/css.test.tsx +0 -126
  128. package/src/rules/use-compiled/__tests__/imports.test.tsx +0 -158
  129. package/src/rules/use-compiled/__tests__/keyframes.test.tsx +0 -140
  130. package/src/rules/use-compiled/__tests__/pragma.test.tsx +0 -108
  131. package/src/rules/use-compiled/__tests__/styled.test.tsx +0 -114
  132. package/src/rules/use-compiled/__tests__/use-compiled.test.tsx +0 -15
  133. package/src/rules/use-compiled/index.tsx +0 -252
  134. package/src/rules/use-compiled/is-safe.tsx +0 -159
  135. package/src/rules/use-compiled/utils.tsx +0 -33
  136. package/src/rules/utils/create-rule-with-typed-config.tsx +0 -86
  137. package/src/rules/utils/create-rule.tsx +0 -13
  138. package/tsconfig.app.json +0 -47
  139. package/tsconfig.dev.json +0 -45
  140. package/tsconfig.json +0 -25
@@ -1,373 +0,0 @@
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 from '@af/formatting/sync';
8
-
9
- import { createSignedArtifact } from '@atlassian/codegen';
10
-
11
- import { type LintRule, getPathSafeName } from '@atlaskit/eslint-utils/create-rule';
12
- import { externalRules, type ExternalRuleMeta } from '../src/rules/external-rules';
13
-
14
- const packagePluginName = '@atlaskit/eslint-plugin-ui-styling-standard';
15
- const pluginName = '@atlaskit/ui-styling-standard';
16
- const pluginPath = 'eslint-plugin-ui-styling-standard';
17
- const codegenCommand = `yarn workspace ${packagePluginName} codegen`;
18
-
19
- interface FoundRule {
20
- module: LintRule | { meta: ExternalRuleMeta };
21
- /**
22
- * This is used for the directory name, import path, and urls
23
- */
24
- pathSafeName: string;
25
- /**
26
- * Friendly name that can include special characters
27
- */
28
- ruleName: string;
29
- }
30
-
31
- /**
32
- * A rule that is externally referenced and distributed via dependencies rather than local.
33
- * These come from `rules/external-rules.tsx`
34
- */
35
- interface ExternalRule extends FoundRule {
36
- module: { meta: ExternalRuleMeta };
37
- }
38
- interface InternalRule extends FoundRule {
39
- module: LintRule;
40
- }
41
-
42
- interface GeneratedConfig {
43
- name: string;
44
- path: string;
45
- }
46
-
47
- const ignoreList = ['index.codegen.tsx', 'TEMPLATE.md', '__tests__', 'utils', 'external-rules.tsx'];
48
- const srcDir = join(__dirname, '../src');
49
- const rulesDir = join(srcDir, 'rules');
50
- const presetsDir = join(srcDir, 'presets');
51
- const generatedConfigs: GeneratedConfig[] = [];
52
-
53
- function ruleIsExternal(rule: FoundRule | ExternalRule): rule is ExternalRule {
54
- return 'isExternal' in rule.module.meta && !!rule.module.meta.isExternal;
55
- }
56
- function ruleIsInternal(rule: FoundRule | ExternalRule): rule is InternalRule {
57
- return !ruleIsExternal(rule);
58
- }
59
-
60
- /**
61
- * Get the path to, and file contents for, a rule's README.md file.
62
- */
63
- async function ruleDocsPath(name: string) {
64
- const absolutePath = join(rulesDir, name, 'README.md');
65
- const relativePath = '.' + absolutePath.replace(process.cwd(), '');
66
-
67
- try {
68
- const file = await fs.readFile(absolutePath, 'utf-8');
69
- return { path: relativePath, file };
70
- } catch (_) {
71
- throw new Error(`invariant: rule ${name} should have docs at ${absolutePath}`);
72
- }
73
- }
74
-
75
- /**
76
- * Generates the preset config, eg. `src/presets/all.codegen.tsx` and `src/presets/recommended.codegen.tsx`
77
- */
78
- async function generatePresetConfig(name: 'all' | 'recommended', rules: FoundRule[]) {
79
- const externalScopes = externalRules
80
- .filter((rule) => rule.name?.includes('/'))
81
- .map((rule) => {
82
- // Take the first part of the name, eg. `@atlaskit/design-system` and wrap it in quotes to be
83
- const groups = rule.name.split('/');
84
- return `'${groups.slice(0, groups.length - 1).join('/')}'`;
85
- });
86
-
87
- // NOTE: Given we have external plugins, we must include them as plugins as well./
88
- const pluginList = [`'${pluginName}'`, ...Array.from(new Set(externalScopes))];
89
-
90
- const code = outdent`
91
- export default {
92
- plugins: [
93
- ${pluginList.join(',\n')}],
94
- rules: {
95
- ${rules
96
- .map((rule) => {
97
- const { severity, recommended, pluginConfig } = rule.module.meta?.docs || {};
98
-
99
- // `recommended` is a snowflake at this stage ... it can be a string at runtime
100
- // because of legacy `import { createRule } from 'utils/create-rule'` so we take
101
- // into account this possibility (as a fallback) until everything is moved over
102
- // to the new syntax
103
- const calculatedSeverity =
104
- severity ?? (typeof recommended === 'string' ? String(recommended) : 'error');
105
-
106
- let ruleName = rule.ruleName;
107
- if (ruleIsInternal(rule)) {
108
- ruleName = `${pluginName}/${rule.ruleName}`;
109
- }
110
-
111
- if (typeof pluginConfig === 'object' && pluginConfig) {
112
- return `'${ruleName}': ['${calculatedSeverity}', ${JSON.stringify(pluginConfig)}]`;
113
- }
114
-
115
- return `'${ruleName}': '${calculatedSeverity}'`;
116
- })
117
- .join(',')}
118
- },
119
- }
120
- `;
121
-
122
- const filepath = join(presetsDir, `${name}.codegen.tsx`);
123
- await writeFile(filepath, code);
124
-
125
- generatedConfigs.push({
126
- name: camelCase(name),
127
- path: './' + relative(srcDir, join(presetsDir, `${name}.codegen`)),
128
- });
129
- }
130
-
131
- /**
132
- * Write contents to a given file, creating a signed artifact if it's not a markdown file.
133
- */
134
- async function writeFile(filepath: string, code: string) {
135
- await fs.writeFile(
136
- filepath,
137
- extname(filepath).includes('.md')
138
- ? format(code, 'markdown')
139
- : createSignedArtifact(format(code, 'typescript'), codegenCommand),
140
- );
141
- }
142
-
143
- /**
144
- * Generates the `src/rules/index.codegen.tsx` entrypoint, exporting all rules.
145
- */
146
- async function generateRuleIndex(rules: FoundRule[]) {
147
- const internalRules = rules.filter(ruleIsInternal);
148
-
149
- const code = outdent`
150
- ${internalRules
151
- .map((rule) => `import ${camelCase(rule.pathSafeName)} from './${rule.pathSafeName}'`)
152
- .join('\n')}
153
-
154
- export default {
155
- ${internalRules.map((rule) => `'${rule.ruleName}': ${camelCase(rule.pathSafeName)}`).join(',')}
156
- }
157
- `;
158
-
159
- const filepath = join(rulesDir, 'index.codegen.tsx');
160
- await writeFile(filepath, code);
161
- }
162
-
163
- /**
164
- * Generates the `src/index.codegen.tsx` entrypoint, exporting all the preset configs.
165
- */
166
- async function generatePluginIndex() {
167
- const code = outdent`
168
- ${generatedConfigs.map((config) => `import ${config.name} from '${config.path}'`).join('\n')}
169
-
170
- export { default as rules } from './rules/index.codegen'
171
-
172
- export const configs = {
173
- ${generatedConfigs.map((config) => `${config.name}`).join(',')}
174
- }
175
- `;
176
-
177
- const filepath = join(srcDir, 'index.codegen.tsx');
178
- await writeFile(filepath, code);
179
- }
180
-
181
- const conditional = (cond: string, content?: boolean | string) => (content ? cond : '');
182
- const optionallyLinkTo = (content: string, url?: string) =>
183
- url ? `<a href="${url}">${content}</a>` : content;
184
-
185
- /**
186
- * Generate each individual rules' documentation pages, eg. `constellation/icon-label/usage.mdx`
187
- */
188
- async function generateRulePages(rules: FoundRule[]): Promise<void> {
189
- const docsDir = join(srcDir, '../constellation');
190
-
191
- for await (const rule of rules) {
192
- const ruleDir = join(docsDir, rule.pathSafeName);
193
- const destination = join(ruleDir, 'usage.mdx');
194
- await fs.mkdir(ruleDir, { recursive: true });
195
-
196
- if (ruleIsExternal(rule)) {
197
- await generateExternalRulePage(rule, destination);
198
- } else if (ruleIsInternal(rule)) {
199
- await generateInternalRulePage(rule, destination);
200
- } else {
201
- throw new Error(`invariant: found an unexpected rule type ${rule.ruleName}`);
202
- }
203
- }
204
- }
205
-
206
- async function generateExternalRulePage(rule: ExternalRule, destination: string) {
207
- if (existsSync(destination)) {
208
- return true;
209
- }
210
-
211
- const ruleContent = outdent`
212
- # ${rule.ruleName}
213
- ${rule.module.meta?.docs?.description || ''}
214
-
215
- ${
216
- rule.module.meta?.docs?.externalUrl
217
- ? `This rule is maintained by another package and configured here; refer to ${rule.module.meta.docs.externalUrl} for more details.`
218
- : ''
219
- }
220
- `;
221
-
222
- await writeFile(destination, ruleContent);
223
- }
224
-
225
- async function generateInternalRulePage(rule: InternalRule, destination: string) {
226
- const { file } = await ruleDocsPath(rule.pathSafeName);
227
- if (file.match(/^# /)) {
228
- throw new Error(
229
- `invariant: ${rule.pathSafeName} README doc should not include a h1 heading as it is injected automatically.`,
230
- );
231
- }
232
-
233
- const ruleContent = outdent`
234
- # ${rule.ruleName}
235
- ${file}
236
- `;
237
-
238
- await writeFile(destination, ruleContent);
239
- }
240
-
241
- /**
242
- * Generates the `RULE_TABLE_CODEGEN` in `constellation/index/usage.mdx` and `README.md`.
243
- * This is the list of all rules and their metadata.
244
- */
245
- async function generateRuleTable(filepath: string, linkTo: 'docs' | 'repo', rules: FoundRule[]) {
246
- const file = await fs.readFile(filepath, 'utf-8');
247
- const rows: string[] = [];
248
-
249
- for (const rule of rules) {
250
- let docsPath: string | undefined;
251
-
252
- if (linkTo === 'docs') {
253
- docsPath = `/components/${pluginPath}/${rule.pathSafeName}/usage`;
254
- } else if (ruleIsInternal(rule)) {
255
- const result = await ruleDocsPath(rule.pathSafeName);
256
- docsPath = result.path;
257
- } else {
258
- docsPath = rule.module.meta?.docs?.url;
259
- }
260
-
261
- const link = optionallyLinkTo(rule.ruleName, docsPath);
262
- const description = rule.module.meta?.docs?.description || '';
263
- const recommended = conditional('Yes', rule.module.meta?.docs?.recommended);
264
- const fixable = conditional('Yes', rule.module.meta?.fixable);
265
- const suggestions = conditional('Yes', rule.module.meta?.hasSuggestions);
266
-
267
- rows.push(outdent`
268
- | ${link} | ${description} | ${recommended} | ${fixable} | ${suggestions} |
269
- `);
270
- }
271
-
272
- const code = outdent`
273
- | Rule | Description | Recommended | Fixable | Suggestions |
274
- | ---- | -- | -- | -- | -- |
275
- ${rows.join('\n')}
276
- `;
277
-
278
- const found = /<!-- START_RULE_TABLE_CODEGEN -->(.|\n)*<!-- END_RULE_TABLE_CODEGEN -->/.exec(
279
- file,
280
- );
281
-
282
- if (!found) {
283
- throw new Error(`invariant: could not find the partial codegen section in ${filepath}`);
284
- }
285
-
286
- const updatedFile = file.replace(
287
- found[0],
288
- outdent`
289
- <!-- START_RULE_TABLE_CODEGEN -->
290
- <!-- @codegenCommand ${codegenCommand} -->
291
- ${code}
292
- <!-- END_RULE_TABLE_CODEGEN -->
293
- `,
294
- );
295
-
296
- await writeFile(filepath, updatedFile);
297
- }
298
-
299
- const validateInternalRule = (rule: InternalRule) => {
300
- if (typeof rule.ruleName !== 'string' || !rule.ruleName) {
301
- throw new Error(
302
- `invariant: The ${rule.pathSafeName} rule must use the createLintRule() function`,
303
- );
304
- }
305
-
306
- if (ruleIsInternal(rule) && rule.pathSafeName !== rule.ruleName) {
307
- throw new Error(
308
- `invariant: module name ${rule.pathSafeName} does not match lint rule name ${rule.ruleName}`,
309
- );
310
- }
311
-
312
- if (rule.pathSafeName.includes('@') || rule.pathSafeName.includes('/')) {
313
- throw new Error(`invariant: name ${rule.pathSafeName} is not valid, specify a path-safe name`);
314
- }
315
- };
316
-
317
- /**
318
- * Fetch all rules in `rules/*` and generate all associated contents.
319
- */
320
- async function generate() {
321
- const rulePaths = await fs.readdir(rulesDir);
322
- const recommended: FoundRule[] = [];
323
- const rules: FoundRule[] = [];
324
-
325
- for (const filename of rulePaths) {
326
- if (ignoreList.includes(filename)) {
327
- continue;
328
- }
329
-
330
- const dirname = filename.replace(extname(filename), '');
331
- const filenameWithExt = filename.endsWith('.tsx') ? filename + '.tsx' : filename;
332
-
333
- const rule: LintRule = (await import(join(rulesDir, filenameWithExt))).default;
334
-
335
- const foundRule: InternalRule = {
336
- module: rule,
337
- pathSafeName: dirname,
338
- ruleName: rule.name || rule.meta.name,
339
- };
340
-
341
- validateInternalRule(foundRule);
342
-
343
- rules.push(foundRule);
344
- }
345
-
346
- for (const rule of externalRules) {
347
- const foundRule: ExternalRule = {
348
- module: { meta: rule },
349
- pathSafeName: rule.displayName || getPathSafeName(rule.name),
350
- ruleName: rule.name,
351
- };
352
-
353
- // We don't validate these; types should do their job instead.
354
- rules.push(foundRule);
355
- }
356
-
357
- rules.forEach((rule) => {
358
- if (rule.module.meta?.docs?.recommended) {
359
- recommended.push(rule);
360
- }
361
- });
362
-
363
- // NOTE: Some of these could be awaited in parallel, but it's not worth the complexity for <1s diff.
364
- await generateRuleIndex(rules);
365
- await generatePresetConfig('all', rules);
366
- await generatePresetConfig('recommended', recommended);
367
- await generatePluginIndex();
368
- await generateRulePages(rules);
369
- await generateRuleTable(join(srcDir, '../README.md'), 'repo', rules);
370
- await generateRuleTable(join(srcDir, '../constellation/index/overview.mdx'), 'docs', rules);
371
- }
372
-
373
- generate();
@@ -1,14 +0,0 @@
1
- /**
2
- * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::aff3fad2b8534fad07ba5f0f1b981a55>>
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 DELETED
@@ -1 +0,0 @@
1
- export { configs, rules } from './index.codegen';
@@ -1,79 +0,0 @@
1
- /**
2
- * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::d6fe3ee209ccee89003da5d8fffba51e>>
4
- * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
- */
6
- export default {
7
- plugins: ['@atlaskit/ui-styling-standard', '@atlaskit/design-system', '@compiled'],
8
- rules: {
9
- '@atlaskit/ui-styling-standard/atlaskit-theme': 'error',
10
- '@atlaskit/ui-styling-standard/convert-props-syntax': 'error',
11
- '@atlaskit/ui-styling-standard/enforce-style-prop': 'error',
12
- '@atlaskit/ui-styling-standard/local-cx-xcss': 'error',
13
- '@atlaskit/ui-styling-standard/no-array-arguments': 'error',
14
- '@atlaskit/ui-styling-standard/no-classname-prop': 'error',
15
- '@atlaskit/ui-styling-standard/no-container-queries': 'error',
16
- '@atlaskit/ui-styling-standard/no-dynamic-styles': 'error',
17
- '@atlaskit/ui-styling-standard/no-exported-styles': 'error',
18
- '@atlaskit/ui-styling-standard/no-global-styles': 'error',
19
- '@atlaskit/ui-styling-standard/no-important-styles': 'error',
20
- '@atlaskit/ui-styling-standard/no-imported-style-values': 'error',
21
- '@atlaskit/ui-styling-standard/no-nested-selectors': 'error',
22
- '@atlaskit/ui-styling-standard/no-styled': 'error',
23
- '@atlaskit/ui-styling-standard/no-unsafe-selectors': 'error',
24
- '@atlaskit/ui-styling-standard/no-unsafe-values': 'error',
25
- '@atlaskit/ui-styling-standard/use-compiled': 'error',
26
- '@atlaskit/design-system/consistent-css-prop-usage': [
27
- 'error',
28
- { excludeReactComponents: true, shouldAlwaysCheckXcss: true },
29
- ],
30
- '@atlaskit/design-system/no-css-tagged-template-expression': 'error',
31
- '@atlaskit/design-system/no-keyframes-tagged-template-expression': 'error',
32
- '@atlaskit/design-system/no-styled-tagged-template-expression': 'error',
33
- '@compiled/no-suppress-xcss': 'error',
34
- '@compiled/no-js-xcss': 'error',
35
- '@atlaskit/design-system/no-empty-styled-expression': [
36
- 'error',
37
- {
38
- importSources: [
39
- '@compiled/react',
40
- '@atlaskit/css',
41
- '@emotion/core',
42
- '@emotion/react',
43
- '@emotion/styled',
44
- 'styled-components',
45
- ],
46
- },
47
- ],
48
- '@atlaskit/design-system/no-exported-css': [
49
- 'error',
50
- {
51
- importSources: [
52
- '@compiled/react',
53
- '@atlaskit/css',
54
- '@emotion/core',
55
- '@emotion/react',
56
- '@emotion/styled',
57
- 'styled-components',
58
- ],
59
- },
60
- ],
61
- '@atlaskit/design-system/no-exported-keyframes': [
62
- 'error',
63
- {
64
- importSources: [
65
- '@compiled/react',
66
- '@atlaskit/css',
67
- '@emotion/core',
68
- '@emotion/react',
69
- '@emotion/styled',
70
- 'styled-components',
71
- ],
72
- },
73
- ],
74
- '@atlaskit/design-system/no-invalid-css-map': [
75
- 'error',
76
- { allowedFunctionCalls: [['@atlaskit/tokens', 'token']] },
77
- ],
78
- },
79
- };
@@ -1,79 +0,0 @@
1
- /**
2
- * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::d6fe3ee209ccee89003da5d8fffba51e>>
4
- * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
- */
6
- export default {
7
- plugins: ['@atlaskit/ui-styling-standard', '@atlaskit/design-system', '@compiled'],
8
- rules: {
9
- '@atlaskit/ui-styling-standard/atlaskit-theme': 'error',
10
- '@atlaskit/ui-styling-standard/convert-props-syntax': 'error',
11
- '@atlaskit/ui-styling-standard/enforce-style-prop': 'error',
12
- '@atlaskit/ui-styling-standard/local-cx-xcss': 'error',
13
- '@atlaskit/ui-styling-standard/no-array-arguments': 'error',
14
- '@atlaskit/ui-styling-standard/no-classname-prop': 'error',
15
- '@atlaskit/ui-styling-standard/no-container-queries': 'error',
16
- '@atlaskit/ui-styling-standard/no-dynamic-styles': 'error',
17
- '@atlaskit/ui-styling-standard/no-exported-styles': 'error',
18
- '@atlaskit/ui-styling-standard/no-global-styles': 'error',
19
- '@atlaskit/ui-styling-standard/no-important-styles': 'error',
20
- '@atlaskit/ui-styling-standard/no-imported-style-values': 'error',
21
- '@atlaskit/ui-styling-standard/no-nested-selectors': 'error',
22
- '@atlaskit/ui-styling-standard/no-styled': 'error',
23
- '@atlaskit/ui-styling-standard/no-unsafe-selectors': 'error',
24
- '@atlaskit/ui-styling-standard/no-unsafe-values': 'error',
25
- '@atlaskit/ui-styling-standard/use-compiled': 'error',
26
- '@atlaskit/design-system/consistent-css-prop-usage': [
27
- 'error',
28
- { excludeReactComponents: true, shouldAlwaysCheckXcss: true },
29
- ],
30
- '@atlaskit/design-system/no-css-tagged-template-expression': 'error',
31
- '@atlaskit/design-system/no-keyframes-tagged-template-expression': 'error',
32
- '@atlaskit/design-system/no-styled-tagged-template-expression': 'error',
33
- '@compiled/no-suppress-xcss': 'error',
34
- '@compiled/no-js-xcss': 'error',
35
- '@atlaskit/design-system/no-empty-styled-expression': [
36
- 'error',
37
- {
38
- importSources: [
39
- '@compiled/react',
40
- '@atlaskit/css',
41
- '@emotion/core',
42
- '@emotion/react',
43
- '@emotion/styled',
44
- 'styled-components',
45
- ],
46
- },
47
- ],
48
- '@atlaskit/design-system/no-exported-css': [
49
- 'error',
50
- {
51
- importSources: [
52
- '@compiled/react',
53
- '@atlaskit/css',
54
- '@emotion/core',
55
- '@emotion/react',
56
- '@emotion/styled',
57
- 'styled-components',
58
- ],
59
- },
60
- ],
61
- '@atlaskit/design-system/no-exported-keyframes': [
62
- 'error',
63
- {
64
- importSources: [
65
- '@compiled/react',
66
- '@atlaskit/css',
67
- '@emotion/core',
68
- '@emotion/react',
69
- '@emotion/styled',
70
- 'styled-components',
71
- ],
72
- },
73
- ],
74
- '@atlaskit/design-system/no-invalid-css-map': [
75
- 'error',
76
- { allowedFunctionCalls: [['@atlaskit/tokens', 'token']] },
77
- ],
78
- },
79
- };
@@ -1,29 +0,0 @@
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. -->
@@ -1,40 +0,0 @@
1
- /* eslint-disable @repo/internal/fs/filename-pattern-match */
2
- /* eslint-disable no-undef */
3
- import { ESLintUtils } from '@typescript-eslint/utils';
4
- import { RuleTester } from 'eslint';
5
-
6
- import __noop from '@atlaskit/ds-lib/noop';
7
-
8
- (RuleTester as any).describe = (text: string, method: Function) => {
9
- const origHasAssertions = expect.hasAssertions;
10
- describe(text, () => {
11
- beforeAll(() => {
12
- // Stub out expect.hasAssertions beforeEach from jest-presetup.js
13
- expect.hasAssertions = __noop;
14
- });
15
- afterAll(() => {
16
- expect.hasAssertions = origHasAssertions;
17
- });
18
-
19
- method();
20
- });
21
- };
22
-
23
- export const typescriptEslintTester = new ESLintUtils.RuleTester({
24
- parser: '@typescript-eslint/parser',
25
- parserOptions: {
26
- ecmaVersion: 2020,
27
- sourceType: 'module',
28
- ecmaFeatures: {
29
- jsx: true,
30
- },
31
- },
32
- });
33
-
34
- export const tester = new RuleTester({
35
- parser: require.resolve('@babel/eslint-parser'),
36
- parserOptions: {
37
- ecmaVersion: 6,
38
- sourceType: 'module',
39
- },
40
- });