open-index/open-npm huggingface dataset:
npm package: @mewisland/configs
Description: Shared configuration presets for ESLint and Biome.
Latest version: 0.3.0

# @mewisland/configs

## Usage

### ESLint

```js
// eslint.config.js
import config from "@mewisland/configs/eslint";

export default config;
```

Or

```js
// eslint.config.js
import config from "@mewisland/configs/eslint/react";

export default config;
```

### Biome

```jsonc
// biome.json
{
	"$schema": "https://biomejs.dev/schemas/2.2.5/schema.json",
	"extends": ["node_modules/@mewisland/configs/src/biome/biome.json"],
	"root": true
}
```

## LICENSE

MIT
npm package: @mewjs/html-code-gen
Description: html-code-gen is a HTML-code generator. It generates HTML code with given dom(-like) object.
Latest version: 1.0.2

# html-code-gen

html-code-gen is a HTML-code generator. It generates HTML code with given dom(-like) object.

## Install

```sh
npm install @mewjs/html-code-gen
```

```javascript
import htmlCodeGen from '@mewjs/html-code-gen';
```

## Usage

```javascript
htmlCodeGen.print(dom, opt);
```

```javascript
htmlCodeGen.printAsync(dom, opt).then(console.log);
```

## Options

* `indent-size`: size of indent

    default: `4`

* `indent-char`: char of indent ( space / tab )

    default: `'space'`

* `max-char`: max char num in one line (TODO)

    default: `80`

* `no-format-tag`: tags whose content should not be formatted

    default: [`spec.tagTypeMap.structural`](./lib/spec.js#L26)

* `no-format`: no format

    default: `false`

* `inline-tag`: tags whose content should be inline

    default: [`spec.tagTypeMap.inline`](./lib/spec.js#L25)

* `formatter`: special formatters { tagName ( script / style ) : formatter )

    default: `{}`

* `bool-attribute-value`: hide value of boolean attribute or not ( 'remove' / 'preserve' )

    default: `'remove'`

* `self-close`: should void tags close themselves with "/" ( 'close' / 'no-close' )

    default: `'no-close'`

* `level`: current level

    default: `0`

## Development

* run test cases

```sh
npm run test
```
npm package: @mewjs/html-nest-rule
Description: nesting rule realization for HTML spec
Latest version: 1.0.2

# html

html-nest-rule is nesting rule realization for [HTML spec](https://www.w3.org/TR/html5/Overview.html).

## Install

```sh
npm i @mewjs/html-nest-rule
```

## Usage

```javascript
import nest from '@mewjs/html-nest-rule';

const element = document.createElement('p');
const rule = nest.from(element);

// ['flow content', 'palpable content'], categories of given element
rule.getCategories(element);
// [], do context validate
rule.validateContext(element);
 // [], do content validate
rule.validateContent(element);
```
npm package: @mewjs/kudo
Description: check someone's code quality in git repository
Latest version: 1.1.1

# @mewjs/kudo

@mewjs/kudo is for checking someone's code quality in git repository.

## Install

```sh
npm i -g @mewjs/kudo
```

## Usage

### in CLI

```sh
kudo author [3.months.ago]
```

```sh
kudo author [--since=3.months.ago]
```

### in Node.js

```js
const kudo = require('kudo');

kudo.deduce('kiddo', '3.days.ago');
```
npm package: @mewjs/loader
Description: mew loader for webpack
Author: dafo
Latest version: 1.1.1

# @mewjs/loader

mew loader (for webpack) —— webpack 中的 mew 检查工具

## Usage

安装 `@mewjs/loader` 与 `@mewjs/cli`

```sh
yarn add -D @mewjs/loader @mewjs/cli
```

如果 less/css/js/ts/vue 文件都 check，可直接在原有 webpack.config.js 配置中的 module.rules 的基础上加多一项

```json
{
    test: /\.(less|css|js|ts|vue)$/,
    use: ['@mewjs/loader']
}
```

或者只针对某一类文件 check，可在原有的 loader 配置中添加 @mewjs/loader，如：

```json
{
    test: /\.js$/,
    use: ['@mewjs/loader']
},
{
    test: /\.css$/,
    use: [
        'style-loader',
        'css-loader',
        '@mewjs/loader'
    ]
},
{
    test: /\.less$/,
    use: [
        'style-loader',
        'css-loader',
        'less-loader',
        '@mewjs/loader'
    ]
}
```

因为 webpack 的 loader 调用的顺序是从后往前的，所以为了 @mewjs/loader 能 check 最原始的代码，请将 @mewjs/loader 放置在数组的最后

## Options

可以直接将参数加在loader后，形如 `@mewjs/loader?key=value`，也可以将参数写在 loader 的 options 中形如：

```json
{
    test: /\.js$/,
    use: [
        {
            loader: '@mewjs/loader',
            options: {
                failOnError: true,
                exclude: './index.js'
            }
        }
    ]
}
```

### `failOnError`(default: true)

是否在 mew 检测到模块内容有 error 时使模块编译失败，若 failOnError 为 true，则在遇到 error 错误时会导致编译失败。

### `failOnWarning`(default: false)

是否在mew检测到模块内容有warning时使模块编译失败，若failOnWarning 为 true，则在遇到 warning 错误时会导致编译失败。

### `exclude`（default: ''）

指定要忽略的 `glob` 文件模式，如 `./index.js,./src/config/*.js`，文件模式若有多条，模式之间使用逗号 `,` 分隔

### Example

#### webpack.config.js

```js
module.exports = {
    module: {
        rules: [
            {
                enforce: 'pre',
                test: /\.(less|css|jsx?|tsx?|vue)$/,
                use: [
                    {
                        loader: '@mewjs/loader',
                        options: {
                            failOnError: true,
                            failOnWarning: true,
                            exclude: './index.js,./index2.js'
                        }
                    }
                ]
            }
        ]
    }
};
```

#### vue.config.js - vue (webpack)

```js
module.exports = {
    chainWebpack(config) {
        const eslint = config.module.rule('eslint');
        eslint.uses.clear();

        const loaderName = '@mewjs/loader';

        eslint
            .pre()
            .test(/\.(?:m?jsx?|tsx?|css|less|sass|scss|styl|md|vue)+$/)
            .use(loaderName)
            .loader(loaderName)
            .options({
                failOnError: true,
                failOnWarning: false,
                silent: true
            });
    },
};
```

#### vite.config.js - vue (vite)

使用 [`@mewjs/vite-plugin`](https://github.com/mewjs/mew/tree/main/packages/vite-plugin)

```js
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import mew from '@mewjs/vite-plugin';

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [mew({ throwOnError: true }), vue()],
});
```

**注意：** 使用 `@mewjs/loader` 替换原有的 `eslint`，需要移除 `devDependencies` 中 `eslint` 相关的包再重新安装，否则会
导致某些公共包被提升，`@mewjs/eslint-plugin` 中的某些 `peerDependencies` 无法找到。
npm package: @mewjs/mpxml-eslint-parser
Description: The ESLint custom parser for `.wxml`, `.axml`, `.swan` files.
Latest version: 1.0.3

# mpxml-eslint-parser

The ESLint custom parser for `.wxml`, `.axml`, `.swan` files.

The `.wxs` files will be parsed as js files, see `parserOptions`.

Inspire from [vue-eslint-parser](https://github.com/vuejs/vue-eslint-parser).

## 💿 Install

```sh
npm install --save-dev eslint @mewjs/mpxml-eslint-parser
```

- Requires Node.js 12 or later.
- Requires ESLint 7.0.0 or later.
- Requires `babel-eslint` 10.1.0 or later if you want it. (optional)
- Requires `@typescript-eslint/parser` 2.31 or later if you want it. (optional)

## 📖 Usage

1. Write `parser` option into your `.eslintrc.*` file.
2. Use glob patterns or `--ext .wxml` CLI option.

```json
{
    "extends": "eslint:recommended",
    "parser": "@mewjs/mpxml-eslint-parser"
}
```

```sh
$ eslint "src/**/*.{js,wxml,axml,swan,wxs}"
# or
$ eslint src --ext .wxml --ext .axml --ext .swan  --ext .wxs
```

## 🔧 Options

`parserOptions` has the same type as [espree](https://github.com/eslint/espree#usage), the default parser of ESLint, is supporting.
For example:

```json
{
    "parser": "@mewjs/mpxml-eslint-parser",
    "parserOptions": {
        "sourceType": "module",
        "ecmaVersion": 2018,
        "ecmaFeatures": {
            "globalReturn": false,
            "impliedStrict": false,
            "jsx": false
        }
    }
}
```

## 🍻 Contributing

Welcome contributing!


If you want to write code, please execute `npm install && npm run setup` after you cloned this repository.
The `npm install` command installs dependencies.
The `npm run setup` command initializes ESLint as git submodules for tests.

### Development Tools

- `npm test` runs tests and measures coverage.
- `npm run build` compiles TypeScript source code to `index.js`, `index.js.map`, and `index.d.ts`.
- `npm run coverage` shows the coverage result of `npm test` command with the default browser.
- `npm run clean` removes the temporary files which are created by `npm test` and `npm run build`.
- `npm run lint` runs ESLint.
- `npm run setup` setups submodules to develop.
- `npm run watch` runs `build`, `update-fixtures`, and tests with `--watch` option.
npm package: @mewjs/vite-plugin
Description: Mew plugin for vite.
Latest version: 1.1.1

# @mewjs/vite-plugin

Mew plugin for vite.

## Install

```sh
npm install @mewjs/vite-plugin --save-dev
# or
yarn add @mewjs/vite-plugin --dev
```

## Usage

```js
import { defineConfig } from 'vite';
import mew from '@mewjs/vite-plugin';

export default defineConfig({
  plugins: [mew()],
});
```

## Options

### `include`

- Type: `string | string[]`
- Default: `['src/**/*.js', 'src/**/*.jsx', 'src/**/*.ts', 'src/**/*.tsx', 'src/**/*.vue']`

A single file, or array of files, to include when linting.

### `exclude`

- Type: `string | string[]`
- Default: `'node_modules'`

A single file, or array of files, to exclude when linting.

### `throwOnWarning`

- Type: `boolean`
- Default: `true`

The warnings found will be emitted, default to true.

### `throwOnError`

- Type: `boolean`
- Default: `true`

The errors found will be emitted, default to true.
npm package: @mewtant/graphql-validate-directive
Description: A GraphQL directive for input validation
Author: Wang Jie
Latest version: 0.3.0

# graphql-validate-directive

[![npm](https://img.shields.io/npm/v/graphql-validate-directive?style=flat-square)](https://www.npmjs.com/package/graphql-validate-directive)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/cnwangjie/graphql-validate-directive/test.yaml?branch=main&style=flat-square)
![Codecov](https://img.shields.io/codecov/c/github/cnwangjie/graphql-validate-directive?style=flat-square&token=QhjBkB6PwD)

### Summary

This is a directive validation library for GraphQL. Inspired by [validate-directive](https://github.com/cjihrig/validate-directive).

Different with [graphql-constraint-directive](https://github.com/confuser/graphql-constraint-directive). It do validate on resolve field instead of creating new scaler.

### Installation

```sh
yarn add graphql-validate-directive
```

or

```sh
npm i -S graphql-validate-directive
```

### Usage

Use in the project.

```ts
import {
  validateDirective,
  GraphQLValidateDirectiveTypeDefs,
} from 'graphql-validate-directive'
import { makeExecutableSchema } from '@graphql-tools/schema'

const schema = makeExecutableSchema({
  typeDefs: [
    // ... your type definitions
    GraphQLValidateDirectiveTypeDefs,
  ],
  resolvers: {
    // ...
  },
})

validateDirective()(schema)
```

Use in schema.

```graphql
# used on input field
input PostInput {
  title: String! @validate(minLength: 1, maxLength: 1000)
  content: String! @validate(minLength: 1, maxLength: 1000)

  # used on array
  tags: [String!]
    @validate(minItems: 1, maxItems: 10, minLength: 1, maxLength: 100)
}

type Mutation {
  createPost(input: PostInput!): Post

  # used on argument
  createMessage(
    content: String! @validate(minLength: 1, maxLength: 200)
  ): Message
}
```

### License

MIT Licensed.