# eslint-plugin-millionjs-drex

> Eslint Plugin Rules for Million Js

Latest version **0.0.0-semantically-released** (published 2023-07-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install eslint-plugin-millionjs-drex
pnpm add eslint-plugin-millionjs-drex
yarn add eslint-plugin-millionjs-drex
bun add eslint-plugin-millionjs-drex
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.0-semantically-released |
| Published | 2023-07-29 |
| First published | 2023-07-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | v16.20.0 |
| Dependencies | 9 |
| Unpacked size | 45.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | drex72 |
| Keywords | eslint, eslintplugin, eslint-plugin |

## Links

- npm: https://www.npmjs.com/package/eslint-plugin-millionjs-drex
- npm.io page: https://npm.io/package/eslint-plugin-millionjs-drex

## Dependencies (9)

- [semver](https://npm.io/package/semver.md) ^7.5.4
- [istanbul](https://npm.io/package/istanbul.md) ^0.4.5
- [requireindex](https://npm.io/package/requireindex.md) ^1.1.0
- [object.entries](https://npm.io/package/object.entries.md) ^1.1.6
- [object.fromentries](https://npm.io/package/object.fromentries.md) ^2.0.6
- [@babel/preset-react](https://npm.io/package/@babel/preset-react.md) ^7.22.5
- [array.prototype.flatmap](https://npm.io/package/array.prototype.flatmap.md) ^1.3.1
- [@babel/plugin-syntax-decorators](https://npm.io/package/@babel/plugin-syntax-decorators.md) ^7.22.5
- [@babel/plugin-syntax-function-bind](https://npm.io/package/@babel/plugin-syntax-function-bind.md) ^7.22.5

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 0.0.0-semantically-released (latest) — 2023-07-29

## 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

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

Or, if you prefer using Yarn:

```bash
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`):

```javascript
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`):

```javascript
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`:

```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":

```javascript
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:

```bash
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/](https://million.dev/).

---
_Source: https://npm.io/package/eslint-plugin-millionjs-drex · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
