Skip to content

Commit

Permalink
Properly handle parserOptions (#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
Richienb authored May 11, 2021
1 parent 8e1801c commit e9c96a1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/options-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,13 @@ const buildESLintConfig = options => config => {
];
}

if (options.parserOptions) {
config.baseConfig.parserOptions = {
...config.baseConfig.parserOptions,
...options.parserOptions
};
}

return {
...config,
...pick(options, ['cwd', 'filePath', 'fix'])
Expand Down
10 changes: 10 additions & 0 deletions test/options-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,16 @@ test('buildConfig: typescript with parserOption', t => {
});
});

test('buildConfig: parserOptions', t => {
const config = manager.buildConfig({
parserOptions: {
sourceType: 'script'
}
});

t.is(config.baseConfig.parserOptions.sourceType, 'script');
});

test('findApplicableOverrides', t => {
const result = manager.findApplicableOverrides('/user/dir/foo.js', [
{files: '**/f*.js'},
Expand Down

0 comments on commit e9c96a1

Please sign in to comment.