Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@angular-eslint/utils

Package Overview
Dependencies
Maintainers
0
Versions
484
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@angular-eslint/utils

Please see https://github.com/angular-eslint/angular-eslint for full usage instructions and guidance.

  • 18.3.1-alpha.12
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4M
decreased by-18.84%
Maintainers
0
Weekly downloads
 
Created

What is @angular-eslint/utils?

@angular-eslint/utils is a utility package designed to help developers integrate ESLint with Angular projects. It provides a set of tools and utilities to facilitate linting Angular code, ensuring code quality and consistency.

What are @angular-eslint/utils's main functionalities?

Rule Creation

This feature allows developers to create custom ESLint rules tailored to their Angular projects. The code sample demonstrates how to define a custom rule that disallows a specific pattern.

const { createESLintRule } = require('@angular-eslint/utils');

module.exports = createESLintRule({
  name: 'my-custom-rule',
  meta: {
    type: 'problem',
    docs: {
      description: 'Disallow certain patterns',
      category: 'Best Practices',
      recommended: 'error'
    },
    schema: [],
    messages: {
      forbiddenPattern: 'This pattern is not allowed.'
    }
  },
  defaultOptions: [],
  create(context) {
    return {
      Identifier(node) {
        if (node.name === 'forbiddenPattern') {
          context.report({ node, messageId: 'forbiddenPattern' });
        }
      }
    };
  }
});

AST Utilities

This feature provides utilities for working with Angular's Abstract Syntax Tree (AST). The code sample shows how to use `getTemplateParserServices` to suggest improvements for Angular templates.

const { getTemplateParserServices } = require('@angular-eslint/utils');

module.exports = {
  meta: {
    type: 'suggestion',
    docs: {
      description: 'Suggest improvements for Angular templates',
      category: 'Best Practices',
      recommended: 'warn'
    },
    schema: [],
    messages: {
      suggestImprovement: 'Consider improving this template.'
    }
  },
  create(context) {
    const parserServices = getTemplateParserServices(context);
    return {
      'Element$1'(node) {
        const templateNode = parserServices.convertNodeSourceSpanToLoc(node.sourceSpan);
        context.report({ node: templateNode, messageId: 'suggestImprovement' });
      }
    };
  }
};

Other packages similar to @angular-eslint/utils

FAQs

Package last updated on 25 Aug 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc