Skip to content

feat(IgnoreImports): allow ignored imports in no-extraneous-dependency#2557

Draft
kopax-polyconseil wants to merge 3 commits into
import-js:mainfrom
kopax-polyconseil:patch-1
Draft

feat(IgnoreImports): allow ignored imports in no-extraneous-dependency#2557
kopax-polyconseil wants to merge 3 commits into
import-js:mainfrom
kopax-polyconseil:patch-1

Conversation

@kopax-polyconseil

Copy link
Copy Markdown

Fix : #2400

Idk how to use globs here, so it's no glob, and support ./ for rootDir

@ljharb ljharb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add tests covering this?

Comment on lines +259 to +260
return config.some(c => (
filename.includes(value.substr(0, 2) === './' ? value.replace('.', process.cwd()) : value)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where does value come from here?

also, let's use slice over substr.

const deps = getDependencies(context, options.packageDir) || extractDepFields({});

const depsOptions = {
allowIgnoreImports: testIgnoreImports(options.ignoreImports, filename) !== false,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
allowIgnoreImports: testIgnoreImports(options.ignoreImports, filename) !== false,
ignoreImports: testIgnoreImports(options.ignoreImports, filename) !== false,

@ljharb ljharb marked this pull request as draft January 11, 2023 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

no-unused-modules needs an ignoreImports option

2 participants