Multiple states

Company resides in Massachusetts.  I live and worked in Rhode Island but the company pays  Massachusetts state tax.  Do I file in Massachusetts or Rhode Island?