Skip to content

feat(no-deprecated-api): Add ignores option #353

Open
@scagood

Description

@scagood

It'd be nice to be able to ignore specific deprecation warnings in no-deprecated-api (see #183)

The core of the feature is already implemented in:

ignores: {
type: "array",
items: {
enum: Array.from(
new Set([
...enumeratePropertyNames(traceMap.globals),
...enumeratePropertyNames(traceMap.modules),
])
),
},
uniqueItems: true,
},

/**
* Parses the options.
* @param {import('eslint').Rule.RuleContext} context The rule context.
* @returns {Readonly<{
* version: import('semver').Range;
* ignores: Set<string>;
* allowExperimental: boolean;
* }>} Parsed value.
*/
function parseOptions(context) {
const raw = context.options[0] || {}
const version = getConfiguredNodeVersion(context)
const ignores = new Set(raw.ignores || [])
const allowExperimental = raw.allowExperimental ?? false
return Object.freeze({ version, ignores, allowExperimental })
}

const name = unprefixNodeColon(path.join("."))
if (options.ignores.has(name)) {
continue
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions