Skip to content

Commit

Permalink
feat(remix-eslint-config)!: remove magic imports ESLint warnings (#6902)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed Jul 20, 2023
1 parent 4614557 commit 82bad53
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 203 deletions.
5 changes: 5 additions & 0 deletions .changeset/remove-magic-import-eslint-warnings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/eslint-config": major
---

Remove magic imports ESLint warnings
40 changes: 0 additions & 40 deletions packages/remix-eslint-config/rules/core.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,7 @@
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. Run \`npx @remix-run/dev@latest codemod replace-remix-magic-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",
}));

module.exports = {
"array-callback-return": WARN,
"getter-return": WARN,
Expand Down Expand Up @@ -88,7 +49,6 @@ module.exports = {
"no-new-object": WARN,
"no-octal": WARN,
"no-redeclare": ERROR,
"no-restricted-imports": [WARN, ...replaceRemixImportsOptions],
"no-script-url": WARN,
"no-self-assign": WARN,
"no-self-compare": WARN,
Expand Down
163 changes: 0 additions & 163 deletions packages/remix-eslint-config/rules/packageExports.js

This file was deleted.

0 comments on commit 82bad53

Please sign in to comment.