@atlaskit/eslint-plugin-design-system 10.8.2 → 10.9.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,14 @@
1
1
  # @atlaskit/eslint-plugin-design-system
2
2
 
3
+ ## 10.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#116062](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116062)
8
+ [`2959497ccf910`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2959497ccf910) -
9
+ Adds `shouldAlwaysCheckXcss` config option to `consistent-css-prop-usage` to lint the `xcss` prop
10
+ even when `excludeReactComponents` is enabled.
11
+
3
12
  ## 10.8.2
4
13
 
5
14
  ### Patch Changes
@@ -193,6 +193,15 @@ assume that an element is a React component if its name starts with a capital le
193
193
 
194
194
  This is `false` by default.
195
195
 
196
+ ### shouldAlwaysCheckXcss
197
+
198
+ Overrides `excludeReactComponents` specifically for the `xcss` prop.
199
+
200
+ This means that even if `excludeReactComponents` is `true`, you can still lint the `xcss` prop by
201
+ setting `shouldAlwaysCheckXcss` to `true`.
202
+
203
+ This is `false` by default.
204
+
196
205
  ### autoFix
197
206
 
198
207
  When set to `true`, this rule will turn on the autofixer. Set this to `false` if you do not want the
@@ -497,7 +497,8 @@ var defaultConfig = {
497
497
  cssImportSource: _isSupportedImport.CSS_IN_JS_IMPORTS.compiled,
498
498
  xcssImportSource: _isSupportedImport.CSS_IN_JS_IMPORTS.atlaskitPrimitives,
499
499
  excludeReactComponents: false,
500
- autoFix: true
500
+ autoFix: true,
501
+ shouldAlwaysCheckXcss: false
501
502
  };
502
503
  var rule = (0, _createRule.createLintRule)({
503
504
  meta: {
@@ -540,6 +541,9 @@ var rule = (0, _createRule.createLintRule)({
540
541
  excludeReactComponents: {
541
542
  type: 'boolean'
542
543
  },
544
+ shouldAlwaysCheckXcss: {
545
+ type: 'boolean'
546
+ },
543
547
  autoFix: {
544
548
  type: 'boolean'
545
549
  }
@@ -554,7 +558,20 @@ var rule = (0, _createRule.createLintRule)({
554
558
  var node = nodeOriginal;
555
559
  var name = node.name,
556
560
  value = node.value;
557
- if (mergedConfig.excludeReactComponents && node.parent.type === 'JSXOpeningElement') {
561
+
562
+ /**
563
+ * We skip linting `xcss` attributes if:
564
+ *
565
+ * - excludeReactComponents === true
566
+ * - shouldAlwaysCheckXcss === false
567
+ *
568
+ * In the future we may want to remove `shouldAlwaysCheckXcss`
569
+ * and just always lint `xcss`, regardless of `excludeReactComponents`
570
+ */
571
+ if (mergedConfig.excludeReactComponents && name.name === 'xcss' && !mergedConfig.shouldAlwaysCheckXcss) {
572
+ return;
573
+ }
574
+ if (mergedConfig.excludeReactComponents && node.parent.type === 'JSXOpeningElement' && name.name === 'css') {
558
575
  // e.g. <item.before />
559
576
  if (node.parent.name.type === 'JSXMemberExpression') {
560
577
  return;
@@ -449,7 +449,8 @@ const defaultConfig = {
449
449
  cssImportSource: CSS_IN_JS_IMPORTS.compiled,
450
450
  xcssImportSource: CSS_IN_JS_IMPORTS.atlaskitPrimitives,
451
451
  excludeReactComponents: false,
452
- autoFix: true
452
+ autoFix: true,
453
+ shouldAlwaysCheckXcss: false
453
454
  };
454
455
  const rule = createLintRule({
455
456
  meta: {
@@ -492,6 +493,9 @@ const rule = createLintRule({
492
493
  excludeReactComponents: {
493
494
  type: 'boolean'
494
495
  },
496
+ shouldAlwaysCheckXcss: {
497
+ type: 'boolean'
498
+ },
495
499
  autoFix: {
496
500
  type: 'boolean'
497
501
  }
@@ -508,7 +512,20 @@ const rule = createLintRule({
508
512
  name,
509
513
  value
510
514
  } = node;
511
- if (mergedConfig.excludeReactComponents && node.parent.type === 'JSXOpeningElement') {
515
+
516
+ /**
517
+ * We skip linting `xcss` attributes if:
518
+ *
519
+ * - excludeReactComponents === true
520
+ * - shouldAlwaysCheckXcss === false
521
+ *
522
+ * In the future we may want to remove `shouldAlwaysCheckXcss`
523
+ * and just always lint `xcss`, regardless of `excludeReactComponents`
524
+ */
525
+ if (mergedConfig.excludeReactComponents && name.name === 'xcss' && !mergedConfig.shouldAlwaysCheckXcss) {
526
+ return;
527
+ }
528
+ if (mergedConfig.excludeReactComponents && node.parent.type === 'JSXOpeningElement' && name.name === 'css') {
512
529
  // e.g. <item.before />
513
530
  if (node.parent.name.type === 'JSXMemberExpression') {
514
531
  return;
@@ -490,7 +490,8 @@ var defaultConfig = {
490
490
  cssImportSource: CSS_IN_JS_IMPORTS.compiled,
491
491
  xcssImportSource: CSS_IN_JS_IMPORTS.atlaskitPrimitives,
492
492
  excludeReactComponents: false,
493
- autoFix: true
493
+ autoFix: true,
494
+ shouldAlwaysCheckXcss: false
494
495
  };
495
496
  var rule = createLintRule({
496
497
  meta: {
@@ -533,6 +534,9 @@ var rule = createLintRule({
533
534
  excludeReactComponents: {
534
535
  type: 'boolean'
535
536
  },
537
+ shouldAlwaysCheckXcss: {
538
+ type: 'boolean'
539
+ },
536
540
  autoFix: {
537
541
  type: 'boolean'
538
542
  }
@@ -547,7 +551,20 @@ var rule = createLintRule({
547
551
  var node = nodeOriginal;
548
552
  var name = node.name,
549
553
  value = node.value;
550
- if (mergedConfig.excludeReactComponents && node.parent.type === 'JSXOpeningElement') {
554
+
555
+ /**
556
+ * We skip linting `xcss` attributes if:
557
+ *
558
+ * - excludeReactComponents === true
559
+ * - shouldAlwaysCheckXcss === false
560
+ *
561
+ * In the future we may want to remove `shouldAlwaysCheckXcss`
562
+ * and just always lint `xcss`, regardless of `excludeReactComponents`
563
+ */
564
+ if (mergedConfig.excludeReactComponents && name.name === 'xcss' && !mergedConfig.shouldAlwaysCheckXcss) {
565
+ return;
566
+ }
567
+ if (mergedConfig.excludeReactComponents && node.parent.type === 'JSXOpeningElement' && name.name === 'css') {
551
568
  // e.g. <item.before />
552
569
  if (node.parent.name.type === 'JSXMemberExpression') {
553
570
  return;
@@ -6,4 +6,5 @@ export type RuleConfig = {
6
6
  xcssImportSource: ImportSource;
7
7
  excludeReactComponents: boolean;
8
8
  autoFix: boolean;
9
+ shouldAlwaysCheckXcss: boolean;
9
10
  };
@@ -6,4 +6,5 @@ export type RuleConfig = {
6
6
  xcssImportSource: ImportSource;
7
7
  excludeReactComponents: boolean;
8
8
  autoFix: boolean;
9
+ shouldAlwaysCheckXcss: boolean;
9
10
  };
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": "10.8.2",
4
+ "version": "10.9.0",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {