Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Feb 26, 2024 via pnpm

eslint-scope 5.1.1

ECMAScript scope analyzer for ESLint
Package summary
Share
0
issues
1
license
4
BSD-2-Clause
Package created
17 Mar 2017
Version published
12 Sep 2020
Maintainers
4
Total deps
4
Direct deps
2
License
BSD-2-Clause

Issues

0
This package has no issues

Licenses

BSD 2-Clause "Simplified" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
hold-liable
Must
include-copyright
include-license
4 Packages, Including:
eslint-scope@5.1.1
esrecurse@4.3.0
estraverse@4.3.0
estraverse@5.3.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

2
All Dependencies CSV
β“˜ This is a list of eslint-scope 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
esrecurse4.3.03.96 kBBSD-2-Clause
prod
estraverse4.3.07.7 kBBSD-2-Clause
prod

Visualizations

Frequently Asked Questions

What does eslint-scope do?

ESLint-Scope is a sophisticated ECMAScript scope analyzer used within ESLint. It's essentially a fork of escope, another popular ECMAScript scope analyzer. It provides developers with an in-depth tool to analyze the scopes within their ECMAScript code, making it easier to understand variable and function scopes in their projects. Following best practices in ECMAScript is of utmost importance to maintain clean, optimized, and SEO-friendly JavaScript code, and this is where eslint-scope comes into play.

How do you use eslint-scope?

ESLint-Scope can be integrated into your JavaScript or Node.js project by simply installing it through npm. Use the following command to add ESLint-Scope to your project:

npm i eslint-scope --save

You can then import ESLint-Scope in either an ECMAScript module (ESM) or CommonJS file:

//ESM
import * as eslintScope from 'eslint-scope';

//CommonJS
const eslintScope = require('eslint-scope');

Use it in your project to analyze and manage your ECMAScript code scopes. For instance, you can use it together with Espree and Estraverse:

import * as eslintScope from 'eslint-scope';
import * as espree from 'espree';
import estraverse from 'estraverse';

const ast = espree.parse(code, { range: true });
const scopeManager = eslintScope.analyze(ast);

let currentScope = scopeManager.acquire(ast);   // global scope
estraverse.traverse(ast, {
    enter (node, parent) {

        if (/Function/.test(node.type)) {
            currentScope = scopeManager.acquire(node);  // get current function scope
        }
    },
    leave(node, parent) {
        if (/Function/.test(node.type)) {
            currentScope = currentScope.upper;  // set to parent scope
        }
    }
});

Where are the eslint-scope docs?

Detailed documentation for ESLint-Scope can be found directly on its GitHub page, which is https://github.com/eslint/eslint-scope. The documentation includes installation instructions, usage examples, and guidelines for contributing. Understanding ESLint-Scope better will potentially provide you an edge in writing clean, SEO-friendly JavaScript code by following best ECMAScript practices.