If there is a force $\mathbf F(x)=ax\hat i$ and an object is moving from $x_2$ to $x_1$ in the opposite direction of force. Then work could be calculated as follows
$$\int_{x_2}^{x_1} -F(x)\cdot\text dx$$
here minus is because the direction between F(x) and dx are anti parallel
$$-\int_{x2}^{x1} ax.dx$$ $$-a(\frac{x1^2-x2^2}{2})$$
since x1 < x2 therefore $$x1^2<x2^2$$ so $$x1^2-x2^2 < 0$$ and $$-a(\frac{x1^2-x2^2}{2})$$ will be positive
so my calculation shows that the work done in going against the force is positive which is absolute wrong. please correct me!