File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,23 +112,35 @@ 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+
115131 if ( expectOnly ) {
116132 return {
117133 useEslintrc : false ,
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- } ,
134+ overrideConfig : baseOverrideConfig ,
127135 } ;
128136 }
129137
130138 return {
131- overrideConfig,
139+ useEslintrc : false ,
140+ overrideConfig : {
141+ ...baseOverrideConfig ,
142+ extends : [ "plugin:@definitelytyped/all" ] ,
143+ } ,
132144 } ;
133145}
134146
You can’t perform that action at this time.
0 commit comments