Skip to content

Commit

Permalink
Fix ESLINT_NO_IMPORTS usage
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Oct 7, 2023
1 parent f0990fb commit 195fb67
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,20 +316,13 @@ config.overrides.push({
});

if (process.env.ESLINT_NO_IMPORTS) {
for (const key of Object.keys(config.rules)) {
if (key.startsWith("import/")) {
delete config.rules[key];
}
}

const list = new Set(config.extends);
for (const plugin of list) {
if (plugin.startsWith("plugin:import/")) {
list.delete(plugin);
}
}

config.extends = [...list];
const importRules = Object.keys(require("eslint-plugin-import").rules);

Check failure on line 319 in index.js

View workflow job for this annotation

GitHub Actions / test

Unsafe argument of type `any` assigned to a parameter of type `object`
config.overrides.push({
files: ["**"],
rules: Object.fromEntries(
importRules.map((rule) => [`import/${rule}`, "off"])
),
});
}

module.exports = config;

0 comments on commit 195fb67

Please sign in to comment.