All files / packages/sds-stylelint-config/src stylelint.config.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 0/0
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72      1x     1x                                                                                                                                  
import path from 'node:path';
import { fileURLToPath } from 'node:url';
 
const __dirname = path.dirname(fileURLToPath(import.meta.url));
 
// Physical properties that may be ignored/allowed;
export const ignoredPhysicalLayoutProperties = [
  // Physical size
  'width',
  'height',
  'min-width',
  'min-height',
  'max-width',
  'max-height',
  // Block-axis insets
  'top',
  'bottom',
  // Overflow (physical axes; logical equivalents `overflow-block`/`overflow-inline` are not broadly supported yet)
  'overflow-x',
  'overflow-y',
  // Block-axis margin / padding / scroll insets
  'margin-top',
  'margin-bottom',
  'padding-top',
  'padding-bottom',
  'scroll-margin-top',
  'scroll-margin-bottom',
  'scroll-padding-top',
  'scroll-padding-bottom',
  // Block-axis border (shorthand + color/width/style). Corner-radius
  // longhands are not listed — they must be logical.
  'border-top',
  'border-bottom',
  'border-top-color',
  'border-bottom-color',
  'border-top-width',
  'border-bottom-width',
  'border-top-style',
  'border-bottom-style',
] as const;
 
export default {
  extends: ['stylelint-config-standard'],
  ignoreFiles: ['node_modules', '**/*.md', '__mocks__/*.css'],
  defaultSeverity: 'warning' as const,
  plugins: [
    path.resolve(__dirname, 'plugins/design-token-pattern.js'),
    path.resolve(__dirname, 'plugins/design-token-global-pattern.js'),
    path.resolve(__dirname, 'plugins/design-token-reference-pattern.js'),
    path.resolve(__dirname, 'plugins/design-token-deprecated.js'),
  ],
  languageOptions: {
    directionality: {
      block: 'top-to-bottom',
      inline: 'left-to-right',
    },
  },
  rules: {
    'sds-stylelint-plugin/design-token-pattern': [null],
    'sds-stylelint-plugin/design-token-global-pattern': [true],
    'sds-stylelint-plugin/design-token-reference-pattern': [true],
    'sds-stylelint-plugin/design-token-deprecated': [true, { severity: 'warning' }],
    'property-layout-mappings': [
      'flow-relative',
      {
        ignoreProperties: [...ignoredPhysicalLayoutProperties],
      },
    ],
    'selector-type-no-unknown': [true, { ignore: ['custom-elements'] }],
  },
};