GithubHelp home page GithubHelp logo

isabella232 / eslint-plugin-vue Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vuejs/eslint-plugin-vue

0.0 0.0 0.0 4.54 MB

Official ESLint plugin for Vue.js

Home Page: https://eslint.vuejs.org/

License: MIT License

JavaScript 98.08% Vue 0.01% TypeScript 1.91%

eslint-plugin-vue's Introduction

eslint-plugin-vue

NPM version NPM downloads CircleCI License

Official ESLint plugin for Vue.js

๐Ÿ“– Documentation

See the official website.

โš“ Versioning Policy

This plugin is following Semantic Versioning and ESLint's Semantic Versioning Policy.

๐Ÿ“ฐ Changelog

This project uses GitHub Releases.

๐Ÿป Contribution Guide

Contribution is welcome!

See The ESLint Vue Plugin Developer Guide.

Working with Rules

Before you start writing a new rule, please read the official ESLint guide.

Next, in order to get an idea how does the AST of the code that you want to check looks like, use the astexplorer.net. The astexplorer.net is a great tool to inspect ASTs, also Vue templates are supported.

After opening astexplorer.net, select Vue as the syntax and vue-eslint-parser as the parser.

Since single file components in Vue are not plain JavaScript, the default parser couldn't be used, so a new one was introduced. vue-eslint-parser generates enhanced AST with nodes that represent specific parts of the template syntax, as well as what's inside the <script> tag.

To know more about certain nodes in produced ASTs, go here:

The vue-eslint-parser provides a few useful parser services that help traverse the produced AST and access tokens of the template:

  • context.parserServices.defineTemplateBodyVisitor(visitor, scriptVisitor)
  • context.parserServices.getTemplateBodyTokenStore()

Check out an example rule to get a better understanding of how these work.

Please be aware that regarding what kind of code examples you'll write in tests, you'll have to accordingly set up the parser in RuleTester (you can do it on a per test case basis). See an example here.

If you'll stuck, remember there are plenty of rules you can learn from already. If you can't find the right solution, don't hesitate to reach out in issues โ€“ we're happy to help!

๐Ÿ”’ License

See the LICENSE file for license rights and limitations (MIT).

eslint-plugin-vue's People

Contributors

719media avatar aladdin-add avatar archer70 avatar armano2 avatar chrisvfritz avatar cjpearson avatar danyadev avatar fisker avatar floedelmann avatar gabrielboliveira avatar herringtondarkholme avatar iwanabethatguy avatar mannil avatar maoberlehner avatar michalsnik avatar mysticatea avatar ota-meshi avatar patrickabkarian avatar posva avatar privatenumber avatar przemkow avatar rodrigopedra avatar samturrell avatar sapphi-red avatar sosukesuzuki avatar st-sloth avatar termosa avatar tyankatsu0105 avatar yoyo930021 avatar yyx990803 avatar

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.