@atlaskit/eslint-plugin-ui-styling-standard 0.11.4 → 0.11.6

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 (59) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +33 -3
  3. package/constellation/atlaskit-theme/usage.mdx +113 -0
  4. package/constellation/convert-props-syntax/usage.mdx +32 -22
  5. package/constellation/enforce-style-prop/usage.mdx +21 -18
  6. package/constellation/index/overview.mdx +91 -76
  7. package/constellation/index/props.mdx +2 -9
  8. package/constellation/local-cx-xcss/usage.mdx +10 -6
  9. package/constellation/no-array-arguments/usage.mdx +10 -9
  10. package/constellation/no-classname-prop/usage.mdx +7 -4
  11. package/constellation/no-container-queries/usage.mdx +17 -15
  12. package/constellation/no-dynamic-styles/usage.mdx +26 -29
  13. package/constellation/no-exported-styles/usage.mdx +23 -18
  14. package/constellation/no-important-styles/usage.mdx +5 -3
  15. package/constellation/no-imported-style-values/usage.mdx +30 -22
  16. package/constellation/no-nested-selectors/usage.mdx +22 -20
  17. package/constellation/no-unsafe-values/usage.mdx +45 -51
  18. package/dist/cjs/index.codegen.js +1 -1
  19. package/dist/cjs/presets/all.codegen.js +2 -1
  20. package/dist/cjs/presets/recommended.codegen.js +2 -1
  21. package/dist/cjs/rules/atlaskit-theme/index.js +95 -0
  22. package/dist/cjs/rules/enforce-style-prop/index.js +39 -26
  23. package/dist/cjs/rules/index.codegen.js +3 -1
  24. package/dist/es2019/index.codegen.js +1 -1
  25. package/dist/es2019/presets/all.codegen.js +2 -1
  26. package/dist/es2019/presets/recommended.codegen.js +2 -1
  27. package/dist/es2019/rules/atlaskit-theme/index.js +85 -0
  28. package/dist/es2019/rules/enforce-style-prop/index.js +34 -19
  29. package/dist/es2019/rules/index.codegen.js +3 -1
  30. package/dist/esm/index.codegen.js +1 -1
  31. package/dist/esm/presets/all.codegen.js +2 -1
  32. package/dist/esm/presets/recommended.codegen.js +2 -1
  33. package/dist/esm/rules/atlaskit-theme/index.js +89 -0
  34. package/dist/esm/rules/enforce-style-prop/index.js +39 -26
  35. package/dist/esm/rules/index.codegen.js +3 -1
  36. package/dist/types/index.codegen.d.ts +2 -0
  37. package/dist/types/presets/all.codegen.d.ts +2 -1
  38. package/dist/types/presets/recommended.codegen.d.ts +2 -1
  39. package/dist/types/rules/atlaskit-theme/index.d.ts +3 -0
  40. package/dist/types/rules/index.codegen.d.ts +1 -0
  41. package/dist/types-ts4.5/index.codegen.d.ts +2 -0
  42. package/dist/types-ts4.5/presets/all.codegen.d.ts +2 -1
  43. package/dist/types-ts4.5/presets/recommended.codegen.d.ts +2 -1
  44. package/dist/types-ts4.5/rules/atlaskit-theme/index.d.ts +3 -0
  45. package/dist/types-ts4.5/rules/index.codegen.d.ts +1 -0
  46. package/package.json +3 -3
  47. package/scripts/codegen.tsx +3 -10
  48. package/src/index.codegen.tsx +3 -3
  49. package/src/presets/all.codegen.tsx +66 -69
  50. package/src/presets/recommended.codegen.tsx +66 -69
  51. package/src/rules/atlaskit-theme/README.md +109 -0
  52. package/src/rules/atlaskit-theme/__tests__/test.ts +122 -0
  53. package/src/rules/atlaskit-theme/index.ts +136 -0
  54. package/src/rules/enforce-style-prop/__tests__/rule.test.tsx +18 -0
  55. package/src/rules/enforce-style-prop/index.tsx +42 -23
  56. package/src/rules/index.codegen.tsx +15 -13
  57. package/src/rules/no-exported-styles/index.tsx +1 -1
  58. package/src/rules/no-imported-style-values/index.tsx +1 -1
  59. package/tsconfig.app.json +3 -0
@@ -1,21 +1,25 @@
1
1
  import { isNodeOfType } from 'eslint-codemod-utils';
2
2
  import { createLintRule } from '../utils/create-rule';
3
- const findVariable = (context, name) => {
4
- return context.getScope().variables.find(varb => varb.name === name);
5
- };
6
- const isParameter = (context, variableName) => {
3
+ import { getAllowedFunctionCalls, isAllowListedVariable } from '@atlaskit/eslint-utils/allowed-function-calls';
4
+ import { findVariable } from '@atlaskit/eslint-utils/find-variable';
5
+ const isParameter = (context, identifier) => {
7
6
  var _findVariable;
8
- const definitions = (_findVariable = findVariable(context, variableName)) === null || _findVariable === void 0 ? void 0 : _findVariable.defs;
7
+ const definitions = (_findVariable = findVariable({
8
+ sourceCode: context.sourceCode,
9
+ identifier: identifier
10
+ })) === null || _findVariable === void 0 ? void 0 : _findVariable.defs;
9
11
  if (!definitions || !definitions.length) {
10
12
  return false;
11
13
  }
12
14
  const result = definitions[0];
13
15
  return result.type === 'Parameter';
14
16
  };
15
- const checkIdentifier = (context, identifier) => {
17
+ const isIdentifierAllowed = (context, identifier) => {
16
18
  var _parent;
17
- const val = identifier.name;
18
- const variable = findVariable(context, val);
19
+ const variable = findVariable({
20
+ sourceCode: context.sourceCode,
21
+ identifier: identifier
22
+ });
19
23
  if (!variable) {
20
24
  return false;
21
25
  }
@@ -28,7 +32,7 @@ const checkIdentifier = (context, identifier) => {
28
32
 
29
33
  // Checking if identifier has been destructured from props within function
30
34
  if (variableDefinition.type === 'VariableDeclarator') {
31
- var _variableDefinition$i, _variableDefinition$i2, _variableDefinition$i3;
35
+ var _variableDefinition$i, _variableDefinition$i2;
32
36
  // If it's a let variable, ignore
33
37
  if (variableDefinition.parent.kind === 'let') {
34
38
  return true;
@@ -40,16 +44,14 @@ const checkIdentifier = (context, identifier) => {
40
44
  // Destructured from member expression
41
45
  // e.g. const width = props.width
42
46
  if (((_variableDefinition$i2 = variableDefinition.init) === null || _variableDefinition$i2 === void 0 ? void 0 : _variableDefinition$i2.type) === 'MemberExpression') {
43
- const memberIdentifierName = variableDefinition.init.object.name;
44
- return isParameter(context, memberIdentifierName);
47
+ return isParameter(context, variableDefinition.init.object);
45
48
  }
46
49
  // Destructured from object pattern
47
50
  // e.g. const { width } = props
48
- const propName = (_variableDefinition$i3 = variableDefinition.init) === null || _variableDefinition$i3 === void 0 ? void 0 : _variableDefinition$i3.name;
49
- return isParameter(context, propName);
51
+ return isParameter(context, variableDefinition.init);
50
52
  }
51
53
  // If identifier has not been deconstructed from parameter or is a RestElement, report warning
52
- return isParameter(context, val);
54
+ return isParameter(context, identifier);
53
55
  };
54
56
  function isPropertyValueAllowed(property, context) {
55
57
  if (property.type === 'SpreadElement') {
@@ -59,13 +61,26 @@ function isPropertyValueAllowed(property, context) {
59
61
  if (property.value.type === 'Literal') {
60
62
  return false;
61
63
  } else if (property.value.type === 'Identifier') {
62
- return checkIdentifier(context, property.value);
63
- } else if (property.value.type === 'CallExpression' && property.value.callee.type === 'Identifier' && property.value.callee.name === 'token') {
64
- return false;
64
+ return isIdentifierAllowed(context, property.value);
65
+ } else if (property.value.type === 'CallExpression' && property.value.callee.type === 'Identifier') {
66
+ const variable = findVariable({
67
+ sourceCode: context.sourceCode,
68
+ identifier: property.value.callee
69
+ });
70
+ // Anything returned by getAllowedFunctionCalls should be used in css prop instead
71
+ const functionAllowList = getAllowedFunctionCalls(context.options);
72
+ if (!variable || isAllowListedVariable({
73
+ allowList: functionAllowList,
74
+ variable
75
+ })) {
76
+ return false;
77
+ }
65
78
  } else if (property.value.type === 'MemberExpression' && property.value.object.type === 'Identifier') {
66
79
  var _findVariable2;
67
- const val = property.value.object.name;
68
- const definitions = (_findVariable2 = findVariable(context, val)) === null || _findVariable2 === void 0 ? void 0 : _findVariable2.defs;
80
+ const definitions = (_findVariable2 = findVariable({
81
+ sourceCode: context.sourceCode,
82
+ identifier: property.value.object
83
+ })) === null || _findVariable2 === void 0 ? void 0 : _findVariable2.defs;
69
84
  if (!definitions || !definitions.length) {
70
85
  return false;
71
86
  }
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::648acb81f0f43d8ce56f7d6c22db8856>>
3
+ * @codegen <<SignedSource::78ffc29d20fd2fe3727a620cb4ddf192>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
+ import atlaskitTheme from './atlaskit-theme';
6
7
  import convertPropsSyntax from './convert-props-syntax';
7
8
  import enforceStyleProp from './enforce-style-prop';
8
9
  import localCxXcss from './local-cx-xcss';
@@ -16,6 +17,7 @@ import noImportedStyleValues from './no-imported-style-values';
16
17
  import noNestedSelectors from './no-nested-selectors';
17
18
  import noUnsafeValues from './no-unsafe-values';
18
19
  export default {
20
+ 'atlaskit-theme': atlaskitTheme,
19
21
  'convert-props-syntax': convertPropsSyntax,
20
22
  'enforce-style-prop': enforceStyleProp,
21
23
  'local-cx-xcss': localCxXcss,
@@ -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::3fd41935576c9346ca1f1e0c787a0a48>>
3
+ * @codegen <<SignedSource::16a3441765e5a97f9f32de7fd0de17f0>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
  import all from './presets/all.codegen';
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::96336e6094dbcbf456aaef313b624fbf>>
3
+ * @codegen <<SignedSource::a0c326baf3aa4e87ac809b303ba34682>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
  export default {
7
7
  plugins: ['@atlaskit/ui-styling-standard', '@atlaskit/design-system', '@compiled'],
8
8
  rules: {
9
+ '@atlaskit/ui-styling-standard/atlaskit-theme': 'error',
9
10
  '@atlaskit/ui-styling-standard/convert-props-syntax': 'error',
10
11
  '@atlaskit/ui-styling-standard/enforce-style-prop': 'warn',
11
12
  '@atlaskit/ui-styling-standard/local-cx-xcss': 'warn',
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::96336e6094dbcbf456aaef313b624fbf>>
3
+ * @codegen <<SignedSource::a0c326baf3aa4e87ac809b303ba34682>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
  export default {
7
7
  plugins: ['@atlaskit/ui-styling-standard', '@atlaskit/design-system', '@compiled'],
8
8
  rules: {
9
+ '@atlaskit/ui-styling-standard/atlaskit-theme': 'error',
9
10
  '@atlaskit/ui-styling-standard/convert-props-syntax': 'error',
10
11
  '@atlaskit/ui-styling-standard/enforce-style-prop': 'warn',
11
12
  '@atlaskit/ui-styling-standard/local-cx-xcss': 'warn',
@@ -0,0 +1,89 @@
1
+ import { getImportSources, isCompiled } from '@atlaskit/eslint-utils/is-supported-import';
2
+ import { createLintRule } from '../utils/create-rule';
3
+ var isIdentifierReferenced = function isIdentifierReferenced(hasImportSpecifier, node, references) {
4
+ return references.some(function (reference) {
5
+ var _reference$resolved;
6
+ return reference.identifier === node && ((_reference$resolved = reference.resolved) === null || _reference$resolved === void 0 ? void 0 : _reference$resolved.defs.some(hasImportSpecifier));
7
+ });
8
+ };
9
+ var isTypographyImportSpecifier = function isTypographyImportSpecifier(def) {
10
+ var _def$parent, _def$parent2, _def$parent3;
11
+ return def.node.type === 'ImportSpecifier' && def.node.imported.type === 'Identifier' && ((_def$parent = def.parent) === null || _def$parent === void 0 ? void 0 : _def$parent.type) === 'ImportDeclaration' && (def.node.imported.name === 'typography' && ((_def$parent2 = def.parent) === null || _def$parent2 === void 0 ? void 0 : _def$parent2.source.value) === '@atlaskit/theme' || ((_def$parent3 = def.parent) === null || _def$parent3 === void 0 ? void 0 : _def$parent3.source.value) === '@atlaskit/theme/typography');
12
+ };
13
+ var isElevationImportSpecifier = function isElevationImportSpecifier(def) {
14
+ var _def$parent4, _def$parent5, _def$parent6;
15
+ return def.node.type === 'ImportSpecifier' && def.node.imported.type === 'Identifier' && ((_def$parent4 = def.parent) === null || _def$parent4 === void 0 ? void 0 : _def$parent4.type) === 'ImportDeclaration' && (def.node.imported.name === 'elevation' && ((_def$parent5 = def.parent) === null || _def$parent5 === void 0 ? void 0 : _def$parent5.source.value) === '@atlaskit/theme' || ((_def$parent6 = def.parent) === null || _def$parent6 === void 0 ? void 0 : _def$parent6.source.value) === '@atlaskit/theme/elevation');
16
+ };
17
+ var isSkeletonShimmerImportSpecifier = function isSkeletonShimmerImportSpecifier(def) {
18
+ var _def$parent7, _def$parent8, _def$parent9;
19
+ return def.node.type === 'ImportSpecifier' && def.node.imported.type === 'Identifier' && ((_def$parent7 = def.parent) === null || _def$parent7 === void 0 ? void 0 : _def$parent7.type) === 'ImportDeclaration' && def.node.imported.name === 'skeletonShimmer' && typeof ((_def$parent8 = def.parent) === null || _def$parent8 === void 0 ? void 0 : _def$parent8.source.value) === 'string' && ((_def$parent9 = def.parent) === null || _def$parent9 === void 0 || (_def$parent9 = _def$parent9.source.value) === null || _def$parent9 === void 0 ? void 0 : _def$parent9.startsWith('@atlaskit/theme'));
20
+ };
21
+ var checkIdentifier = function checkIdentifier(node, context, references) {
22
+ if (isIdentifierReferenced(isTypographyImportSpecifier, node, references)) {
23
+ context.report({
24
+ messageId: 'usingTypography',
25
+ node: node
26
+ });
27
+ }
28
+ if (isIdentifierReferenced(isElevationImportSpecifier, node, references)) {
29
+ context.report({
30
+ messageId: 'usingElevation',
31
+ node: node
32
+ });
33
+ }
34
+ if (isIdentifierReferenced(isSkeletonShimmerImportSpecifier, node, references)) {
35
+ context.report({
36
+ messageId: 'usingSkeletonShimmer',
37
+ node: node
38
+ });
39
+ }
40
+ };
41
+ export var rule = createLintRule({
42
+ meta: {
43
+ name: 'atlaskit-theme',
44
+ docs: {
45
+ description: 'Ban certain usages of `@atlaskit/theme` that `@compiled/react` does not understand',
46
+ recommended: true,
47
+ severity: 'error'
48
+ },
49
+ messages: {
50
+ usingTypography: 'Typography does not work with Compiled. Please utilise alternatives like Heading or tokens instead and see https://atlassian.design/components/eslint-plugin-ui-styling-standard/atlaskit-theme/usage',
51
+ usingElevation: 'Elevation does not work with Compiled. Please use a token with a fallback instead and see https://atlassian.design/components/eslint-plugin-ui-styling-standard/atlaskit-theme/usage',
52
+ usingSkeletonShimmer: 'Skeleton Shimmer does not work with Compiled. Please use an SVG skeleton instead and see https://atlassian.design/components/eslint-plugin-ui-styling-standard/atlaskit-theme/usage'
53
+ },
54
+ schema: [],
55
+ type: 'problem'
56
+ },
57
+ create: function create(context) {
58
+ var importSources = getImportSources(context);
59
+ return {
60
+ 'CallExpression Identifier': function CallExpressionIdentifier(node) {
61
+ var _context$getScope = context.getScope(),
62
+ references = _context$getScope.references;
63
+ var ancestors = context.getAncestors();
64
+
65
+ // Check if ancestor node is a call expression to Compiled
66
+ if (ancestors.some(function (ancestor) {
67
+ return ancestor.type === 'CallExpression' && ancestor.callee && isCompiled(ancestor.callee, references, importSources);
68
+ })) {
69
+ // Check identifier for violations
70
+ checkIdentifier(node, context, references);
71
+ }
72
+ },
73
+ 'TaggedTemplateExpression Identifier': function TaggedTemplateExpressionIdentifier(node) {
74
+ var _context$getScope2 = context.getScope(),
75
+ references = _context$getScope2.references;
76
+ var ancestors = context.getAncestors();
77
+
78
+ // Check if ancestor node is a tagged template expression to Compiled
79
+ if (ancestors.some(function (ancestor) {
80
+ return ancestor.type === 'TaggedTemplateExpression' && ancestor.tag && isCompiled(ancestor.tag, references, importSources);
81
+ })) {
82
+ // Check identifier for violations
83
+ checkIdentifier(node, context, references);
84
+ }
85
+ }
86
+ };
87
+ }
88
+ });
89
+ export default rule;
@@ -1,23 +1,25 @@
1
1
  import { isNodeOfType } from 'eslint-codemod-utils';
2
2
  import { createLintRule } from '../utils/create-rule';
3
- var findVariable = function findVariable(context, name) {
4
- return context.getScope().variables.find(function (varb) {
5
- return varb.name === name;
6
- });
7
- };
8
- var isParameter = function isParameter(context, variableName) {
3
+ import { getAllowedFunctionCalls, isAllowListedVariable } from '@atlaskit/eslint-utils/allowed-function-calls';
4
+ import { findVariable } from '@atlaskit/eslint-utils/find-variable';
5
+ var isParameter = function isParameter(context, identifier) {
9
6
  var _findVariable;
10
- var definitions = (_findVariable = findVariable(context, variableName)) === null || _findVariable === void 0 ? void 0 : _findVariable.defs;
7
+ var definitions = (_findVariable = findVariable({
8
+ sourceCode: context.sourceCode,
9
+ identifier: identifier
10
+ })) === null || _findVariable === void 0 ? void 0 : _findVariable.defs;
11
11
  if (!definitions || !definitions.length) {
12
12
  return false;
13
13
  }
14
14
  var result = definitions[0];
15
15
  return result.type === 'Parameter';
16
16
  };
17
- var checkIdentifier = function checkIdentifier(context, identifier) {
17
+ var isIdentifierAllowed = function isIdentifierAllowed(context, identifier) {
18
18
  var _parent;
19
- var val = identifier.name;
20
- var variable = findVariable(context, val);
19
+ var variable = findVariable({
20
+ sourceCode: context.sourceCode,
21
+ identifier: identifier
22
+ });
21
23
  if (!variable) {
22
24
  return false;
23
25
  }
@@ -30,7 +32,7 @@ var checkIdentifier = function checkIdentifier(context, identifier) {
30
32
 
31
33
  // Checking if identifier has been destructured from props within function
32
34
  if (variableDefinition.type === 'VariableDeclarator') {
33
- var _variableDefinition$i, _variableDefinition$i2, _variableDefinition$i3;
35
+ var _variableDefinition$i, _variableDefinition$i2;
34
36
  // If it's a let variable, ignore
35
37
  if (variableDefinition.parent.kind === 'let') {
36
38
  return true;
@@ -42,16 +44,14 @@ var checkIdentifier = function checkIdentifier(context, identifier) {
42
44
  // Destructured from member expression
43
45
  // e.g. const width = props.width
44
46
  if (((_variableDefinition$i2 = variableDefinition.init) === null || _variableDefinition$i2 === void 0 ? void 0 : _variableDefinition$i2.type) === 'MemberExpression') {
45
- var memberIdentifierName = variableDefinition.init.object.name;
46
- return isParameter(context, memberIdentifierName);
47
+ return isParameter(context, variableDefinition.init.object);
47
48
  }
48
49
  // Destructured from object pattern
49
50
  // e.g. const { width } = props
50
- var propName = (_variableDefinition$i3 = variableDefinition.init) === null || _variableDefinition$i3 === void 0 ? void 0 : _variableDefinition$i3.name;
51
- return isParameter(context, propName);
51
+ return isParameter(context, variableDefinition.init);
52
52
  }
53
53
  // If identifier has not been deconstructed from parameter or is a RestElement, report warning
54
- return isParameter(context, val);
54
+ return isParameter(context, identifier);
55
55
  };
56
56
  function isPropertyValueAllowed(property, context) {
57
57
  if (property.type === 'SpreadElement') {
@@ -61,26 +61,39 @@ function isPropertyValueAllowed(property, context) {
61
61
  if (property.value.type === 'Literal') {
62
62
  return false;
63
63
  } else if (property.value.type === 'Identifier') {
64
- return checkIdentifier(context, property.value);
65
- } else if (property.value.type === 'CallExpression' && property.value.callee.type === 'Identifier' && property.value.callee.name === 'token') {
66
- return false;
64
+ return isIdentifierAllowed(context, property.value);
65
+ } else if (property.value.type === 'CallExpression' && property.value.callee.type === 'Identifier') {
66
+ var variable = findVariable({
67
+ sourceCode: context.sourceCode,
68
+ identifier: property.value.callee
69
+ });
70
+ // Anything returned by getAllowedFunctionCalls should be used in css prop instead
71
+ var functionAllowList = getAllowedFunctionCalls(context.options);
72
+ if (!variable || isAllowListedVariable({
73
+ allowList: functionAllowList,
74
+ variable: variable
75
+ })) {
76
+ return false;
77
+ }
67
78
  } else if (property.value.type === 'MemberExpression' && property.value.object.type === 'Identifier') {
68
79
  var _findVariable2;
69
- var val = property.value.object.name;
70
- var definitions = (_findVariable2 = findVariable(context, val)) === null || _findVariable2 === void 0 ? void 0 : _findVariable2.defs;
80
+ var definitions = (_findVariable2 = findVariable({
81
+ sourceCode: context.sourceCode,
82
+ identifier: property.value.object
83
+ })) === null || _findVariable2 === void 0 ? void 0 : _findVariable2.defs;
71
84
  if (!definitions || !definitions.length) {
72
85
  return false;
73
86
  }
74
- var variable = definitions[0];
75
- if (!variable) {
87
+ var _variable = definitions[0];
88
+ if (!_variable) {
76
89
  return false;
77
90
  }
78
- var varType = variable.type;
91
+ var varType = _variable.type;
79
92
  if (varType === 'Variable') {
80
- if (!variable.node.init) {
93
+ if (!_variable.node.init) {
81
94
  return false;
82
95
  }
83
- var varSource = variable.node.init.type;
96
+ var varSource = _variable.node.init.type;
84
97
  // Variables initialised by a call expression or object expression are ok
85
98
  if (varSource === 'CallExpression' || varSource === 'ObjectExpression') {
86
99
  return true;
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::648acb81f0f43d8ce56f7d6c22db8856>>
3
+ * @codegen <<SignedSource::78ffc29d20fd2fe3727a620cb4ddf192>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
+ import atlaskitTheme from './atlaskit-theme';
6
7
  import convertPropsSyntax from './convert-props-syntax';
7
8
  import enforceStyleProp from './enforce-style-prop';
8
9
  import localCxXcss from './local-cx-xcss';
@@ -16,6 +17,7 @@ import noImportedStyleValues from './no-imported-style-values';
16
17
  import noNestedSelectors from './no-nested-selectors';
17
18
  import noUnsafeValues from './no-unsafe-values';
18
19
  export default {
20
+ 'atlaskit-theme': atlaskitTheme,
19
21
  'convert-props-syntax': convertPropsSyntax,
20
22
  'enforce-style-prop': enforceStyleProp,
21
23
  'local-cx-xcss': localCxXcss,
@@ -3,6 +3,7 @@ export declare const configs: {
3
3
  all: {
4
4
  plugins: string[];
5
5
  rules: {
6
+ '@atlaskit/ui-styling-standard/atlaskit-theme': string;
6
7
  '@atlaskit/ui-styling-standard/convert-props-syntax': string;
7
8
  '@atlaskit/ui-styling-standard/enforce-style-prop': string;
8
9
  '@atlaskit/ui-styling-standard/local-cx-xcss': string;
@@ -40,6 +41,7 @@ export declare const configs: {
40
41
  recommended: {
41
42
  plugins: string[];
42
43
  rules: {
44
+ '@atlaskit/ui-styling-standard/atlaskit-theme': string;
43
45
  '@atlaskit/ui-styling-standard/convert-props-syntax': string;
44
46
  '@atlaskit/ui-styling-standard/enforce-style-prop': string;
45
47
  '@atlaskit/ui-styling-standard/local-cx-xcss': string;
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::96336e6094dbcbf456aaef313b624fbf>>
3
+ * @codegen <<SignedSource::a0c326baf3aa4e87ac809b303ba34682>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
  declare const _default: {
7
7
  plugins: string[];
8
8
  rules: {
9
+ '@atlaskit/ui-styling-standard/atlaskit-theme': string;
9
10
  '@atlaskit/ui-styling-standard/convert-props-syntax': string;
10
11
  '@atlaskit/ui-styling-standard/enforce-style-prop': string;
11
12
  '@atlaskit/ui-styling-standard/local-cx-xcss': string;
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::96336e6094dbcbf456aaef313b624fbf>>
3
+ * @codegen <<SignedSource::a0c326baf3aa4e87ac809b303ba34682>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
  declare const _default: {
7
7
  plugins: string[];
8
8
  rules: {
9
+ '@atlaskit/ui-styling-standard/atlaskit-theme': string;
9
10
  '@atlaskit/ui-styling-standard/convert-props-syntax': string;
10
11
  '@atlaskit/ui-styling-standard/enforce-style-prop': string;
11
12
  '@atlaskit/ui-styling-standard/local-cx-xcss': string;
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const rule: Rule.RuleModule;
3
+ export default rule;
@@ -1,4 +1,5 @@
1
1
  declare const _default: {
2
+ 'atlaskit-theme': import("eslint").Rule.RuleModule;
2
3
  'convert-props-syntax': import("eslint").Rule.RuleModule;
3
4
  'enforce-style-prop': import("eslint").Rule.RuleModule;
4
5
  'local-cx-xcss': import("eslint").Rule.RuleModule;
@@ -3,6 +3,7 @@ export declare const configs: {
3
3
  all: {
4
4
  plugins: string[];
5
5
  rules: {
6
+ '@atlaskit/ui-styling-standard/atlaskit-theme': string;
6
7
  '@atlaskit/ui-styling-standard/convert-props-syntax': string;
7
8
  '@atlaskit/ui-styling-standard/enforce-style-prop': string;
8
9
  '@atlaskit/ui-styling-standard/local-cx-xcss': string;
@@ -40,6 +41,7 @@ export declare const configs: {
40
41
  recommended: {
41
42
  plugins: string[];
42
43
  rules: {
44
+ '@atlaskit/ui-styling-standard/atlaskit-theme': string;
43
45
  '@atlaskit/ui-styling-standard/convert-props-syntax': string;
44
46
  '@atlaskit/ui-styling-standard/enforce-style-prop': string;
45
47
  '@atlaskit/ui-styling-standard/local-cx-xcss': string;
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::96336e6094dbcbf456aaef313b624fbf>>
3
+ * @codegen <<SignedSource::a0c326baf3aa4e87ac809b303ba34682>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
  declare const _default: {
7
7
  plugins: string[];
8
8
  rules: {
9
+ '@atlaskit/ui-styling-standard/atlaskit-theme': string;
9
10
  '@atlaskit/ui-styling-standard/convert-props-syntax': string;
10
11
  '@atlaskit/ui-styling-standard/enforce-style-prop': string;
11
12
  '@atlaskit/ui-styling-standard/local-cx-xcss': string;
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  * THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
3
- * @codegen <<SignedSource::96336e6094dbcbf456aaef313b624fbf>>
3
+ * @codegen <<SignedSource::a0c326baf3aa4e87ac809b303ba34682>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
  declare const _default: {
7
7
  plugins: string[];
8
8
  rules: {
9
+ '@atlaskit/ui-styling-standard/atlaskit-theme': string;
9
10
  '@atlaskit/ui-styling-standard/convert-props-syntax': string;
10
11
  '@atlaskit/ui-styling-standard/enforce-style-prop': string;
11
12
  '@atlaskit/ui-styling-standard/local-cx-xcss': string;
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const rule: Rule.RuleModule;
3
+ export default rule;
@@ -1,4 +1,5 @@
1
1
  declare const _default: {
2
+ 'atlaskit-theme': import("eslint").Rule.RuleModule;
2
3
  'convert-props-syntax': import("eslint").Rule.RuleModule;
3
4
  'enforce-style-prop': import("eslint").Rule.RuleModule;
4
5
  'local-cx-xcss': import("eslint").Rule.RuleModule;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/eslint-plugin-ui-styling-standard",
3
- "version": "0.11.4",
3
+ "version": "0.11.6",
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",
@@ -49,8 +49,9 @@
49
49
  "outdent": "^0.5.0"
50
50
  },
51
51
  "devDependencies": {
52
+ "@af/formatting": "*",
52
53
  "@atlaskit/ds-lib": "^2.3.0",
53
- "@atlaskit/eslint-plugin-design-system": "^9.6.0",
54
+ "@atlaskit/eslint-plugin-design-system": "^10.0.0",
54
55
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
55
56
  "@atlassian/codegen": "*",
56
57
  "@compiled/eslint-plugin": "^0.13.6",
@@ -58,7 +59,6 @@
58
59
  "@types/estraverse": "^5.1.7",
59
60
  "eslint": "^8.49.0",
60
61
  "lodash": "^4.17.21",
61
- "prettier": "^2.8.0",
62
62
  "ts-node": "^10.9.1",
63
63
  "tsconfig-paths": "^4.2.0",
64
64
  "typescript": "~5.4.2"
@@ -4,7 +4,7 @@ import { extname, join, relative } from 'path';
4
4
 
5
5
  import camelCase from 'lodash/camelCase';
6
6
  import outdent from 'outdent';
7
- import { format, resolveConfig } from 'prettier';
7
+ import format from '@af/formatting/sync';
8
8
 
9
9
  import { createSignedArtifact } from '@atlassian/codegen';
10
10
 
@@ -155,19 +155,12 @@ async function generatePresetConfig(
155
155
  * Write contents to a given file, creating a signed artifact if it's not a markdown file.
156
156
  */
157
157
  async function writeFile(filepath: string, code: string) {
158
- const config = await resolveConfig(filepath);
159
158
  await fs.writeFile(
160
159
  filepath,
161
160
  extname(filepath).includes('.md')
162
- ? format(code, {
163
- ...config,
164
- filepath,
165
- })
161
+ ? format(code, 'markdown')
166
162
  : createSignedArtifact(
167
- format(code, {
168
- ...config,
169
- filepath,
170
- }),
163
+ format(code, 'typescript'),
171
164
  codegenCommand,
172
165
  ),
173
166
  );
@@ -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::3fd41935576c9346ca1f1e0c787a0a48>>
3
+ * @codegen <<SignedSource::16a3441765e5a97f9f32de7fd0de17f0>>
4
4
  * @codegenCommand yarn workspace @atlaskit/eslint-plugin-ui-styling-standard codegen
5
5
  */
6
6
  import all from './presets/all.codegen';
@@ -9,6 +9,6 @@ import recommended from './presets/recommended.codegen';
9
9
  export { default as rules } from './rules/index.codegen';
10
10
 
11
11
  export const configs = {
12
- all,
13
- recommended,
12
+ all,
13
+ recommended,
14
14
  };