as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
Ring
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
跳转到主要内容
The Vega ESLint plugin, eslint-plugin-kepler, provides automated linting rules for Vega apps, helping you discover and fix performance, compatibility, and accessibility issues.

Prerequisites

Install the plugin and its dependencies:

Configure the plugin

  1. Update extends, plugins, and overrides sections of your .eslintrc configuration file:
    The kepler configuration includes all Vega rules. To use a subset of rules, extend one or more of these configurations instead:
    • performance - Performance-related rules only
    • system-distributed-libs - System distributed library checks only (package.json validation and import informational flagging)
    • accessibility - Accessibility rules only
    For example, to use only the performance and system distributed library rules:
    To use only the accessibility rules:
    Save the file. ESLint now loads the Vega rules the next time you run the linter.
  2. (Optional) To customize lint rules, follow ESLint’s configure rules guide. If you skip this step, all rules run at their default severities. For rules provided by the Vega ESLint plugin, see Understand the performance rules, Understand the system distributed library rules, and Understand the accessibility rules.
  3. Specify the custom formatter in the lint script of your package.json file:
    Your lint script now uses the Vega custom formatter.
  4. Run the linter:
    If package.json warnings don’t appear, confirm jsonc-eslint-parser is installed and that package.json is passed to the eslint command. You can see the result on the console: The output display shown in the console after running the linter. The linter also generates an HTML report: A screenshot that shows the ESLint analysis report for a Vega project, highlighting two performance-related warnings: missing implementation of useReportFullyDrawn() for time-to-fully-drawn metrics and usePreventHideSplashScreen() for splash screen optimization. The report indicates no critical errors in the codebase. You can check these linter warnings on VS Code while hovering over your code: A screenshot that shows a linter warning on VS Code.

Understand the performance rules

The following rules help identify common performance issues in Vega apps and enforce best practices for optimal runtime performance. In the rule tables on this page, an Error rule flags issues and fails the build. A Warn rule flags issues but doesn’t fail the build.

Understand the system distributed library rules

The following rules detect system distributed library usage and guide you on proper implementation.

(Optional) configure semantic version guidance

The system distributed library rules check semantic versioning in your package.json dependencies. By default, the plugin uses auto mode to detect your project’s versioning settings. Override the default by setting the semverGuidance option:
  • Patch only mode (semverGuidance: "patch"): Restricts updates to patches using ~ prefix.
  • Minor and patch mode (semverGuidance: "minor"): Allows minor updates using ^ prefix.
  • Auto mode (semverGuidance: "auto"): Detects settings based on project signatures in the project repo. This is the default.
Example configuration using patch-only mode:

Understand the accessibility rules

The following rules flag components that assistive technologies, such as screen readers, can’t describe or operate correctly. For guidance on the accessibility props these rules check, see Accessibility for React Native 0.83 or React Native 0.72. To change the severity of an accessibility rule, override it in the rules section of your ESLint configuration:
To suppress a rule for a single element, add a standard ESLint suppression comment on the line before it:
To find and fix these issues as you edit, use the A11y Inspector in Vega Studio. It uses the same rules and recognizes the same suppression comments.

(Optional) configure VS Code for JSON validation

If you want to see errors and warnings in VS Code’s package.json, add json to these settings.json entries:

最后修改于 2026年10月30日