Giter VIP home page Giter VIP logo

eslint-plugin-wxml's Introduction

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

change your eslintrc config

.eslintrc .eslintrc.yml .eslinrc.json .eslintrc.js

+  "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

eslint-plugin-wxml's People

Contributors

aladdin-add avatar ichenlei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

eslint-plugin-wxml's Issues

[Bug]: inline-wxs的时候为啥会有eslint报错

To reproduce:
eslint的配置如官方 是

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

一个简单的示例是

<wxs module="handleSrc">
	module.exports = function(a){
           return null
	}
</wxs>
<view>
  <block>
    <view wx:for="{{[]}}"></view>
    <image src="#" />
  </block>
</view>

Current behavior:
项目是taro与微信混合的,自己在taro脚手架搭建的新项目上也尝试了一下,当wxs函数去掉a参数时,正常,
加上a参数时,重启eslint server立刻弹框报错,且key提示失效

Expected behavior:
不知道是不是因为eslint的原因,希望老师能给予解答,如果是bug,期望修复正常。

Environment information:

  • eslint version:8.20.0
  • nodejs version:14.19.1
  • eslint-plugin-wxml version:0.7.3
  • your IDE/editor: vscode

[Bug]: wx:for with wx:if/wx:else

To reproduce:

<view wx:if="{{showGoods}}" wx:for="{{goodsList}}" >{{item.name}}</view>
<block wx:else>
  <view wx:for="{{userList}}" >{{item.username}}</view>
</block>

workaround for this case:

<block wx:if="{{showGoods}}">
  <view wx:for="{{goodsList}}" >{{item.name}}</view>
</block>
<block wx:else>
  <view wx:for="{{userList}}" >{{item.username}}</view>
</block>

Current behavior:

No eslint problem hint, but get wechat miniprogram compile error

Bad attr `wx:else` with message: `wx:if not found, then something must be wrong`

Expected behavior:

lint this error

Environment information:

  • eslint version: v7
  • nodejs version: v14
  • eslint-plugin-wxml version: 0.5.0
  • your IDE/editor: VSCode

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.