@atlaskit/eslint-plugin-design-system 11.2.0 → 11.3.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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/eslint-plugin-design-system
2
2
 
3
+ ## 11.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#175432](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/175432)
8
+ [`0a1070983ac76`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0a1070983ac76) -
9
+ `use-tokens-typography` rule now reports on `fontWeight` used with raw values (e.g. 600, 'bold').
10
+ If a matching token is found, a fix is suggested. This rule is disabled by default but can be
11
+ enabled under the name `font-weight`.
12
+
13
+ ### Patch Changes
14
+
15
+ - [#173274](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/173274)
16
+ [`fd5bac37c73ba`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fd5bac37c73ba) -
17
+ Fix eslint type error.
18
+
3
19
  ## 11.2.0
4
20
 
5
21
  ### Minor Changes
@@ -26,7 +26,8 @@ var ruleSchema = exports.ruleSchema = {
26
26
  var defaultConfig = {
27
27
  failSilently: false,
28
28
  shouldEnforceFallbacks: false,
29
- enableUnsafeAutofix: false
29
+ enableUnsafeAutofix: false,
30
+ patterns: ['style-object']
30
31
  };
31
32
  var getConfig = exports.getConfig = function getConfig(overrides) {
32
33
  return Object.assign({}, defaultConfig, overrides);
@@ -7,18 +7,26 @@ exports.default = void 0;
7
7
  var _createRule = require("../utils/create-rule");
8
8
  var _errorBoundary = require("../utils/error-boundary");
9
9
  var _config = require("./config");
10
+ var _fontWeight = require("./transformers/font-weight");
10
11
  var _styleObject = require("./transformers/style-object");
11
12
  var create = function create(context) {
12
13
  var config = (0, _config.getConfig)(context.options[0]);
13
- return {
14
- // const styles = css({ fontSize: '14px, ... }), styled.div({ fontSize: 14, ... })
15
- ObjectExpression: (0, _errorBoundary.errorBoundary)(function (node) {
14
+ return (0, _errorBoundary.errorBoundary)({
15
+ // const styles = css({ fontSize: '14px', ... }), styled.div({ fontSize: 14, ... })
16
+ ObjectExpression: function ObjectExpression(node) {
16
17
  return _styleObject.StyleObject.lint(node, {
17
18
  context: context,
18
19
  config: config
19
20
  });
20
- }, config)
21
- };
21
+ },
22
+ // const styles = css({ fontWeight: 600, 'bold', ... })
23
+ 'ObjectExpression > Property > Identifier[name=/fontWeight/]': function ObjectExpressionPropertyIdentifierNameFontWeight(node) {
24
+ return _fontWeight.FontWeight.lint(node, {
25
+ context: context,
26
+ config: config
27
+ });
28
+ }
29
+ }, config);
22
30
  };
23
31
  var rule = (0, _createRule.createLintRule)({
24
32
  meta: {
@@ -32,7 +40,8 @@ var rule = (0, _createRule.createLintRule)({
32
40
  severity: 'warn'
33
41
  },
34
42
  messages: {
35
- noRawTypographyValues: 'Typography primitives or tokens should be used instead of hard-coded values.\n\n@meta <<{{payload}}>>.\n\nNOTE: Using tokens with the `fontSize` property is invalid. Any `font.heading` or `font.body` tokens must use the CSS `font` property.'
43
+ noRawTypographyValues: 'Typography primitives or tokens should be used instead of hard-coded values.\n\n@meta <<{{payload}}>>.\n\nNOTE: Using tokens with the `fontSize` property is invalid. Any `font.heading` or `font.body` tokens must use the CSS `font` property.',
44
+ noRawFontWeightValues: 'Font weight tokens should be used instead of hard-coded values.'
36
45
  },
37
46
  schema: _config.ruleSchema
38
47
  },
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FontWeight = void 0;
7
+ var _eslintCodemodUtils = require("eslint-codemod-utils");
8
+ var _astNodes = require("../../../ast-nodes");
9
+ var _utils = require("../../ensure-design-token-usage/utils");
10
+ var _isNode = require("../../utils/is-node");
11
+ var _utils2 = require("../utils");
12
+ /* eslint-disable @repo/internal/react/require-jsdoc */
13
+
14
+ var FontWeight = exports.FontWeight = {
15
+ lint: function lint(node, _ref) {
16
+ var context = _ref.context,
17
+ config = _ref.config;
18
+ // To force the correct node type
19
+ if (!(0, _eslintCodemodUtils.isNodeOfType)(node, 'Identifier')) {
20
+ return;
21
+ }
22
+
23
+ // Check whether all criteria needed to make a transformation are met
24
+ var success = FontWeight._check(node, {
25
+ context: context,
26
+ config: config
27
+ });
28
+ if (success) {
29
+ return context.report({
30
+ node: node,
31
+ messageId: 'noRawFontWeightValues',
32
+ fix: FontWeight._fix(node, context)
33
+ });
34
+ }
35
+ },
36
+ _check: function _check(node, _ref2) {
37
+ var context = _ref2.context,
38
+ config = _ref2.config;
39
+ if (!config.patterns.includes('font-weight')) {
40
+ return false;
41
+ }
42
+ if (!(0, _isNode.isDecendantOfStyleBlock)(node) && !(0, _isNode.isDecendantOfType)(node, 'JSXExpressionContainer')) {
43
+ return false;
44
+ }
45
+ if (!(0, _eslintCodemodUtils.isNodeOfType)(node.parent, 'Property')) {
46
+ return false;
47
+ }
48
+ var fontWeightValue = (0, _utils.getValueForPropertyNode)(node.parent, context);
49
+ if (typeof fontWeightValue === 'string' && fontWeightValue.includes('font.weight.')) {
50
+ return false;
51
+ }
52
+ return true;
53
+ },
54
+ _fix: function _fix(node, context) {
55
+ return function (fixer) {
56
+ var _findFontWeightTokenF;
57
+ var fixes = [];
58
+
59
+ // -- Type assertions to force the correct node type --
60
+
61
+ if (!(0, _eslintCodemodUtils.isNodeOfType)(node.parent, 'Property')) {
62
+ return [];
63
+ }
64
+ if (!(0, _eslintCodemodUtils.isNodeOfType)(node.parent.value, 'Literal')) {
65
+ return [];
66
+ }
67
+ if (!node.parent.value.raw) {
68
+ return [];
69
+ }
70
+
71
+ // -- Fix: Replace raw value with token --
72
+
73
+ var matchingToken = (_findFontWeightTokenF = (0, _utils2.findFontWeightTokenForValue)(node.parent.value.raw)) === null || _findFontWeightTokenF === void 0 ? void 0 : _findFontWeightTokenF.tokenName;
74
+ if (!matchingToken) {
75
+ return [];
76
+ }
77
+ var fontWeightValueFix = fixer.replaceText(node.parent.value, "token('".concat(matchingToken, "')"));
78
+ fixes.push(fontWeightValueFix);
79
+
80
+ // -- Fix: Add import if it doesn't exist --
81
+
82
+ var body = context.sourceCode.ast.body;
83
+ var tokensImportDeclarations = _astNodes.Root.findImportsByModule(body, '@atlaskit/tokens');
84
+
85
+ // If there is more than one `@atlaskit/tokens` import, then it becomes difficult to determine which import to transform
86
+ if (tokensImportDeclarations.length > 1) {
87
+ return fixes;
88
+ }
89
+ var tokensImportDeclaration = tokensImportDeclarations[0];
90
+ if (!tokensImportDeclaration) {
91
+ fixes.push((0, _utils2.insertTokensImport)(body, fixer));
92
+ }
93
+ return fixes;
94
+ };
95
+ }
96
+ };
@@ -204,6 +204,11 @@ var StyleObject = exports.StyleObject = {
204
204
  _check: function _check(node, _ref2) {
205
205
  var context = _ref2.context,
206
206
  config = _ref2.config;
207
+ if (!config.patterns.includes('style-object')) {
208
+ return {
209
+ success: false
210
+ };
211
+ }
207
212
  if (!(0, _isNode.isDecendantOfStyleBlock)(node) && !(0, _isNode.isDecendantOfType)(node, 'JSXExpressionContainer')) {
208
213
  return {
209
214
  success: false
@@ -99,6 +99,12 @@ var fontWeightTokens = exports.fontWeightTokens = _tokensRaw.typographyAdg3.filt
99
99
  };
100
100
  });
101
101
  function findFontWeightTokenForValue(fontWeight) {
102
+ if (fontWeight === "'normal'") {
103
+ fontWeight = '400';
104
+ }
105
+ if (fontWeight === "'bold'") {
106
+ fontWeight = '700';
107
+ }
102
108
  return fontWeightTokens.find(function (token) {
103
109
  return token.tokenValue === fontWeight;
104
110
  });
@@ -20,7 +20,8 @@ export const ruleSchema = {
20
20
  const defaultConfig = {
21
21
  failSilently: false,
22
22
  shouldEnforceFallbacks: false,
23
- enableUnsafeAutofix: false
23
+ enableUnsafeAutofix: false,
24
+ patterns: ['style-object']
24
25
  };
25
26
  export const getConfig = overrides => {
26
27
  return Object.assign({}, defaultConfig, overrides);
@@ -1,16 +1,22 @@
1
1
  import { createLintRule } from '../utils/create-rule';
2
2
  import { errorBoundary } from '../utils/error-boundary';
3
3
  import { getConfig, ruleSchema } from './config';
4
+ import { FontWeight } from './transformers/font-weight';
4
5
  import { StyleObject } from './transformers/style-object';
5
6
  const create = context => {
6
7
  const config = getConfig(context.options[0]);
7
- return {
8
- // const styles = css({ fontSize: '14px, ... }), styled.div({ fontSize: 14, ... })
9
- ObjectExpression: errorBoundary(node => StyleObject.lint(node, {
8
+ return errorBoundary({
9
+ // const styles = css({ fontSize: '14px', ... }), styled.div({ fontSize: 14, ... })
10
+ ObjectExpression: node => StyleObject.lint(node, {
10
11
  context,
11
12
  config
12
- }), config)
13
- };
13
+ }),
14
+ // const styles = css({ fontWeight: 600, 'bold', ... })
15
+ 'ObjectExpression > Property > Identifier[name=/fontWeight/]': node => FontWeight.lint(node, {
16
+ context,
17
+ config
18
+ })
19
+ }, config);
14
20
  };
15
21
  const rule = createLintRule({
16
22
  meta: {
@@ -24,7 +30,8 @@ const rule = createLintRule({
24
30
  severity: 'warn'
25
31
  },
26
32
  messages: {
27
- noRawTypographyValues: 'Typography primitives or tokens should be used instead of hard-coded values.\n\n@meta <<{{payload}}>>.\n\nNOTE: Using tokens with the `fontSize` property is invalid. Any `font.heading` or `font.body` tokens must use the CSS `font` property.'
33
+ noRawTypographyValues: 'Typography primitives or tokens should be used instead of hard-coded values.\n\n@meta <<{{payload}}>>.\n\nNOTE: Using tokens with the `fontSize` property is invalid. Any `font.heading` or `font.body` tokens must use the CSS `font` property.',
34
+ noRawFontWeightValues: 'Font weight tokens should be used instead of hard-coded values.'
28
35
  },
29
36
  schema: ruleSchema
30
37
  },
@@ -0,0 +1,92 @@
1
+ /* eslint-disable @repo/internal/react/require-jsdoc */
2
+
3
+ import { isNodeOfType } from 'eslint-codemod-utils';
4
+ import { Root } from '../../../ast-nodes';
5
+ import { getValueForPropertyNode } from '../../ensure-design-token-usage/utils';
6
+ import { isDecendantOfStyleBlock, isDecendantOfType } from '../../utils/is-node';
7
+ import { findFontWeightTokenForValue, insertTokensImport } from '../utils';
8
+ export const FontWeight = {
9
+ lint(node, {
10
+ context,
11
+ config
12
+ }) {
13
+ // To force the correct node type
14
+ if (!isNodeOfType(node, 'Identifier')) {
15
+ return;
16
+ }
17
+
18
+ // Check whether all criteria needed to make a transformation are met
19
+ const success = FontWeight._check(node, {
20
+ context,
21
+ config
22
+ });
23
+ if (success) {
24
+ return context.report({
25
+ node,
26
+ messageId: 'noRawFontWeightValues',
27
+ fix: FontWeight._fix(node, context)
28
+ });
29
+ }
30
+ },
31
+ _check(node, {
32
+ context,
33
+ config
34
+ }) {
35
+ if (!config.patterns.includes('font-weight')) {
36
+ return false;
37
+ }
38
+ if (!isDecendantOfStyleBlock(node) && !isDecendantOfType(node, 'JSXExpressionContainer')) {
39
+ return false;
40
+ }
41
+ if (!isNodeOfType(node.parent, 'Property')) {
42
+ return false;
43
+ }
44
+ const fontWeightValue = getValueForPropertyNode(node.parent, context);
45
+ if (typeof fontWeightValue === 'string' && fontWeightValue.includes('font.weight.')) {
46
+ return false;
47
+ }
48
+ return true;
49
+ },
50
+ _fix(node, context) {
51
+ return fixer => {
52
+ var _findFontWeightTokenF;
53
+ const fixes = [];
54
+
55
+ // -- Type assertions to force the correct node type --
56
+
57
+ if (!isNodeOfType(node.parent, 'Property')) {
58
+ return [];
59
+ }
60
+ if (!isNodeOfType(node.parent.value, 'Literal')) {
61
+ return [];
62
+ }
63
+ if (!node.parent.value.raw) {
64
+ return [];
65
+ }
66
+
67
+ // -- Fix: Replace raw value with token --
68
+
69
+ const matchingToken = (_findFontWeightTokenF = findFontWeightTokenForValue(node.parent.value.raw)) === null || _findFontWeightTokenF === void 0 ? void 0 : _findFontWeightTokenF.tokenName;
70
+ if (!matchingToken) {
71
+ return [];
72
+ }
73
+ const fontWeightValueFix = fixer.replaceText(node.parent.value, `token('${matchingToken}')`);
74
+ fixes.push(fontWeightValueFix);
75
+
76
+ // -- Fix: Add import if it doesn't exist --
77
+
78
+ const body = context.sourceCode.ast.body;
79
+ const tokensImportDeclarations = Root.findImportsByModule(body, '@atlaskit/tokens');
80
+
81
+ // If there is more than one `@atlaskit/tokens` import, then it becomes difficult to determine which import to transform
82
+ if (tokensImportDeclarations.length > 1) {
83
+ return fixes;
84
+ }
85
+ const tokensImportDeclaration = tokensImportDeclarations[0];
86
+ if (!tokensImportDeclaration) {
87
+ fixes.push(insertTokensImport(body, fixer));
88
+ }
89
+ return fixes;
90
+ };
91
+ }
92
+ };
@@ -198,6 +198,11 @@ export const StyleObject = {
198
198
  context,
199
199
  config
200
200
  }) {
201
+ if (!config.patterns.includes('style-object')) {
202
+ return {
203
+ success: false
204
+ };
205
+ }
201
206
  if (!isDecendantOfStyleBlock(node) && !isDecendantOfType(node, 'JSXExpressionContainer')) {
202
207
  return {
203
208
  success: false
@@ -48,6 +48,12 @@ export const fontWeightTokens = typographyTokens.filter(token => token.attribute
48
48
  };
49
49
  });
50
50
  export function findFontWeightTokenForValue(fontWeight) {
51
+ if (fontWeight === "'normal'") {
52
+ fontWeight = '400';
53
+ }
54
+ if (fontWeight === "'bold'") {
55
+ fontWeight = '700';
56
+ }
51
57
  return fontWeightTokens.find(token => token.tokenValue === fontWeight);
52
58
  }
53
59
  export const fontWeightMap = {
@@ -20,7 +20,8 @@ export var ruleSchema = {
20
20
  var defaultConfig = {
21
21
  failSilently: false,
22
22
  shouldEnforceFallbacks: false,
23
- enableUnsafeAutofix: false
23
+ enableUnsafeAutofix: false,
24
+ patterns: ['style-object']
24
25
  };
25
26
  export var getConfig = function getConfig(overrides) {
26
27
  return Object.assign({}, defaultConfig, overrides);
@@ -1,18 +1,26 @@
1
1
  import { createLintRule } from '../utils/create-rule';
2
2
  import { errorBoundary } from '../utils/error-boundary';
3
3
  import { getConfig, ruleSchema } from './config';
4
+ import { FontWeight } from './transformers/font-weight';
4
5
  import { StyleObject } from './transformers/style-object';
5
6
  var create = function create(context) {
6
7
  var config = getConfig(context.options[0]);
7
- return {
8
- // const styles = css({ fontSize: '14px, ... }), styled.div({ fontSize: 14, ... })
9
- ObjectExpression: errorBoundary(function (node) {
8
+ return errorBoundary({
9
+ // const styles = css({ fontSize: '14px', ... }), styled.div({ fontSize: 14, ... })
10
+ ObjectExpression: function ObjectExpression(node) {
10
11
  return StyleObject.lint(node, {
11
12
  context: context,
12
13
  config: config
13
14
  });
14
- }, config)
15
- };
15
+ },
16
+ // const styles = css({ fontWeight: 600, 'bold', ... })
17
+ 'ObjectExpression > Property > Identifier[name=/fontWeight/]': function ObjectExpressionPropertyIdentifierNameFontWeight(node) {
18
+ return FontWeight.lint(node, {
19
+ context: context,
20
+ config: config
21
+ });
22
+ }
23
+ }, config);
16
24
  };
17
25
  var rule = createLintRule({
18
26
  meta: {
@@ -26,7 +34,8 @@ var rule = createLintRule({
26
34
  severity: 'warn'
27
35
  },
28
36
  messages: {
29
- noRawTypographyValues: 'Typography primitives or tokens should be used instead of hard-coded values.\n\n@meta <<{{payload}}>>.\n\nNOTE: Using tokens with the `fontSize` property is invalid. Any `font.heading` or `font.body` tokens must use the CSS `font` property.'
37
+ noRawTypographyValues: 'Typography primitives or tokens should be used instead of hard-coded values.\n\n@meta <<{{payload}}>>.\n\nNOTE: Using tokens with the `fontSize` property is invalid. Any `font.heading` or `font.body` tokens must use the CSS `font` property.',
38
+ noRawFontWeightValues: 'Font weight tokens should be used instead of hard-coded values.'
30
39
  },
31
40
  schema: ruleSchema
32
41
  },
@@ -0,0 +1,90 @@
1
+ /* eslint-disable @repo/internal/react/require-jsdoc */
2
+
3
+ import { isNodeOfType } from 'eslint-codemod-utils';
4
+ import { Root } from '../../../ast-nodes';
5
+ import { getValueForPropertyNode } from '../../ensure-design-token-usage/utils';
6
+ import { isDecendantOfStyleBlock, isDecendantOfType } from '../../utils/is-node';
7
+ import { findFontWeightTokenForValue, insertTokensImport } from '../utils';
8
+ export var FontWeight = {
9
+ lint: function lint(node, _ref) {
10
+ var context = _ref.context,
11
+ config = _ref.config;
12
+ // To force the correct node type
13
+ if (!isNodeOfType(node, 'Identifier')) {
14
+ return;
15
+ }
16
+
17
+ // Check whether all criteria needed to make a transformation are met
18
+ var success = FontWeight._check(node, {
19
+ context: context,
20
+ config: config
21
+ });
22
+ if (success) {
23
+ return context.report({
24
+ node: node,
25
+ messageId: 'noRawFontWeightValues',
26
+ fix: FontWeight._fix(node, context)
27
+ });
28
+ }
29
+ },
30
+ _check: function _check(node, _ref2) {
31
+ var context = _ref2.context,
32
+ config = _ref2.config;
33
+ if (!config.patterns.includes('font-weight')) {
34
+ return false;
35
+ }
36
+ if (!isDecendantOfStyleBlock(node) && !isDecendantOfType(node, 'JSXExpressionContainer')) {
37
+ return false;
38
+ }
39
+ if (!isNodeOfType(node.parent, 'Property')) {
40
+ return false;
41
+ }
42
+ var fontWeightValue = getValueForPropertyNode(node.parent, context);
43
+ if (typeof fontWeightValue === 'string' && fontWeightValue.includes('font.weight.')) {
44
+ return false;
45
+ }
46
+ return true;
47
+ },
48
+ _fix: function _fix(node, context) {
49
+ return function (fixer) {
50
+ var _findFontWeightTokenF;
51
+ var fixes = [];
52
+
53
+ // -- Type assertions to force the correct node type --
54
+
55
+ if (!isNodeOfType(node.parent, 'Property')) {
56
+ return [];
57
+ }
58
+ if (!isNodeOfType(node.parent.value, 'Literal')) {
59
+ return [];
60
+ }
61
+ if (!node.parent.value.raw) {
62
+ return [];
63
+ }
64
+
65
+ // -- Fix: Replace raw value with token --
66
+
67
+ var matchingToken = (_findFontWeightTokenF = findFontWeightTokenForValue(node.parent.value.raw)) === null || _findFontWeightTokenF === void 0 ? void 0 : _findFontWeightTokenF.tokenName;
68
+ if (!matchingToken) {
69
+ return [];
70
+ }
71
+ var fontWeightValueFix = fixer.replaceText(node.parent.value, "token('".concat(matchingToken, "')"));
72
+ fixes.push(fontWeightValueFix);
73
+
74
+ // -- Fix: Add import if it doesn't exist --
75
+
76
+ var body = context.sourceCode.ast.body;
77
+ var tokensImportDeclarations = Root.findImportsByModule(body, '@atlaskit/tokens');
78
+
79
+ // If there is more than one `@atlaskit/tokens` import, then it becomes difficult to determine which import to transform
80
+ if (tokensImportDeclarations.length > 1) {
81
+ return fixes;
82
+ }
83
+ var tokensImportDeclaration = tokensImportDeclarations[0];
84
+ if (!tokensImportDeclaration) {
85
+ fixes.push(insertTokensImport(body, fixer));
86
+ }
87
+ return fixes;
88
+ };
89
+ }
90
+ };
@@ -199,6 +199,11 @@ export var StyleObject = {
199
199
  _check: function _check(node, _ref2) {
200
200
  var context = _ref2.context,
201
201
  config = _ref2.config;
202
+ if (!config.patterns.includes('style-object')) {
203
+ return {
204
+ success: false
205
+ };
206
+ }
202
207
  if (!isDecendantOfStyleBlock(node) && !isDecendantOfType(node, 'JSXExpressionContainer')) {
203
208
  return {
204
209
  success: false
@@ -78,6 +78,12 @@ export var fontWeightTokens = typographyTokens.filter(function (token) {
78
78
  };
79
79
  });
80
80
  export function findFontWeightTokenForValue(fontWeight) {
81
+ if (fontWeight === "'normal'") {
82
+ fontWeight = '400';
83
+ }
84
+ if (fontWeight === "'bold'") {
85
+ fontWeight = '700';
86
+ }
81
87
  return fontWeightTokens.find(function (token) {
82
88
  return token.tokenValue === fontWeight;
83
89
  });
@@ -1,8 +1,11 @@
1
1
  import { type JSONSchema4 } from '@typescript-eslint/utils/dist/json-schema';
2
+ type Pattern = 'style-object' | 'font-weight';
2
3
  export type RuleConfig = {
3
4
  failSilently: boolean;
4
5
  shouldEnforceFallbacks: boolean;
5
6
  enableUnsafeAutofix: boolean;
7
+ patterns: Pattern[];
6
8
  };
7
9
  export declare const ruleSchema: JSONSchema4;
8
10
  export declare const getConfig: (overrides: Partial<RuleConfig>) => RuleConfig;
11
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { Rule } from 'eslint';
2
+ import { Identifier } from 'eslint-codemod-utils';
3
+ import { type RuleConfig } from '../config';
4
+ interface MetaData {
5
+ context: Rule.RuleContext;
6
+ config: RuleConfig;
7
+ }
8
+ export declare const FontWeight: {
9
+ lint(node: Rule.Node, { context, config }: MetaData): void;
10
+ _check(node: Identifier & Rule.NodeParentExtension, { context, config }: MetaData): boolean;
11
+ _fix(node: Identifier & Rule.NodeParentExtension, context: Rule.RuleContext): (fixer: Rule.RuleFixer) => Rule.Fix[];
12
+ };
13
+ export {};
@@ -1,8 +1,11 @@
1
1
  import { type JSONSchema4 } from '@typescript-eslint/utils/dist/json-schema';
2
+ type Pattern = 'style-object' | 'font-weight';
2
3
  export type RuleConfig = {
3
4
  failSilently: boolean;
4
5
  shouldEnforceFallbacks: boolean;
5
6
  enableUnsafeAutofix: boolean;
7
+ patterns: Pattern[];
6
8
  };
7
9
  export declare const ruleSchema: JSONSchema4;
8
10
  export declare const getConfig: (overrides: Partial<RuleConfig>) => RuleConfig;
11
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { Rule } from 'eslint';
2
+ import { Identifier } from 'eslint-codemod-utils';
3
+ import { type RuleConfig } from '../config';
4
+ interface MetaData {
5
+ context: Rule.RuleContext;
6
+ config: RuleConfig;
7
+ }
8
+ export declare const FontWeight: {
9
+ lint(node: Rule.Node, { context, config }: MetaData): void;
10
+ _check(node: Identifier & Rule.NodeParentExtension, { context, config }: MetaData): boolean;
11
+ _fix(node: Identifier & Rule.NodeParentExtension, context: Rule.RuleContext): (fixer: Rule.RuleFixer) => Rule.Fix[];
12
+ };
13
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atlaskit/eslint-plugin-design-system",
3
3
  "description": "The essential plugin for use with the Atlassian Design System.",
4
- "version": "11.2.0",
4
+ "version": "11.3.0",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {