Skip to content

Commit

Permalink
feat(remix-eslint-config): enable deprecated imports warnings (remix-…
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey authored and justjavac committed Jun 11, 2022
1 parent a5b4c0d commit b749a2d
Showing 1 changed file with 37 additions and 38 deletions.
75 changes: 37 additions & 38 deletions packages/remix-eslint-config/rules/core.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
// const {
// defaultAdapterExports,
// defaultRuntimeExports,
// architectSpecificExports,
// cloudflareSpecificExports,
// cloudflarePagesSpecificExports,
// cloudflareWorkersSpecificExports,
// nodeSpecificExports,
// reactSpecificExports,
// } = require("./packageExports");
const {
defaultAdapterExports,
defaultRuntimeExports,
architectSpecificExports,
cloudflareSpecificExports,
cloudflarePagesSpecificExports,
cloudflareWorkersSpecificExports,
nodeSpecificExports,
reactSpecificExports,
} = require("./packageExports");

// const OFF = 0;
const WARN = 1;
const ERROR = 2;

// const getReplaceRemixImportsMessage = (packageName) =>
// `All \`remix\` exports are considered deprecated as of v1.3.3. Please use \`@remix-run/${packageName}\` instead. You can run \`remix migrate --migration replace-remix-imports\` to automatically migrate your code.`;
const getReplaceRemixImportsMessage = (packageName) =>
`All \`remix\` exports are considered deprecated as of v1.3.3. Please use \`@remix-run/${packageName}\` instead. You can run \`remix migrate --migration replace-remix-imports\` to automatically migrate your code.`;

// const replaceRemixImportsOptions = [
// {
// packageExports: defaultAdapterExports,
// packageName:
// "{architect|cloudflare-pages|cloudflare-workers|express|netlify|vercel}",
// },
// { packageExports: defaultRuntimeExports, packageName: "{cloudflare|node}" },
// { packageExports: architectSpecificExports, packageName: "architect" },
// { packageExports: cloudflareSpecificExports, packageName: "cloudflare" },
// {
// packageExports: cloudflarePagesSpecificExports,
// packageName: "cloudflare-pages",
// },
// {
// packageExports: cloudflareWorkersSpecificExports,
// packageName: "cloudflare-workers",
// },
// { packageExports: nodeSpecificExports, packageName: "node" },
// { packageExports: reactSpecificExports, packageName: "react" },
// ].map(({ packageExports, packageName }) => ({
// importNames: [...packageExports.value, ...packageExports.type],
// message: getReplaceRemixImportsMessage(packageName),
// name: "remix",
// }));
const replaceRemixImportsOptions = [
{
packageExports: defaultAdapterExports,
packageName:
"{architect|cloudflare-pages|cloudflare-workers|express|netlify|vercel}",
},
{ packageExports: defaultRuntimeExports, packageName: "{cloudflare|node}" },
{ packageExports: architectSpecificExports, packageName: "architect" },
{ packageExports: cloudflareSpecificExports, packageName: "cloudflare" },
{
packageExports: cloudflarePagesSpecificExports,
packageName: "cloudflare-pages",
},
{
packageExports: cloudflareWorkersSpecificExports,
packageName: "cloudflare-workers",
},
{ packageExports: nodeSpecificExports, packageName: "node" },
{ packageExports: reactSpecificExports, packageName: "react" },
].map(({ packageExports, packageName }) => ({
importNames: [...packageExports.value, ...packageExports.type],
message: getReplaceRemixImportsMessage(packageName),
name: "remix",
}));

module.exports = {
"array-callback-return": WARN,
Expand Down Expand Up @@ -89,8 +89,7 @@ module.exports = {
"no-new-object": WARN,
"no-octal": WARN,
"no-redeclare": ERROR,
// TODO: once we officially deprecate this we can bring this back
// "no-restricted-imports": [WARN, ...replaceRemixImportsOptions],
"no-restricted-imports": [WARN, ...replaceRemixImportsOptions],
"no-script-url": WARN,
"no-self-assign": WARN,
"no-self-compare": WARN,
Expand Down

0 comments on commit b749a2d

Please sign in to comment.