Skip to content

Commit

Permalink
[Tests] no-extraneous-dependencies ignores unresolved imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jablko authored and ljharb committed Sep 19, 2021
1 parent 471790f commit 28669b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/files/with-typescript-dev-dependencies/package.json
@@ -1,5 +1,5 @@
{
"devDependencies": {
"@types/json-schema": "*"
"a": "*"
}
}
14 changes: 7 additions & 7 deletions tests/src/rules/no-extraneous-dependencies.js
Expand Up @@ -395,16 +395,16 @@ ruleTester.run('no-extraneous-dependencies', rule, {
ruleTester.run('no-extraneous-dependencies', rule, {
valid: [
test(Object.assign({
code: 'import type { JSONSchema7Type } from "@types/json-schema";',
code: 'import type T from "a";',
options: [{ packageDir: packageDirWithTypescriptDevDependencies, devDependencies: false }],
}, parserConfig)),
],
invalid: [
test(Object.assign({
code: 'import { JSONSchema7Type } from "@types/json-schema";',
code: 'import T from "a";',
options: [{ packageDir: packageDirWithTypescriptDevDependencies, devDependencies: false }],
errors: [{
message: "'@types/json-schema' should be listed in the project's dependencies, not devDependencies.",
message: "'a' should be listed in the project's dependencies, not devDependencies.",
}],
}, parserConfig)),
],
Expand All @@ -414,17 +414,17 @@ ruleTester.run('no-extraneous-dependencies', rule, {
valid: [],
invalid: [
test(Object.assign({
code: 'import { JSONSchema7Type } from "@types/json-schema"; /* typescript-eslint-parser */',
code: 'import T from "a"; /* typescript-eslint-parser */',
options: [{ packageDir: packageDirWithTypescriptDevDependencies, devDependencies: false }],
errors: [{
message: "'@types/json-schema' should be listed in the project's dependencies, not devDependencies.",
message: "'a' should be listed in the project's dependencies, not devDependencies.",
}],
}, parserConfig)),
test(Object.assign({
code: 'import type { JSONSchema7Type } from "@types/json-schema"; /* typescript-eslint-parser */',
code: 'import type T from "a"; /* typescript-eslint-parser */',
options: [{ packageDir: packageDirWithTypescriptDevDependencies, devDependencies: false }],
errors: [{
message: "'@types/json-schema' should be listed in the project's dependencies, not devDependencies.",
message: "'a' should be listed in the project's dependencies, not devDependencies.",
}],
}, parserConfig)),
],
Expand Down

0 comments on commit 28669b9

Please sign in to comment.