Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[eslint] configure no-extraneous-dependencies rule properly, to pre…
…vent today’s bugs
  • Loading branch information
ljharb committed Jan 12, 2023
1 parent cda23fe commit af8fd26
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions .eslintrc
Expand Up @@ -76,7 +76,16 @@
"eslint-plugin/require-meta-type": "error",

// dog fooding
"import/no-extraneous-dependencies": "error",
"import/no-extraneous-dependencies": ["error", {
"devDependencies": [
"tests/**",
"resolvers/*/test/**",
"scripts/**"
],
"optionalDependencies": false,
"peerDependencies": true,
"bundledDependencies": false,
}],
"import/unambiguous": "off",
},

Expand Down Expand Up @@ -106,7 +115,6 @@
{
"files": "resolvers/webpack/**",
"rules": {
"import/no-extraneous-dependencies": 1,
"no-console": 1,
},
"env": {
Expand Down
2 changes: 1 addition & 1 deletion src/ExportMap.js
Expand Up @@ -558,7 +558,7 @@ ExportMap.parse = function (path, content, context) {
try {
if (tsConfigInfo.tsConfigPath !== undefined) {
// Projects not using TypeScript won't have `typescript` installed.
if (!ts) { ts = require('typescript'); }
if (!ts) { ts = require('typescript'); } // eslint-disable-line import/no-extraneous-dependencies

const configFile = ts.readConfigFile(tsConfigInfo.tsConfigPath, ts.sys.readFile);
return ts.parseJsonConfigFileContent(
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-duplicates.js
Expand Up @@ -4,7 +4,7 @@ import semver from 'semver';

let typescriptPkg;
try {
typescriptPkg = require('typescript/package.json');
typescriptPkg = require('typescript/package.json'); // eslint-disable-line import/no-extraneous-dependencies
} catch (e) { /**/ }

function checkImports(imported, context) {
Expand Down

0 comments on commit af8fd26

Please sign in to comment.