How to use the eslint-scope.ScopeManager function in eslint-scope

To help you get started, we’ve selected a few eslint-scope examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular-eslint / angular-eslint / packages / template-parser / src / index.ts View on Github external
range: [0, 1],
    loc: {
      start: {
        line: 0,
        column: 0,
      },
      end: {
        line: 0,
        column: 1,
      },
    },
    value: code,
  };

  // @ts-ignore
  const scopeManager = new ScopeManager({});
  // @ts-ignore
  const globalScope = new Scope(scopeManager, 'module', null, ast, false);

  preprocessNode(ast);

  return {
    ast,
    scopeManager,
    visitorKeys: KEYS,
    services: {
      convertNodeSourceSpanToLoc(sourceSpan: {
        start: { line: number; col: any };
        end: { line: number; col: any };
      }) {
        return {
          start: {
github babel / babel / eslint / babel-eslint-parser / src / analyze-scope.js View on Github external
ignoreEval: true,
    optimistic: false,
    directive: false,
    nodejsScope:
      ast.sourceType === "script" &&
      (parserOptions.ecmaFeatures &&
        parserOptions.ecmaFeatures.globalReturn) === true,
    impliedStrict: false,
    sourceType: ast.sourceType,
    ecmaVersion: parserOptions.ecmaVersion,
    fallback,
  };

  options.childVisitorKeys = childVisitorKeys;

  const scopeManager = new escope.ScopeManager(options);
  const referencer = new Referencer(options, scopeManager);

  referencer.visit(ast);

  return scopeManager;
}
github eslint / typescript-eslint-parser / analyze-scope.js View on Github external
const options = {
        ignoreEval: true,
        optimistic: false,
        directive: false,
        nodejsScope:
            ast.sourceType === "script" &&
            (parserOptions.ecmaFeatures &&
                parserOptions.ecmaFeatures.globalReturn) === true,
        impliedStrict: false,
        sourceType: extraOptions.sourceType,
        ecmaVersion: parserOptions.ecmaVersion || 2018,
        childVisitorKeys,
        fallback
    };

    const scopeManager = new escope.ScopeManager(options);
    const referencer = new Referencer(options, scopeManager);

    referencer.visit(ast);

    return scopeManager;
};