babel / babel-eslint

:tokyo_tower: A wrapper for Babel's parser used for ESLint (renamed to @babel/eslint-parser)
https://github.com/babel/babel/tree/main/eslint/babel-eslint-parser
MIT License
2.96k stars 208 forks source link

Question: `11.0.0-beta2` Not installing all babel plugins (top level await) #834

Closed Sceat closed 4 years ago

Sceat commented 4 years ago

I'm not using babel to transpile the code but only babel-eslint to allow linting the code. I went on the >11 version as nodejs 14.3 released a working top level await with a flag and i couldn't make it work with babel-eslint 10.

By upgrading to babel-eslint 11 i now have to install every babel plugin to use experimental features even though they are supported by node. That was not the case before 11

Support for the experimental syntax 'importMeta' isn't currently enabled

same for static class properties etc

Question

Is there a way to include all features like the 10 behavior without installing many plugins while still using top level await ?

My eslint config

env:
  node: true
  es2020: true
plugins:
  - unicorn
extends:
  - "@sidy/eslint-config-sidy"
globals:
  Atomics: readonly
  SharedArrayBuffer: readonly
parser: babel-eslint
parserOptions:
  sourceType: module
  configFile: package.json
  ecmaVersion: 11

My current babel config

tough i'd like to have none and directly support top level await with allowAwaitoutsideFunction inside the eslintconfig

# package.json

  "babel": {
    "parserOpts": {
      "allowAwaitOutsideFunction": true
    },
    "plugins": [
      "@babel/plugin-proposal-class-properties",
      "@babel/plugin-proposal-numeric-separator"
    ]
  },
kaicataldo commented 4 years ago

You can follow this discussion, as it should allow for you to do this once implemented. Please note that all development has moved to https://github.com/babel/babel.