Add eslint and fix security context switch

To properly switch security contexts properly without raising
exceptions you need to change GID first and then UID.