Skip to content

Commit

Permalink
Warn users about obsolete future flags in remix.config.js (#7048)
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 authored Aug 4, 2023
1 parent a57d200 commit fc3be8c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-seals-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": minor
---

Warn users about obsolete future flags in remix.config.js
31 changes: 31 additions & 0 deletions packages/remix-dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,39 @@ export async function readConfig(
tsconfigPath = rootJsConfig;
}

// Note: When a future flag is removed from here, it should be added to the
// list below so we can let folks know if they have obsolete flags in their
// config. If we ever convert remix.config.js to a TS file so we get proper
// typings this won't be necessary anymore.
let future: FutureConfig = {};

if (appConfig.future) {
let userFlags = appConfig.future;
let deprecatedFlags = [
"unstable_cssModules",
"unstable_cssSideEffectImports",
"unstable_dev",
"unstable_postcss",
"unstable_tailwind",
"unstable_vanillaExtract",
"v2_dev",
"v2_errorBoundary",
"v2_headers",
"v2_meta",
"v2_normalizeFormMethod",
"v2_routeConvention",
] as const;

let obsoleteFlags = deprecatedFlags.filter((f) => f in userFlags);
if (obsoleteFlags.length > 0) {
logger.warn(
`⚠️ REMIX FUTURE CHANGE: the following Remix future flags are now obsolete ` +
`and can be removed from your remix.config.js file:\n` +
obsoleteFlags.map((f) => `- ${f}\n`).join("")
);
}
}

return {
appDirectory,
cacheDirectory,
Expand Down
8 changes: 0 additions & 8 deletions packages/remix-dev/warnOnce.ts

This file was deleted.

0 comments on commit fc3be8c

Please sign in to comment.