diff --git a/packages/remix-eslint-config/rules/core.js b/packages/remix-eslint-config/rules/core.js index 1fe18348748..81a12b49c3a 100644 --- a/packages/remix-eslint-config/rules/core.js +++ b/packages/remix-eslint-config/rules/core.js @@ -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, @@ -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,