Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESLint rule: process-env-computed #8612

Merged
merged 25 commits into from
Jun 15, 2023

Conversation

Tobbe
Copy link
Member

@Tobbe Tobbe commented Jun 14, 2023

Vite allows process.env['ENV_VAR'] when running the dev server, but not when building.

We want to warn as soon as possible, so I've written an ESLint plugin rule that errors out on the array access syntax

image

Here's a codemod that does the change for you: #8611
The idea is people run the codemod to fix all existing errors in their projects. And then this lint rule will make sure they don't introduce this error again anywhere

@Tobbe Tobbe changed the title ESLint rule: process env computed ESLint rule: process-env-computed Jun 14, 2023
@Tobbe Tobbe added the release:feature This PR introduces a new feature label Jun 14, 2023
@Tobbe Tobbe added this to the v6.0.0 milestone Jun 14, 2023
Copy link
Contributor

@jtoar jtoar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Tobbe this is great! Did a quick review and left a few comments

packages/eslint-plugin/package.json Outdated Show resolved Hide resolved
packages/eslint-plugin/package.json Show resolved Hide resolved
packages/eslint-config/shared.js Outdated Show resolved Hide resolved
@Tobbe Tobbe enabled auto-merge (squash) June 15, 2023 07:26
@Tobbe Tobbe merged commit 7413755 into redwoodjs:main Jun 15, 2023
28 checks passed
@redwoodjs-bot redwoodjs-bot bot modified the milestones: v6.0.0, next-release Jun 15, 2023
@jtoar jtoar modified the milestones: next-release, v6.0.0 Jun 15, 2023
@Tobbe Tobbe deleted the tobbe-eslint-plugin-process-env-computed branch June 16, 2023 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:feature This PR introduces a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants