eslint-config-react-native-strict
v0.2.0
Published
React Native's ESLint config with every warning promoted to an error
Maintainers
Readme
eslint-config-react-native-strict
React Native's official ESLint config (@react-native/eslint-config) with
every warn-level rule promoted to error - so your project's lint config
is only ever error or off, never warn.
Why
A permanent warn is a deferred decision that rots into ignored noise:
- If a rule matters, it should be an
error- Lint fails and requires a fix. - If it doesn't, it should be
off- explicitly, on purpose.
A warn is neither. Lint should return zero errors and zero warnings.
This preset removes the middle option from React Native's defaults, leaving
one decision per rule: error or off.
Install
yarn add -D eslint-config-react-native-strict@react-native/eslint-config and eslint are peer dependencies - already
present in React Native projects (>=0.72). This preset derives from whatever
version of @react-native/eslint-config you have installed, so it tracks React
Native upgrades automatically; there is no hand-maintained rule list.
Usage
In .eslintrc.js:
module.exports = {
root: true,
extends: ['react-native-strict'],
rules: {
// Deliberate, documented exceptions - turn rules OFF, never to warn:
'react-native/no-inline-styles': 'off', // inline styles are fine here
'no-bitwise': 'off', // bitwise ops are intentional
},
};How it works
The whole package is one pure function applied to the config you already have:
strictify(require('@react-native/eslint-config'));It flips every warn to error - preserving each rule's options and recursing
into overrides - and leaves off and error untouched. It is rule-agnostic
by design: it changes only severity, never which rules exist. Deciding which
rules belong in your project is your job - extend this preset for the severity
policy, then turn off the ones you don't want.
Deprecated rules
Because the transform is pure, React Native's handful of deprecated ESLint rules
(no-catch-shadow, no-negated-in-lhs, no-mixed-requires, no-new-require,
no-path-concat, no-restricted-modules, handle-callback-err) are promoted
to error too. Turn them off like other exceptions if you don't want them.
License
MIT
