or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

configuration-presets.mdfile-processors.mdindex.mdlinting-rules.mdplugin-configuration.md
tile.json

linting-rules.mddocs/

Linting Rules

284 comprehensive ESLint rules covering all aspects of Vue.js development including template syntax, component structure, lifecycle methods, composition API, props/emits handling, and best practices. Rules are organized by functionality and provide both error prevention and code quality improvements.

Capabilities

Template Formatting Rules

Rules that extend ESLint core formatting rules to work in Vue templates, ensuring consistent code style across JavaScript and template sections.

/**
 * Array bracket formatting in templates
 * Enforces consistent newline usage in array brackets
 */
const "array-bracket-newline": ESLintRule;

/**
 * Array bracket spacing in templates
 * Enforces consistent spacing inside array brackets
 */
const "array-bracket-spacing": ESLintRule;

/**
 * Array element newline formatting in templates
 * Controls newlines between array elements
 */
const "array-element-newline": ESLintRule;

/**
 * Arrow function spacing in templates
 * Enforces spacing around arrow function arrows
 */
const "arrow-spacing": ESLintRule;

/**
 * Block spacing in templates
 * Enforces consistent spacing inside single-line blocks
 */
const "block-spacing": ESLintRule;

/**
 * Brace style formatting in templates
 * Enforces consistent brace style for blocks
 */
const "brace-style": ESLintRule;

/**
 * Comma dangle rules in templates
 * Controls trailing commas in multiline structures
 */
const "comma-dangle": ESLintRule;

/**
 * Comma spacing in templates
 * Enforces spacing around commas
 */
const "comma-spacing": ESLintRule;

/**
 * Object property access formatting
 * Controls dot notation vs bracket notation usage
 */
const "dot-notation": ESLintRule;

/**
 * Function call spacing in templates
 * Enforces spacing between function names and parentheses
 */
const "func-call-spacing": ESLintRule;

/**
 * Object key spacing in templates
 * Controls spacing around colons in object literals
 */
const "key-spacing": ESLintRule;

/**
 * Keyword spacing in templates
 * Enforces spacing around language keywords
 */
const "keyword-spacing": ESLintRule;

/**
 * Maximum line length in templates
 * Enforces maximum line length limits
 */
const "max-len": ESLintRule;

/**
 * Template curly brace spacing
 * Controls spacing inside template literal expressions
 */
const "template-curly-spacing": ESLintRule;

Vue-Specific Formatting Rules

Formatting rules specifically designed for Vue.js templates, components, and directives.

/**
 * Attribute name casing enforcement
 * Enforces kebab-case or camelCase for HTML attributes
 */
const "attribute-hyphenation": ESLintRule;

/**
 * Attribute ordering in template tags
 * Enforces consistent ordering of Vue directives and attributes
 */
const "attributes-order": ESLintRule;

/**
 * Block ordering in Single File Components
 * Controls order of <template>, <script>, <style> blocks
 */
const "block-order": ESLintRule;

/**
 * Block tag newline formatting
 * Controls newlines around SFC block tags
 */
const "block-tag-newline": ESLintRule;

/**
 * Component name casing in component definitions
 * Enforces PascalCase or kebab-case for component names
 */
const "component-definition-name-casing": ESLintRule;

/**
 * Component name casing in templates
 * Enforces consistent casing when using components in templates
 */
const "component-name-in-template-casing": ESLintRule;

/**
 * First attribute line break formatting
 * Controls line breaks before the first attribute
 */
const "first-attribute-linebreak": ESLintRule;

/**
 * HTML closing bracket newline placement
 * Controls newlines before closing brackets in HTML tags
 */
const "html-closing-bracket-newline": ESLintRule;

/**
 * HTML closing bracket spacing
 * Controls spacing before closing brackets in HTML tags
 */
const "html-closing-bracket-spacing": ESLintRule;

/**
 * HTML comment content formatting
 * Controls newlines and spacing inside HTML comments
 */
const "html-comment-content-newline": ESLintRule;
const "html-comment-content-spacing": ESLintRule;
const "html-comment-indent": ESLintRule;

/**
 * HTML closing tag enforcement
 * Requires closing tags for HTML elements
 */
const "html-end-tags": ESLintRule;

/**
 * HTML indentation rules
 * Enforces consistent indentation in HTML templates
 */
const "html-indent": ESLintRule;

/**
 * HTML attribute quote style
 * Enforces single or double quotes for HTML attributes
 */
const "html-quotes": ESLintRule;

/**
 * HTML self-closing tag formatting
 * Controls self-closing tag usage for HTML elements
 */
const "html-self-closing": ESLintRule;

/**
 * Maximum attributes per line
 * Limits number of attributes on a single line
 */
const "max-attributes-per-line": ESLintRule;

/**
 * Multiline HTML element content formatting
 * Controls newlines in multiline HTML element content
 */
const "multiline-html-element-content-newline": ESLintRule;

/**
 * Mustache interpolation spacing
 * Controls spacing inside {{ }} interpolations
 */
const "mustache-interpolation-spacing": ESLintRule;

/**
 * Padding between template blocks
 * Enforces blank lines between different types of blocks
 */
const "padding-line-between-blocks": ESLintRule;
const "padding-line-between-tags": ESLintRule;

/**
 * Script indentation in SFC
 * Controls indentation inside <script> blocks
 */
const "script-indent": ESLintRule;

/**
 * Single-line HTML element content formatting
 * Controls content placement in single-line HTML elements
 */
const "singleline-html-element-content-newline": ESLintRule;

Vue Component Structure Rules

Rules governing Vue component definition, naming, and organization patterns.

/**
 * Component API style enforcement
 * Enforces Options API vs Composition API usage
 */
const "component-api-style": ESLintRule;

/**
 * Component options property name casing
 * Enforces casing for component option property names
 */
const "component-options-name-casing": ESLintRule;

/**
 * Custom event name casing
 * Enforces kebab-case for custom event names
 */
const "custom-event-name-casing": ESLintRule;

/**
 * defineEmits declaration style
 * Enforces specific patterns for defineEmits usage
 */
const "define-emits-declaration": ESLintRule;

/**
 * Macro definition ordering
 * Controls order of defineProps, defineEmits, etc. in script setup
 */
const "define-macros-order": ESLintRule;

/**
 * defineProps declaration style
 * Enforces specific patterns for defineProps usage
 */
const "define-props-declaration": ESLintRule;

/**
 * Props destructuring patterns
 * Controls destructuring of defineProps return value
 */
const "define-props-destructuring": ESLintRule;

/**
 * Component file name matching
 * Ensures component file names match component names
 */
const "match-component-file-name": ESLintRule;

/**
 * Component import name matching
 * Ensures imported component names follow conventions
 */
const "match-component-import-name": ESLintRule;

/**
 * Multi-word component names
 * Requires component names to be multi-word (except root components)
 */
const "multi-word-component-names": ESLintRule;

/**
 * One component per file
 * Enforces single component definition per file
 */
const "one-component-per-file": ESLintRule;

/**
 * Component option ordering
 * Enforces consistent ordering of component options
 */
const "order-in-components": ESLintRule;

/**
 * Default export requirement
 * Requires default export in Vue component files
 */
const "require-default-export": ESLintRule;

/**
 * Direct export requirement
 * Requires direct export without intermediate variables
 */
const "require-direct-export": ESLintRule;

/**
 * Component name property requirement
 * Requires name property in component definitions
 */
const "require-name-property": ESLintRule;

Vue Directive Rules

Rules for Vue.js directives including v-if, v-for, v-model, and custom directives.

/**
 * v-model custom modifier restrictions
 * Prevents custom modifiers on v-model in Vue 3
 */
const "no-custom-modifiers-on-v-model": ESLintRule;

/**
 * Deprecated v-bind.sync usage
 * Prevents usage of deprecated .sync modifier
 */
const "no-deprecated-v-bind-sync": ESLintRule;

/**
 * Deprecated v-is directive usage
 * Prevents usage of deprecated v-is directive
 */
const "no-deprecated-v-is": ESLintRule;

/**
 * Root element v-if prevention
 * Prevents v-if on root template elements
 */
const "no-root-v-if": ESLintRule;

/**
 * Attribute equal sign spacing
 * Prevents spaces around = in attributes
 */
const "no-spaces-around-equal-signs-in-attribute": ESLintRule;

/**
 * v-else with v-for combination
 * Prevents using v-else with v-for on same element
 */
const "no-use-v-else-with-v-for": ESLintRule;

/**
 * v-if with v-for combination
 * Prevents using v-if with v-for on same element
 */
const "no-use-v-if-with-v-for": ESLintRule;

/**
 * Useless v-bind prevention
 * Prevents v-bind with static values
 */
const "no-useless-v-bind": ESLintRule;

/**
 * v-for template key rules
 * Controls key usage with v-for on template elements
 */
const "no-v-for-template-key": ESLintRule;
const "no-v-for-template-key-on-child": ESLintRule;

/**
 * v-html usage restrictions
 * Warns about potential XSS with v-html
 */
const "no-v-html": ESLintRule;

/**
 * v-model argument restrictions
 * Prevents arguments on v-model in Vue 2
 */
const "no-v-model-argument": ESLintRule;

/**
 * v-text usage restrictions
 * Prevents v-text on component tags
 */
const "no-v-text": ESLintRule;
const "no-v-text-v-html-on-component": ESLintRule;

/**
 * Boolean attribute shorthand preference
 * Enforces shorthand for boolean attributes
 */
const "prefer-true-attribute-shorthand": ESLintRule;

/**
 * Transition toggle requirement
 * Requires toggle inside transition components
 */
const "require-toggle-inside-transition": ESLintRule;

/**
 * v-for key requirement
 * Requires key attribute with v-for
 */
const "require-v-for-key": ESLintRule;

/**
 * Exact event modifier usage
 * Enforces use of .exact modifier for specific cases
 */
const "use-v-on-exact": ESLintRule;

/**
 * Directive style preferences
 * Controls directive shorthand vs full syntax
 */
const "v-bind-style": ESLintRule;
const "v-for-delimiter-style": ESLintRule;
const "v-on-event-hyphenation": ESLintRule;
const "v-on-handler-style": ESLintRule;
const "v-on-style": ESLintRule;
const "v-slot-style": ESLintRule;

Vue Lifecycle and Composition API Rules

Rules for Vue lifecycle methods, Composition API usage, and script setup patterns.

/**
 * Arrow functions in watchers
 * Prevents arrow functions in watch handlers
 */
const "no-arrow-functions-in-watch": ESLintRule;

/**
 * Async computed properties
 * Prevents async functions in computed properties
 */
const "no-async-in-computed-properties": ESLintRule;

/**
 * Computed properties in data
 * Prevents computed properties inside data function
 */
const "no-computed-properties-in-data": ESLintRule;

/**
 * Deprecated lifecycle methods
 * Prevents usage of deprecated Vue 2 lifecycle hooks
 */
const "no-deprecated-destroyed-lifecycle": ESLintRule;

/**
 * Script setup export restrictions
 * Prevents exports in script setup blocks
 */
const "no-export-in-script-setup": ESLintRule;

/**
 * Expose after await restrictions
 * Prevents defineExpose after await in script setup
 */
const "no-expose-after-await": ESLintRule;

/**
 * Lifecycle after await restrictions
 * Prevents lifecycle hooks after await in script setup
 */
const "no-lifecycle-after-await": ESLintRule;

/**
 * Props reactivity loss prevention
 * Prevents destructuring props that loses reactivity
 */
const "no-setup-props-reactivity-loss": ESLintRule;

/**
 * Watch after await restrictions
 * Prevents watch calls after await in script setup
 */
const "no-watch-after-await": ESLintRule;

/**
 * Vue import preferences
 * Prefers importing from 'vue' over '@vue/composition-api'
 */
const "prefer-import-from-vue": ESLintRule;

/**
 * Explicit emits requirement
 * Requires explicit emit declarations
 */
const "require-explicit-emits": ESLintRule;

/**
 * Explicit slots requirement
 * Requires explicit slot definitions
 */
const "require-explicit-slots": ESLintRule;

/**
 * Expose requirement
 * Requires defineExpose for script setup components
 */
const "require-expose": ESLintRule;

/**
 * Macro variable naming
 * Enforces naming conventions for macro variables
 */
const "require-macro-variable-name": ESLintRule;

Vue Props and Events Rules

Rules governing props definition, validation, and event handling patterns.

/**
 * Boolean prop default values
 * Controls default values for boolean props
 */
const "no-boolean-default": ESLintRule;

/**
 * Props mutation prevention
 * Prevents direct mutation of props
 */
const "no-mutating-props": ESLintRule;

/**
 * Required props with defaults
 * Prevents required props that have default values
 */
const "no-required-prop-with-default": ESLintRule;

/**
 * Reserved prop names
 * Prevents using reserved names for props
 */
const "no-reserved-props": ESLintRule;

/**
 * Unused emit declarations
 * Detects declared but unused emits
 */
const "no-unused-emit-declarations": ESLintRule;

/**
 * Unused component properties
 * Detects unused props, data, computed, methods
 */
const "no-unused-properties": ESLintRule;

/**
 * Boolean prop type ordering
 * Enforces Boolean as first type in union types
 */
const "prefer-prop-type-boolean-first": ESLintRule;

/**
 * Default prop values
 * Requires default values for non-required props
 */
const "require-default-prop": ESLintRule;

/**
 * Emit validator functions
 * Requires validator functions for emits
 */
const "require-emit-validator": ESLintRule;

/**
 * Prop comment documentation
 * Requires comments for prop definitions
 */
const "require-prop-comment": ESLintRule;

/**
 * Prop type constructors
 * Requires constructor functions for prop types
 */
const "require-prop-type-constructor": ESLintRule;

/**
 * Prop types requirement
 * Requires type definitions for all props
 */
const "require-prop-types": ESLintRule;

/**
 * Typed object props
 * Requires type annotations for object props
 */
const "require-typed-object-prop": ESLintRule;

/**
 * Typed refs requirement
 * Requires type annotations for ref declarations
 */
const "require-typed-ref": ESLintRule;

/**
 * Valid prop defaults
 * Validates default values match prop types
 */
const "require-valid-default-prop": ESLintRule;

Vue Reactivity and State Rules

Rules for managing Vue reactivity, computed properties, and state mutations.

/**
 * Ref as operand prevention
 * Prevents using refs directly in expressions
 */
const "no-ref-as-operand": ESLintRule;

/**
 * Ref object reactivity loss
 * Prevents destructuring that loses ref reactivity
 */
const "no-ref-object-reactivity-loss": ESLintRule;

/**
 * Side effects in computed properties
 * Prevents side effects in computed property getters
 */
const "no-side-effects-in-computed-properties": ESLintRule;

/**
 * Computed property method usage
 * Prevents calling computed properties as methods
 */
const "no-use-computed-property-like-method": ESLintRule;

/**
 * Template ref preferences
 * Prefers useTemplateRef over string refs
 */
const "prefer-use-template-ref": ESLintRule;

/**
 * Computed property return requirement
 * Requires return statements in computed properties
 */
const "return-in-computed-property": ESLintRule;

/**
 * Emit validator return requirement
 * Requires return statements in emit validators
 */
const "return-in-emits-validator": ESLintRule;

Rule Access Pattern

Rules are accessed as properties of the plugin's rules object:

/**
 * Accessing individual rules from the plugin
 * Each rule is an ESLint-compatible rule object
 */
const rules: PluginRules = eslintPluginVue.rules;

// Access specific rule
const multiWordRule: ESLintRule = rules["multi-word-component-names"];
const attributeHyphenRule: ESLintRule = rules["attribute-hyphenation"];

// Rule metadata
const ruleMeta: RuleMeta = multiWordRule.meta;
const ruleDescription: string = ruleMeta.docs.description;
const ruleCategories: string[] = ruleMeta.docs.categories || [];

// Rule implementation
const ruleCreate: (context: RuleContext) => RuleListener = multiWordRule.create;

Usage Example:

import eslintPluginVue from "eslint-plugin-vue";

// Use individual rules in manual configuration
export default [
  {
    files: ["*.vue"],
    plugins: {
      vue: eslintPluginVue,
    },
    rules: {
      // Configure specific rules
      "vue/multi-word-component-names": "error",
      "vue/attribute-hyphenation": ["error", "always"],
      "vue/component-name-in-template-casing": ["error", "PascalCase"],
      
      // Disable specific rules
      "vue/html-self-closing": "off",
      "vue/max-attributes-per-line": "off",
    },
  },
];

Types

interface PluginRules {
  [ruleName: string]: ESLintRule;
}

interface ESLintRule {
  meta: RuleMeta;
  create: (context: RuleContext) => RuleListener;
}

interface RuleMeta {
  type: "problem" | "suggestion" | "layout";
  docs: {
    description: string;
    categories?: string[];
    url: string;
    extensionSource?: {
      url: string;
      name: string;
    };
  };
  fixable?: "code" | "whitespace";
  schema?: JSONSchema;
  deprecated?: boolean;
  replacedBy?: string[];
}

interface RuleContext {
  /** Get source code object for the file being linted */
  getSourceCode(): SourceCode;
  /** Report a linting violation */
  report(descriptor: ReportDescriptor): void;
  /** Rule configuration options */
  options: any[];
  /** Current file name */
  filename: string;
  /** Current file path */
  getFilename(): string;
  /** ESLint scope manager */
  getScope?(): Scope;
  /** Mark variable as used (legacy) */
  markVariableAsUsed?(name: string): void;
  /** Get current scope (legacy) */
  getSourceCode(): SourceCode;
}

type RuleListener = Record<string, (node: ASTNode) => void>;

interface ReportDescriptor {
  /** AST node where the issue occurred */
  node?: ASTNode;
  /** Location where the issue occurred */
  loc?: SourceLocation;
  /** Issue message */
  message: string;
  /** Message template ID */
  messageId?: string;
  /** Data for message template */
  data?: Record<string, any>;
  /** Fix information */
  fix?: (fixer: RuleFixer) => Fix | Fix[] | null;
  /** Suggestion fixes */
  suggest?: SuggestionReportDescriptor[];
}

interface SourceCode {
  /** Get tokens for a node */
  getTokens(node: ASTNode): Token[];
  /** Get source text for a node */
  getText(node?: ASTNode): string;
  /** Get all comments */
  getAllComments(): Comment[];
  /** Parser services for Vue templates */
  parserServices?: ParserServices;
}

interface ParserServices {
  /** Get template body token store */
  getTemplateBodyTokenStore?(): TokenStore;
  /** Define template body visitor */
  defineTemplateBodyVisitor?(
    templateVisitor: TemplateListener,
    scriptVisitor?: RuleListener
  ): RuleListener;
  /** Get document fragment */
  getDocumentFragment?(): VDocumentFragment;
}

type TemplateListener = Record<string, (node: VNode) => void>;
type JSONSchema = object;
type ASTNode = object;
type VNode = object;
type SourceLocation = object;
type Token = object;
type Comment = object;
type Fix = object;
type RuleFixer = object;