@tenphi/eslint-plugin-tasty

March 13, 2026 ยท View on GitHub

ESLint plugin for validating tasty(), tastyStatic(), useStyles(), useGlobalStyles(), and related APIs from @tenphi/tasty.

Catch typos, invalid syntax, and enforce best practices in your tasty style objects at lint time.

Installation

pnpm add -D @tenphi/eslint-plugin-tasty

Usage

ESLint Flat Config (ESLint 9+)

// eslint.config.js
import tasty from '@tenphi/eslint-plugin-tasty';

export default [
  tasty.configs.recommended,
  // your other configs...
];

For stricter checks:

import tasty from '@tenphi/eslint-plugin-tasty';

export default [
  tasty.configs.strict,
];

Manual Rule Configuration

import tasty from '@tenphi/eslint-plugin-tasty';

export default [
  {
    plugins: { tasty },
    rules: {
      'tasty/known-property': 'warn',
      'tasty/valid-value': 'error',
      'tasty/valid-color-token': 'error',
      // ...
    },
  },
];

Project Configuration

Create a tasty.config.ts (or .js, .json) at your project root to configure validation:

// tasty.config.ts
export default {
  tokens: ['#primary', '#danger', '#surface', '$spacing', '$gap'],
  units: ['cols'],
  states: ['@mobile', '@tablet', '@dark'],
  presets: ['h1', 'h2', 'h3', 't1', 't2', 't3'],
  recipes: ['card', 'elevated', 'reset'],
  importSources: ['@my-org/design-system'],
};

Rules

RuleSeverityDescription
tasty/known-propertywarnUnknown style property names
tasty/valid-valueerrorMalformed style values (unbalanced parens, !important)
tasty/valid-color-tokenerrorInvalid color token syntax or unknown tokens
tasty/valid-custom-uniterrorUnknown custom units
tasty/valid-boolean-propertyerrortrue on properties that don't support it
tasty/valid-state-keyerrorInvalid state key syntax in style mappings
tasty/valid-styles-structureerrorInvalid styles object structure
tasty/no-nested-state-maperrorNested state maps (not supported)
tasty/no-importanterror!important usage (breaks tasty specificity)
tasty/valid-sub-elementerrorSub-element values must be style objects
tasty/valid-directional-modifiererrorDirectional modifiers on wrong properties
tasty/valid-radius-shapeerrorUnknown radius shape keywords
tasty/valid-preseterrorUnknown preset names
tasty/valid-recipeerrorUnknown recipe names
tasty/valid-transitionwarnUnknown transition property names
tasty/no-nested-selectorwarn&-prefixed nested selectors (use sub-elements)
tasty/static-no-dynamic-valueserrorDynamic values in tastyStatic()
tasty/static-valid-selectorerrorInvalid selector in tastyStatic(selector, ...)
tasty/require-default-stateerrorMissing default ('') key in state mappings (skipped for extending calls)
RuleSeverityDescription
tasty/prefer-shorthand-propertywarnUse tasty shorthand over native CSS
tasty/valid-custom-propertywarnUnknown $name custom properties
tasty/valid-state-definitionwarnInvalid state definition values in configure() or tasty.config
tasty/no-unknown-state-aliaswarnUnknown @name state aliases
tasty/no-styles-propwarnDirect styles prop usage
tasty/no-raw-color-valueswarnRaw hex/rgb instead of tokens
tasty/consistent-token-usagewarnRaw px values when tokens exist
tasty/no-runtime-styles-mutationwarnDynamic values in style objects

License

MIT