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-millionjs-drex

v0.0.0-semantically-released

Published

Eslint Plugin Rules for Million Js

Downloads

5

Readme

eslint-plugin-millionjs

Overview

eslint-plugin-millionjs is an ESLint plugin specifically designed for the MillionJS Library. This plugin provides a set of rules to help you maintain consistent and error-free code when working with projects integrated with Million. It can automatically detect potential issues, enforce best practices, and improve code quality in your MillionJS applications.

Installation

To use eslint-plugin-millionjs in your MillionJS project, you'll need to install it along with its peer dependencies:

To run it from the NPM Registry

npm install eslint-plugin-millionjs eslint@^7.0.0 eslint-plugin-react --save-dev

Or, if you prefer using Yarn:

yarn add eslint-plugin-millionjs eslint@^7.0.0 eslint-plugin-react --dev

Configuration

After installation, you need to add millionjs to the plugins section of your ESLint configuration file (e.g., .eslintrc.js):

module.exports = {
  plugins: ['millionjs'],
  // Other ESLint configurations...
};

If you're using react, make sure you add eslint:recommended and plugin:react/recommended to the extends section of your ESLint configuration file (e.g., .eslintrc.js):

module.exports = {
  extends: ['eslint:recommended', 'plugin:react/recommended'],
  plugins: ['millionjs'],
  // Other ESLint configurations...
};

you also need to add lint script to the scripts section of your .package.json:

  "scripts": {
    "lint": "eslint src/  --ext .js,.jsx,.ts,.tsx  --report-unused-disable-directives --max-warnings 0"
  },

Usage

Once you've added millionjs to your ESLint configuration, you can now enable specific rules provided by the plugin or modify their severity according to your project's needs.

Here's an example of how to enable the avoid-spread-attributes rule from eslint-plugin-millionjs and set it to "error":

module.exports = {
  plugins: ['millionjs'],
  rules: {
    'millionjs/avoid-spread-attributes': 'error',
  },
  // Other ESLint configurations...
};

Rules

eslint-plugin-millionjs provides the following rules:

  • millionjs/check-block-declaration: This rule enforces a specific pattern when using the block() function from the Million.js library.

  • millionjs/check-block-calling: This rule enforces a specific pattern when calling a component that has been wrapped with the block() function from the Million.js library.

  • millionjs/avoid-array-map-in-block: This rule aims to enforce a specific best practice when using the block() function in conjunction with array mapping inside a component which is to use the For or the map function.

  • millionjs/avoid-spread-attributes: This rule aims to enforce a specific best practice when using spread attributes ({...props}) in JSX elements.

  • millionjs/validate-block-import: This rule is designed to validate and enforce proper imports of the block function from the million/react module.

  • millionjs/ensure-complier-is-being-used: This rule is designed to ensure that the block function from Million.js is used with the appropriate compiler setup. The block function requires the million compiler setup to work correctly, and using it without the proper configuration can lead to unexpected behavior and issues.

  • millionjs/avoid-non-deterministic-returns: This rule enforces the use of deterministic return statements in components or functions wrapped with the block function in Million.js.

Running ESLint

To run ESLint with the eslint-plugin-millionjs rules, you can use the following command:

npm run lint

Adjust the src/ part to the directory or files you want to lint.

Conclusion

With eslint-plugin-millionjs, you can ensure code consistency, maintainability, and adherence to best practices in your projects integrated with Million. The plugin's rules help catch potential issues early on and enhance the overall code quality. Feel free to explore the available rules and adjust the configuration to suit your project's specific needs.

For more information about MillionJS and its ecosystem, please refer to the official documentation: https://million.dev/.