If it's crucial to the story them go ahead, but scripted shows aren't documentaries and aren't obliged to use marginalised people's historical pain for your entertainment and desire for historical accuracy.
I don't particularly enjoy a lot of what is on TV. And i do think that content warnings, used properly, would alert people as to what might be coming. If I'm reading a historical novel, set at the time of the American Civil war, and characters are speaking to each other - i would absolutely expect authentic language. I wouldn't expect the exposition moving the novel forward to use that same language.
I also think that using racist language (or sexist, or homophobic) in literature, or "torture porn" in TV shows (Criminal Minds is one that springs to mind, just hours and hours of torture porn) for shock value is cheap and doesn't generally get past my internal censor. What doesn't work doesn't work as far as i'm concerned. But unless I'm reading fantasy, i don't want 21st century morals imposed on an 18th century character.
PP mentioned Bernard Cornwell. I only really like the Sharpe novels, the rest are a bit bloated for me. But i don't want Sharpe being OK with gay soldiers and whatever because back then it wasn't allowed. Far from it. He wouldn't be going "ok, chaps, don't mind me, don't ask don't tell" he'd be "oi, yer bastards" and then punch one of them. I also don't want past racism or homophobia or whatever all over a novel where the focus isn't, say, the abolitionists. But equally I don't want modern sensibilities in there unless it's an alternate reality fantasy book. Then it can be a really interesting literary device.
I don't read historical novels because i get a thrill if someone makes anti-semitic slurs at a Shylock type character. But i do expect some measure of authenticity.
Also pp are conflating two things here. We're not talking about revising books that were written in the past. We're talking about modern literature which is in a historical setting.
I note there are a few people on the thread who work in publishing. What would help people not having to read novels where they encounter things like this (either, authentic historical-style speech or modern speech in historical settings) is if there would be a proper blurb on the back of the book instead of a dozen simpering reviews of how great it is with no clue as to the content. But that's a whole other AIBU