I have always painted all woodwork first so that the paint can go up to the wall and fill any small cracks where the skirting joins the wall. Then, paint the walls so that any drops of paint on the woodwork can be wiped off with a rag and a drop of methylated spirits - it may need a good rub if the paint has dried too much.
However, with modern water based paints I notice that the meths can lift the paint so am wondering whether painting the walls first is a better scheme.
What other people do in this situation?