Files
react-native-reanimated/.eslintrc.js
Mateo Hrastnik c39e67281e Better error messages when using Animated.Code (#239)
Added improved error messages to Animated.Code when wrong props are passed to the component. Also, unified the types both the exec and children can accept. Both `exec` and `children` can now accept a node or a function returning a node.

Example:
```
const node = block([...]);
const nodeFn = () => node;
// All of the following lines are now valid
<Animated.Code exec={node} />
<Animated.Code exec={nodeFn} />
<Animated.Code>{node}</Animated.Code>
<Animated.Code>{nodeFn}</Animated.Code>
```

I've created some tests to assert the error is being thrown when wrong prop types are provided. I've create a separate suite for testing Animated* components. I'm not really skilled in writing tests so this might be wrong. 

Also, I've added the `jsx-uses-react` eslint rule to prevent false negatives when React is imported without using it directly, as JSX is using React implicitly. More info here: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
2019-04-10 13:02:41 +02:00

21 lines
413 B
JavaScript

module.exports = {
parser: 'babel-eslint',
extends: [
'standard',
'prettier',
'prettier/flowtype',
'prettier/react',
'prettier/standard',
],
plugins: ['react', 'react-native', 'import', 'jest'],
env: {
'react-native/react-native': true,
'jest/globals': true,
},
rules: {
'import/no-unresolved': 2,
'react/jsx-uses-vars': 2,
'react/jsx-uses-react': 2,
},
};