New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

eslint-utils2

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-utils2

Utilities for ESLint plugins.

latest
Source
npmnpm
Version
3.1.0-rc.1
Version published
Maintainers
1
Created
Source

eslint-utils2

npm version Downloads/month Build Status Coverage Status Dependency Status

eslint-utils 基础上优化 ReferenceTracker ,以支持通配符,例如:

import { ReferenceTracker } from "eslint-utils";

export default {
  meta: {},
  create(context) {
    return {
      "Program:exit"() {
        const tracker = new ReferenceTracker(context.getScope());
        const traceMap = {
          // Find `console.*` .
          console: {
            [ReferenceTracker.SingleLevelWildcard]: {
              [ReferenceTracker.READ]: true,
            },
          },
          // Find `Object.prototype.**.bind()` .
          Object: {
            prototype: {
              [ReferenceTracker.MultiLevelWildcard]: {
                bind: {
                  [ReferenceTracker.CALL]: true,
                },
              },
            },
          },
        };

        for (const { node, path } of tracker.iterateGlobalReferences(
          traceMap
        )) {
          context.report({
            node,
            message: "disallow {{name}}.",
            data: { name: path.join(".") },
          });
        }
      },
    };
  },
};

以下是 eslint-utils README 原文。

🏁 Goal

This package provides utility functions and classes for make ESLint custom rules.

For examples:

  • getStaticValue evaluates static value on AST.
  • ReferenceTracker checks the members of modules/globals as handling assignments and destructuring.

📖 Usage

See documentation.

📰 Changelog

See releases.

❤️ Contributing

Welcome contributing!

Please use GitHub's Issues/PRs.

Development Tools

  • npm test runs tests and measures coverage.
  • npm run clean removes the coverage result of npm test command.
  • npm run coverage shows the coverage result of the last npm test command.
  • npm run lint runs ESLint.
  • npm run watch runs tests on each file change.

Keywords

eslint

FAQs

Package last updated on 07 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts