California passed legislation Tuesday that would make it the first large state to mandate completely carbon-free electricity generation, with a target of 2045.

If signed into law by Gov. Jerry Brown, the bill would keep the nation’s most populous state at the forefront of environmental regulation trends and could have a big impact on electricity generation beyond California’s borders. In 2017, California imported roughly 30% of its electricity generation, according to state data.

Though...