Registry / testing / eslint-plugin-taro

eslint-plugin-taro

JSON →
library4.2.0jsnpmunverified

ESLint plugin providing Taro-specific linting rules for Taro multi-platform applications. Current version is 4.2.0, released alongside Taro 4.x. It enforces best practices for Taro's React-like JSX syntax and prevents platform-specific issues. Key differentiator: built for Taro's compile-time JSX transformation, with rules unavailable in standard React ESLint plugins. Release cadence follows Taro's major versions. Requires ESLint 8.x and @babel/eslint-parser 7.24.1+.

testing
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ESM-compatible; CommonJS require also works but ESM is preferred for modern builds.

import taro from 'eslint-plugin-taro'

Use the preset directly via 'plugin:'. Do not specify full package path.

extends: ['plugin:taro/recommended']

All rule names must be prefixed with 'taro/' to avoid collisions.

rules: { 'taro/no-spread-in-props': 'error' }

Basic ESLint config for Taro 4+ projects: uses @babel/eslint-parser, enables recommended rules, and adds two custom rules.

// .eslintrc.cjs module.exports = { root: true, env: { browser: true, es2020: true }, extends: ['eslint:recommended', 'plugin:taro/recommended'], parser: '@babel/eslint-parser', parserOptions: { requireConfigFile: false, babelOptions: { presets: [['babel-preset-taro', { framework: 'react' }]] } }, plugins: ['taro'], rules: { 'taro/no-spread-in-props': 'error', 'taro/manipulate-jsx-as-array': 'warn' } };
Debug
Known footguns
breakingFrom Taro 4, @babel/eslint-parser is required (replaced babel-eslint). Not updating breaks parsing.
breakingTaro 4 requires ESLint 8.x; ESLint 9 not supported. Using ESLint 9 causes parsing errors.
breakingTaro 3 to Taro 4 migration: some rule names changed (e.g., 'no-spread-in-props' -> 'taro/no-spread-in-props').
deprecatedRule 'taro/no-stateless-function' removed in v4; use ESLint built-in 'react/prefer-stateless-function' instead.
gotchaThe parser option 'requireConfigFile: false' must be set; otherwise @babel/eslint-parser expects a Babel config file.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
8 hits · last 30 days
gptbot
3
ahrefsbot
2
Resources