How to use the eslint-scope.Scope 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
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: {
            line: sourceSpan.start.line + 1,
            column: sourceSpan.start.col,
github babel / babel / eslint / babel-eslint-parser / src / analyze-scope.js View on Github external
_nestTypeParamScope(node) {
    if (!node.typeParameters) {
      return null;
    }

    const parentScope = this.scopeManager.__currentScope;
    const scope = new escope.Scope(
      this.scopeManager,
      "type-parameters",
      parentScope,
      node,
      false,
    );

    this.scopeManager.__nestScope(scope);
    for (let j = 0; j < node.typeParameters.params.length; j++) {
      const name = node.typeParameters.params[j];
      scope.__define(name, new Definition("TypeParameter", name, name));
      if (name.typeAnnotation) {
        this._checkIdentifierOrVisit(name);
      }
    }
    scope.__define = function() {
github nscozzaro / physics-is-beautiful / courses / static / courses / js / containers / StudioViews / EditorsViews / containers / LessonWorkSpace / Codesandbox / app / components / CodeEditor / Monaco / workers / linter / monkeypatch-babel-eslint.js View on Github external
function nestTypeParamScope(manager, node) {
    var parentScope = manager.__currentScope;
    var scope = new escope.Scope(
      manager,
      'type-parameters',
      parentScope,
      node,
      false
    );
    manager.__nestScope(scope);
    for (var j = 0; j < node.typeParameters.params.length; j++) {
      var name = node.typeParameters.params[j];
      scope.__define(name, new Definition('TypeParameter', name, name));
      if (name.typeAnnotation) {
        checkIdentifierOrVisit.call(this, name);
      }
    }
    scope.__define = function() {
      return parentScope.__define.apply(parentScope, arguments);
github codesandbox / codesandbox-client / packages / app / src / app / components / CodeEditor / Monaco / workers / linter / monkeypatch-babel-eslint.js View on Github external
function nestTypeParamScope(manager, node) {
    var parentScope = manager.__currentScope;
    var scope = new escope.Scope(
      manager,
      'type-parameters',
      parentScope,
      node,
      false
    );
    manager.__nestScope(scope);
    for (var j = 0; j < node.typeParameters.params.length; j++) {
      var name = node.typeParameters.params[j];
      scope.__define(name, new Definition('TypeParameter', name, name));
      if (name.typeAnnotation) {
        checkIdentifierOrVisit.call(this, name);
      }
    }
    scope.__define = function() {
      return parentScope.__define.apply(parentScope, arguments);