1.1.0 • Published 6 years ago
@dzek69/eslint-config-react-native v1.1.0
eslint-config-react-native
This is my preferred React Native code style linting rules. You'll probably hate them.
In case you need general React rules see my React rules
Idea behind these
No useless code, no hardcodes, no mess. Very opinionated.
Installation
Installation steps assumes you've already configured base eslint config, ie: installed my base rules.
npm i eslint-plugin-react-native @dzek69/eslint-config-react-native --save-devIn your .eslintrc file add the rules in extends array:
{
"extends": [
"@dzek69/eslint-config-react-native"
]
}It will automatically enable jsx, define react-native plugin and enable some React Native browser-like globals.
Then to lint src and test directories with subdirectories run:
npx eslint src/**/*.js src/*.js test/**/*.js test/*.jsFull config example
This is full config that I am using in one of my projects, feel free to take inspiration:
{
"extends": [
"@dzek69/eslint-config-base",
"@dzek69/eslint-config-react",
"@dzek69/eslint-config-react-native"
],
"env": {
"node": true
},
"overrides": [
{
"files": ["src/*.spec.js", "src/**/*.spec.js"],
"env": {
"mocha": true
},
"rules": {
"global-require": "off",
"max-lines": "off",
"max-lines-per-function": "off",
"max-statements": "off",
"no-magic-numbers": "off",
"react/no-multi-comp": "off"
}
}
],
"settings": {
"react": {
"createClass": "createReactClass",
"pragma": "React",
"version": "detect",
"flowVersion": "detect"
},
"propWrapperFunctions": []
}
}License
MIT