jsx-eslint / eslint-plugin-jsx-a11y

Static AST checker for a11y rules on JSX elements.
MIT License
3.42k stars 637 forks source link

Recommended approach for separating ESLint and eslint-plugin-jsx-a11y configurations #1036

Open chillkang opened 2 weeks ago

chillkang commented 2 weeks ago

Description: I recently integrated the eslint-plugin-jsx-a11y linter into our codebase to help identify and resolve accessibility issues. My goal is to maintain a clear separation between the general JavaScript/TypeScript linting and the accessibility-specific linting, so that I can view the two sets of errors separately.

The Issue: To keep accessibility errors separate from general linting errors, I created an additional configuration file, eslint-a11y.config.js, alongside our existing .eslintrc.js. For example, I can now run lint-js and lint-a11y scripts separately and view general lint and accessibility errors independently. However, when running both configurations, I noticed overlapping errors, so I disabled non-accessibility-related rules in eslint-a11y.config.js to ensure it only reports accessibility issues.

Question: Is this approach considered best practice, or would it be preferable to consolidate both configurations into a single .eslintrc.js file with eslint-plugin-jsx-a11y included in the plugin section? I would appreciate any guidance on managing multiple ESLint configurations or recommendations on maintaining this setup effectively. Thanks!

ljharb commented 2 weeks ago

I don't understand why you'd want to keep them separate - errors are errors.