Giter Site home page Giter Site logo

Comments (7)

BenoitZugmeyer avatar BenoitZugmeyer commented on June 10, 2024 2

This is a very good suggestion and I would be in favor of exploiting those new APIs and remove a bit of dirty monkey patching from my plugin ๐Ÿ˜ƒ But as you noted, the biggest challenge is to mark variables as defined and used accross script tags (for non-module scripts). The processor API also lacks the ability to access the configuration settings part, which is used when parsing to know if it is XML or HTML, or which type= arguments should be considered as JS scripts, among other things.

I will keep this in mind and may find a way to use the new APIs while keeping a bit of monkeypatching for the blocking points.

from eslint-plugin-html.

JounQin avatar JounQin commented on June 10, 2024 1

@BenoitZugmeyer

Are you working on this? It should not be difficult based on my experience by fixing eslint-plugin-markdown's issues and developing eslint-plugin-mdx, and fixing other tools' issues due to processor API.

If you haven't started, I can help to start the job when I'm free.

from eslint-plugin-html.

Airkro avatar Airkro commented on June 10, 2024 1

@brettz9

I want to send a PR to https://github.com/BenoitZugmeyer/eslint-plugin-html, but it's difficult for me. let's see if anyone can help?

I try to read the code of eslint-plugin-html, it's really complex, I didn't understand every part yet. And I think htmlparser2 APIs are not friendly enough.

But I will try to solute the no-unused-vars problem someday.

from eslint-plugin-html.

Airkro avatar Airkro commented on June 10, 2024

I create https://github.com/nice-move/eslint-plugin-html to do this, not been published yet.

I'm a rookie at making Eslint plugins, please send me feedback and code reviews.

from eslint-plugin-html.

brettz9 avatar brettz9 commented on June 10, 2024

@Airkro : Ni hao and congratulations on getting a plugin working! It's great to see some movement on this, and it look like you took a sound approach.

However, besides benefiting the other users of this plugin, a PR might ensure that all of the logic with markVariableAsUsed is not lost. That code is needed because the scripts in HTML are not completely independent of each other, and one doesn't want the no-unused-vars rule reporting a variable used in a later block which was defined in an earlier one.

from eslint-plugin-html.

Standard8 avatar Standard8 commented on June 10, 2024

@Airkro I think you'd need to fork this repository, then copy your changes across from your repo into the fork on a new branch. You could then push your changes to your fork and request a PR from there.

from eslint-plugin-html.

Standard8 avatar Standard8 commented on June 10, 2024

The processor API also lacks the ability to access the configuration settings part, which is used when parsing to know if it is XML or HTML,

One option here would be to provide to different processors in the plugin - one for xml and one for html. The configuration can then specify which processor to use for which file extension.

or which type= arguments should be considered as JS scripts, among other things.

I think it might be reasonable to ask core ESLint for an extension of the API to allow specifying the module/script type in the return options of preprocess.

from eslint-plugin-html.

Related Issues (20)

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.