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: use module-replacements #18

Merged
merged 1 commit into from
Jun 5, 2024
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
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
},
"dependencies": {
"fd-package-json": "^1.2.0",
"module-replacements": "^2.0.0",
"semver": "^7.6.0"
}
}
327 changes: 0 additions & 327 deletions src/replacements.ts

This file was deleted.

16 changes: 8 additions & 8 deletions src/rules/ban-dependencies.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import {Rule} from 'eslint';
import {getDocsUrl} from '../util/rule-meta.js';
import {
microUtilities,
microUtilsReplacements,
preferredReplacements,
nativeReplacements,
Replacement
} from '../replacements.js';
type ModuleReplacement
} from 'module-replacements';
import {createReplacementListener} from '../util/imports.js';

interface BanDependenciesOptions {
presets?: string[];
modules?: string[];
}

const availablePresets: Record<string, Replacement[]> = {
microutilities: microUtilities,
native: nativeReplacements,
preferred: preferredReplacements
const availablePresets: Record<string, ModuleReplacement[]> = {
microutilities: microUtilsReplacements.moduleReplacements,
native: nativeReplacements.moduleReplacements,
preferred: preferredReplacements.moduleReplacements
};

const defaultPresets = ['microutilities', 'native', 'preferred'];
Expand Down Expand Up @@ -64,7 +64,7 @@ export const rule: Rule.RuleModule = {
},
create: (context) => {
const options = context.options[0] as BanDependenciesOptions | undefined;
const replacements: Replacement[] = [];
const replacements: ModuleReplacement[] = [];
const presets = options?.presets ?? defaultPresets;
const modules = options?.modules;

Expand Down
Loading
Loading