Skip to content

Commit

Permalink
feature: babel-eslint-plugin passes through config options
Browse files Browse the repository at this point in the history
  • Loading branch information
kaicataldo committed May 28, 2020
1 parent adf5517 commit ef26ba0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
2 changes: 1 addition & 1 deletion eslint/babel-eslint-parser/README.md
Expand Up @@ -56,7 +56,7 @@ Additional configuration options can be set in your ESLint configuration under t
- `sourceType` can be set to `"module"`(default) or `"script"` if your code isn't using ECMAScript modules.
- `allowImportExportEverywhere` (default `false`) can be set to `true` to allow import and export declarations to appear anywhere a statement is allowed if your build environment supports that. Otherwise import and export declarations can only appear at a program's top level.
- `ecmaFeatures.globalReturn` (default `false`) allow return statements in the global scope when used with `sourceType: "script"`.
- `babelOptions` passes through Babel's configuration [loading](https://babeljs.io/docs/en/options#config-loading-options) and [merging](https://babeljs.io/docs/en/options#config-merging-options) options (for instance, in case of a monorepo). When not defined, @babel/eslint-parser will use Babel's default configuration file resolution logic.
- `babelOptions` is an object containing Babel configuration [options](https://babeljs.io/docs/en/options) that are passed to Babel's parser at runtime. For cases where users might not want to use a Babel configuration file or are running Babel through another tool (such as Webpack with `babel-loader`).

**.eslintrc.js**

Expand Down
16 changes: 1 addition & 15 deletions eslint/babel-eslint-parser/src/configuration.js
Expand Up @@ -15,21 +15,6 @@ export function normalizeBabelParseConfig(options) {
const parseOptions = {
sourceType: options.sourceType,
filename: options.filePath,
cwd: options.babelOptions.cwd,
root: options.babelOptions.root,
rootMode: options.babelOptions.rootMode,
envName: options.babelOptions.envName,
configFile: options.babelOptions.configFile,
babelrc: options.babelOptions.babelrc,
babelrcRoots: options.babelOptions.babelrcRoots,
extends: options.babelOptions.extends,
env: options.babelOptions.env,
overrides: options.babelOptions.overrides,
test: options.babelOptions.test,
include: options.babelOptions.include,
exclude: options.babelOptions.exclude,
ignore: options.babelOptions.ignore,
only: options.babelOptions.only,
parserOpts: {
allowImportExportEverywhere: options.allowImportExportEverywhere,
allowReturnOutsideFunction: true,
Expand All @@ -41,6 +26,7 @@ export function normalizeBabelParseConfig(options) {
caller: {
name: "@babel/eslint-parser",
},
...options.babelOptions,
};

if (options.requireConfigFile !== false) {
Expand Down

0 comments on commit ef26ba0

Please sign in to comment.