npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eslint-plugin-codeguard

v1.0.0

Published

An ESLint plugin to enforce best practices and coding standards.

Downloads

16

Readme

eslint-plugin-codeguard

eslint-plugin-codeguard is an ESLint plugin designed to enforce best practices and coding standards in your JavaScript and TypeScript codebases. This plugin provides several rules to help maintain code quality and consistency.

Installation

To install the plugin, you need to add it as a development dependency in your project:

npm install eslint-plugin-codeguard --save-dev

or with Yarn:

yarn add eslint-plugin-codeguard --dev

Configuration

To use this plugin in your project, you need to configure ESLint. Follow these steps:

  1. Create or update your ESLint configuration file (.eslintrc.js, .eslintrc.json, or .eslintrc.yaml). Here is an example configuration using .eslintrc.js:

    module.exports = {
      extends: [
        "eslint:recommended",
        "plugin:react/recommended",
        "plugin:jsx-a11y/recommended",
        "plugin:node/recommended",
      ],
      plugins: ["codeguard"],
      rules: {
        "codeguard/no-console-log": "warn",
        "codeguard/no-duplicate-code": "warn",
        "codeguard/enforce-useeffect-deps": "warn",
        "codeguard/no-inline-styles": "warn",
        "codeguard/no-dom-manipulation": "warn",
        "codeguard/a11y-no-missing-alt": "warn",
        "codeguard/max-lines-per-component": ["warn", 200],
        "codeguard/api-route-naming-convention": "warn",
        "codeguard/no-deprecated-lifecycle-methods": "warn",
        "codeguard/no-expose-env-variables": "error",
      },
      settings: {
        react: {
          version: "detect",
        },
      },
      env: {
        browser: true,
        node: true,
        es6: true,
      },
    };
  2. Add the plugin to your ESLint configuration. You need to specify codeguard as a plugin and set the rules you want to enforce. The example above demonstrates how to do this.

Rules

This plugin includes the following rules:

  • no-console-log: Disallow the use of console.log statements.
  • no-duplicate-code: Disallow code duplication.
  • enforce-useeffect-deps: Enforce the inclusion of dependencies in useEffect.
  • no-inline-styles: Disallow inline styles.
  • no-dom-manipulation: Disallow direct DOM manipulation.
  • a11y-no-missing-alt: Enforce the presence of alt attributes on <img> tags.
  • max-lines-per-component: Limit the number of lines per React component.
  • api-route-naming-convention: Enforce a naming convention for API routes.
  • no-deprecated-lifecycle-methods: Disallow the use of deprecated React lifecycle methods.
  • no-expose-env-variables: Disallow exposing environment variables in the client-side code.

Testing the Plugin

To test the plugin locally, you can create a test project and install the plugin from your local directory:

npm install /path/to/your/local/eslint-plugin-codeguard

Then, run ESLint on your test files:

npx eslint your-test-file.js

Contributing

If you want to contribute to the development of this plugin, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Make your changes and commit them.
  4. Push your changes to your forked repository.
  5. Create a pull request with a clear description of the changes.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

If you have any questions or need further assistance, feel free to reach out to Durga Gairhe.


### Explanation:

- **Installation**: Shows how to install the plugin using npm or Yarn.
- **Configuration**: Provides an example of how to configure ESLint to use the plugin and its rules.
- **Rules**: Lists and briefly describes the rules included in the plugin.
- **Testing**: Instructions for testing the plugin locally before publishing.
- **Contributing**: Guidelines for contributing to the development of the plugin.
- **License**: Information about the license under which the plugin is distributed.
- **Contact**: Contact information for questions or further assistance.

Replace placeholders such as `[Durga Gairhe]` and `[email protected]` with your actual details.