Cook the pasta according to package directions until al dente.
While the pasta is cooking, heat olive oil in a large skillet over medium heat. Add garlic and red pepper flakes (if using) and cook until fragrant, about 1 minute.
Add artichoke hearts to the skillet and cook for 5 minutes, stirring occasionally.
Stir in lemon juice, salt, and pepper. Bring to a simmer.
Drain the pasta and add it to the skillet with the artichoke mixture. Toss to combine.
Remove from heat and stir in Parmesan cheese and parsley. Serve immediately.