eslint-plugin-getsentry
raw JSON → 2.0.0 verified Sat Apr 25 auth: no javascript
Custom ESLint plugin providing rules specific to Sentry's development workflow, such as enforcing internationalized strings in JSX. Version 2.0.0 is the latest stable release, actively maintained alongside the getsentry/sentry project. Differentiates from generic linting by catering to Sentry's codebase conventions, focusing on preventing untranslated UI strings.
Common errors
error Error: Failed to load plugin 'getsentry' declared in '.eslintrc': Cannot find module 'eslint-plugin-getsentry' ↓
cause Plugin is not installed or missing from node_modules.
fix
Run 'npm install eslint-plugin-getsentry --save-dev'.
error ESLint configuration in .eslintrc.json is invalid: - Rule 'getsentry/jsx-needs-il8n' is not defined ↓
cause Plugin is not listed in the 'plugins' array.
fix
Add 'getsentry' to the plugins array in your ESLint config.
error Parsing error: Unexpected token < in file.jsx ↓
cause ESLint is not configured to parse JSX syntax.
fix
Set 'ecmaFeatures: { jsx: true }' or use a parser like '@babel/eslint-parser'.
Warnings
gotcha The rule name is 'jsx-needs-il8n' (note the capital I and digit 8, not 'i18n'). ↓
fix Use exact rule name 'jsx-needs-il8n' in your ESLint configuration.
deprecated Some older rules from previous versions may have been removed; check changelog when upgrading. ↓
fix Review current set of supported rules in the plugin documentation.
breaking ESLint peer dependency requirement may change between major versions. ↓
fix Ensure eslint is a peer dependency (version 8+ recommended for plugin v2).
Install
npm install eslint-plugin-getsentry yarn add eslint-plugin-getsentry pnpm add eslint-plugin-getsentry Imports
- plugin wrong
const getsentry = require('eslint-plugin-getsentry')correctimport getsentry from 'eslint-plugin-getsentry' - rules wrong
import { rules } from 'eslint-plugin-getsentry'correctconst { rules } = require('eslint-plugin-getsentry') - configs wrong
import configs from 'eslint-plugin-getsentry'correctconst { configs } = require('eslint-plugin-getsentry')
Quickstart
// .eslintrc.js
module.exports = {
plugins: ['getsentry'],
rules: {
'getsentry/jsx-needs-il8n': 'warn'
}
};
// component.jsx
function MyComponent() {
return <div>Hello</div>; // triggers warning: string literal should be wrapped for i18n
}