Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ESLint dev setup and errors #421

Merged
merged 2 commits into from
Nov 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"test": "npm run format && npm run lint && npm run test:unit",
"test:unit": "jest",
"format": "prettier --write --list-different './src/**/*.js'",
"lint": "eslint --fix './src/**/*.js'",
"precommit": "lint-staged"
"lint": "eslint './src/**/*.js'"
},
"main": "src/Animated.js",
"types": "react-native-reanimated.d.ts",
Expand Down Expand Up @@ -39,21 +38,35 @@
"homepage": "https://github.com/kmagiera/react-native-reanimated#readme",
"dependencies": {},
"devDependencies": {
"@react-native-community/eslint-config": "^0.0.5",
"@types/react": "^16.9.0",
"@types/react-native": "^0.61.0",
"@types/react-native": "0.60.19",
"babel-eslint": "^10.0.3",
"babel-jest": "^24.9.0",
"husky": "^0.14.3",
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.4.0",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"husky": "^3.0.9",
"jest": "^24.9.0",
"lint-staged": "^8.0.0-beta.1",
"lint-staged": "^9.4.2",
"prettier": "^1.13.7",
"react": "^16.9.0",
"react-native": "^0.61.0",
"react-test-renderer": "16.9.0"
},
"lint-staged": {
"*.js": [
"prettier --write",
"eslint",
"git add"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}
6 changes: 6 additions & 0 deletions src/Animated.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ describe('Reanimated backward compatible API', () => {
this.transX = new Value(0);
this.anim = animation.node(this.transX, animation.config);
}

start(method) {
this.anim.start(method);
}

stop(res) {
this.anim.__stopImmediately_testOnly(res);
}

render() {
return (
<Animated.View style={{ transform: [{ translateX: this.transX }] }} />
Expand Down Expand Up @@ -118,12 +121,15 @@ describe('Reanimated backward compatible API', () => {
this.anim = timing(this.transX, config);
this.anim2 = timing(this.transX, config);
}

start1(method) {
this.anim.start(method);
}

start2(method) {
this.anim2.start(method);
}

render() {
return (
<Animated.View style={{ transform: [{ translateX: this.transX }] }} />
Expand Down
5 changes: 5 additions & 0 deletions src/Transitioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class In extends React.Component {
componentDidMount() {
this.props.context.push(configFromProps('in', this.props));
}

render() {
return this.props.children || null;
}
Expand All @@ -53,6 +54,7 @@ class Change extends React.Component {
componentDidMount() {
this.props.context.push(configFromProps('change', this.props));
}

render() {
return this.props.children || null;
}
Expand All @@ -62,6 +64,7 @@ class Out extends React.Component {
componentDidMount() {
this.props.context.push(configFromProps('out', this.props));
}

render() {
return this.props.children || null;
}
Expand All @@ -74,6 +77,7 @@ class Together extends React.Component {
config.transitions = this.transitions;
this.props.context.push(config);
}

render() {
return (
<TransitioningContext.Provider value={this.transitions}>
Expand All @@ -91,6 +95,7 @@ class Sequence extends React.Component {
config.transitions = this.transitions;
this.props.context.push(config);
}

render() {
return (
<TransitioningContext.Provider value={this.transitions}>
Expand Down
1 change: 1 addition & 0 deletions src/animations/DecayAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class DecayAnimation extends Animation {
stop() {
// not implemented yet
}

static getDefaultState() {
return {
position: new AnimatedValue(0),
Expand Down
1 change: 1 addition & 0 deletions src/animations/SpringAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export default class SpringAnimation extends Animation {
stop() {
// this._finished && this._finished.setValue(1);
}

static getDefaultState() {
return {
position: new AnimatedValue(0),
Expand Down
6 changes: 3 additions & 3 deletions src/animations/SpringUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ function fromBouncinessAndSpeedNodes(bounciness, speed, rest) {

let b = normalize(divide(bounciness, 1.7), 0, 20);
b = projectNormal(b, 0, 0.8);
let s = normalize(divide(speed, 1.7), 0, 20);
let bouncyTension = projectNormal(s, 0.5, 200);
let bouncyFriction = quadraticOutInterpolation(
const s = normalize(divide(speed, 1.7), 0, 20);
const bouncyTension = projectNormal(s, 0.5, 200);
const bouncyFriction = quadraticOutInterpolation(
b,
b3Nobounce(bouncyTension),
0.01
Expand Down
1 change: 1 addition & 0 deletions src/animations/TimingAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export default class TimingAnimation extends Animation {
stop() {
// this._finished && this._finished.setValue(1);
}

static getDefaultState() {
return {
position: new AnimatedValue(0),
Expand Down
2 changes: 1 addition & 1 deletion src/animations/backwardCompatibleAnimWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
startClock,
stopClock,
} from '../base';
import { default as Clock } from '../core/AnimatedClock';
import { clock as Clock } from '../core/AnimatedClock';
import { evaluateOnce } from '../derived/evaluateOnce';

function createOldAnimationObject(node, AnimationClass, value, config) {
Expand Down
1 change: 1 addition & 0 deletions src/core/AnimatedFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export function createAnimatedFunction(cb) {
for (let i = 0; i < params.length; i++) {
params[i] = createAnimatedParam();
}
// eslint-disable-next-line standard/no-callback-literal
const what = cb(...params);
const func = new AnimatedFunction(what, ...params);
return (...args) => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/InternalAnimatedValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function sanitizeValue(value) {
const CONSTANT_VALUES = new Map();

function initializeConstantValues() {
if (CONSTANT_VALUES.size != 0) {
if (CONSTANT_VALUES.size !== 0) {
return;
}
[0, -1, 1, -2, 2].forEach(v =>
Expand Down
2 changes: 1 addition & 1 deletion src/core/createEventObjectProxyPolyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function createEventObjectProxyPolyfill() {
contentInset: { right: {}, top: {}, left: {}, bottom: {} },
};
const traverse = obj => {
for (let key in obj) {
for (const key in obj) {
obj[key].__isProxy = true;
traverse(obj[key]);
}
Expand Down
Loading