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

feat(remix-eslint-config)!: remove magic imports ESLint warnings #6902

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.