Skip to content

Commit ea51164

Browse files
authored
Revert "Don't load eslintrcs even in expectOnly" (#1287)
1 parent 2fdbc88 commit ea51164

2 files changed

Lines changed: 15 additions & 22 deletions

File tree

.changeset/flat-socks-shop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@definitelytyped/dtslint": patch
3+
---
4+
5+
Revert eslintrc loading change

packages/dtslint/src/lint.ts

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -112,35 +112,23 @@ function getEslintOptions(
112112
],
113113
};
114114

115-
// Always disable cascading .eslintrc.* discovery. Contributor-authored config files in
116-
// types/<pkg>/ would otherwise be loaded by ESLint 8's legacy eslintrc engine, which
117-
// resolves `extends` and `parser` (including in `overrides[]`) via
118-
// createRequire(configFilePath).resolve(value) and require()s the result. Since dtslint has
119-
// no file-extension allowlist, a contributor could ship a `.cjs` payload alongside
120-
// `.eslintrc.json` and obtain arbitrary code execution in the lint process.
121-
const baseOverrideConfig = {
122-
plugins: ["@definitelytyped", "@typescript-eslint", "jsdoc"],
123-
parser: "@typescript-eslint/parser",
124-
parserOptions: {
125-
project: true,
126-
warnOnUnsupportedTypeScriptVersion: false,
127-
},
128-
...overrideConfig,
129-
};
130-
131115
if (expectOnly) {
132116
return {
133117
useEslintrc: false,
134-
overrideConfig: baseOverrideConfig,
118+
overrideConfig: {
119+
plugins: ["@definitelytyped", "@typescript-eslint", "jsdoc"],
120+
parser: "@typescript-eslint/parser",
121+
parserOptions: {
122+
project: true,
123+
warnOnUnsupportedTypeScriptVersion: false,
124+
},
125+
...overrideConfig,
126+
},
135127
};
136128
}
137129

138130
return {
139-
useEslintrc: false,
140-
overrideConfig: {
141-
...baseOverrideConfig,
142-
extends: ["plugin:@definitelytyped/all"],
143-
},
131+
overrideConfig,
144132
};
145133
}
146134

0 commit comments

Comments
 (0)