Skip to content

Latest commit

 

History

History
91 lines (67 loc) · 2.71 KB

README.md

File metadata and controls

91 lines (67 loc) · 2.71 KB

eslint-plugin-wxml

npm version CI GitHub license Twitter Follow Author PRs Welcome

An ESLint plugin to lint wxml files.

Show Case

vscode eslint-plugin-wxml

Installation

## npm
$ npm install eslint-plugin-wxml --save-dev

## cnpm (for china user)
$ cnpm install eslint-plugin-wxml --save-dev

## pnpm
$ pnpm add eslint-plugin-wxml -D

## yarn
$ yarn add eslint-plugin-wxml -D

Basic Usage

Configuration (eslint.config.mjs)

Use eslint.config.mjs file to configure rules. This is the default in ESLint v9, but can be used starting from ESLint v8.57.0. See also: https://eslint.org/docs/latest/use/configure/configuration-files-new.

Example eslint.config.mjs:

import wxml from "eslint-plugin-wxml";
import wxmlParser from "@wxml/parser";

export default [
  {
    files: ["**/*.wxml"],
    plugins: {
      wxml: wxml,
    },
    languageOptions: {
      parser: wxmlParser,
    },
    rules: {
      "wxml/report-wxml-syntax-error": "error",
    },
  },
];

Configuration (.eslintrc)

Use .eslintrc.* file to configure rules. See also: https://eslint.org/docs/v8.x/use/configure/configuration-files.

+  "overrides": [
+    {
+      "files": ["*.wxml"],
+      "rules": {
+        "wxml/report-wxml-syntax-error": "error"
+      },
+      "plugins": ["wxml"],
+      "processor": "wxml/wxml",
+      "parser": "@wxml/parser"
+    }
+  ],

Missing Rule

Missing your wanted rule ? please report it as a new github issue, thanks !

Documentation

See the official website

License

MIT

Copyright (c) 2021-present, Lei Chen