Skip to content

Instantly share code, notes, and snippets.

@donabrams
Created July 28, 2015 19:43
Show Gist options
  • Select an option

  • Save donabrams/f84784ef7fe0a749c4fb to your computer and use it in GitHub Desktop.

Select an option

Save donabrams/f84784ef7fe0a749c4fb to your computer and use it in GitHub Desktop.
Problem with babel-eslint and/or escope?
import * as escope from 'escope';
import babelEslint from 'babel-eslint';
let ast = babelEslint.parse('let a = <div/>;', {
loc: true,
range: true,
raw: true,
tokens: true,
comment: true,
attachComment: true,
ecmaFeatures: {
globalReturn: false,
arrowFunctions: true,
blockBindings: true,
regexUFlag: true,
regexYFlag: true,
templateStrings: true,
binaryLiterals: true,
octalLiterals: true,
unicodeCodePointEscapes: true,
superInFunctions: true,
defaultParams: true,
restParams: true,
forOf: true,
objectLiteralComputedProperties: true,
objectLiteralShorthandMethods: true,
objectLiteralShorthandProperties: true,
objectLiteralDuplicateProperties: true,
generators: true,
destructuring: true,
classes: true,
modules: true,
jsx: true,
},
});
escope.analyze(ast, {
ignoreEval: true,
nodejsScope: false,
ecmaVersion: 6,
sourceType: 'module',
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment