Code Monkey home page Code Monkey logo

eslint-plugin-riot's Introduction

  • ๐Ÿ‘‹ Hi, Iโ€™m @txchen
  • ๐Ÿ‘€ Iโ€™m interested in ...
  • ๐ŸŒฑ Iโ€™m currently learning ...
  • ๐Ÿ’ž๏ธ Iโ€™m looking to collaborate on ...
  • ๐Ÿ“ซ How to reach me ...

eslint-plugin-riot's People

Stargazers

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

Watchers

 avatar  avatar  avatar

eslint-plugin-riot's Issues

Need to fix the parsing logic, about the code block

Now the logic is to remove all the non-js text and preserve the original line number.

There is one issue: it will violate the multiple blank line rules.

To fix it, only extract the code inside the <script> block.

Support plain <script> tags?

I use <script></script> to ensure the parser knows where the js starts, but your setting seems to require one of 'es6', 'babel', 'javascript'.

If you replace !attrs.type with attrs.type then assumes 'allows' missing types should be sent to the linter, here: https://github.com/txchen/eslint-plugin-riot/blob/master/src/extract.js#L22

Is this a change you'd make?

(I'm still not sure if this fits in my flow -- I'm using many dirty globals, different than my nodejs code, so I need a totally separate eslint config.)

ES5 support

Thanks for writing this extractor! I was wondering why you return if the script type isn't es6. Is there some linting quirk that ends up happening or something? Or can you simply remove the type and lint the js as usual?

Riot ES6 syntax produces parsing error

I'm trying to make this plugin work but I keep getting parser error.

% ./node_modules/eslint/bin/eslint.js file.tag

file.tag
  64:20  error  Parsing error: Unexpected token )

.eslintrc

{
    "env": {
        "browser": true,
        "commonjs": true,
        "node": true
    },
    "plugins": ["riot"],
    "extends": "eslint:recommended",
    "rules": {
        "no-console": 1,
        "indent": [
            "error",
            4
        ],
        "linebreak-style": [
            "error",
            "unix"
        ],
        "quotes": [
            "error",
            "single"
        ],
        "semi": [
            "error",
            "always"
        ],
        "no-trailing-spaces": 2
    }
}

file.tag

<script type="es6">
this.likePost = () => {
riot.control.trigger(riot.VE.LIKE_POST, opts.data.postId)
}
</script>

Was the latest commit pushed to the NPM registry?

Apologies if I am asking a stupid question...

When I create an empty repository and run npm install eslint-plugin-riot, it seems that the code downloaded doesn't contain the feature enabling to read .riot files.
(It's a simple change to the folder inside the node_modules folder, but I don't think we are supposed to do that?).

Is it possible that the latest npm release doesn't contain the latest commits?

Thanks!

Support autofix

We're setting up an eslint config for a Riot project at work and need autofix support for how we want to use the linter.

What we'd need to do is translate the source position of every error in the processed code into the source position of every error in the original code. We need two things for this; the source position at the beginning of the script, and the number of characters we're getting rid of at every line when we dedent. The first part is easy --- we can just capture parser.startIndex the first time we hit the onText callback inside the script tag. The dedenting part is the tough bit --- it appears that in general we're not removing the same number of characters from each line in a given file.

After a few hacks at the problem, we ended up just removing the dedenting step, since that doesn't break any of our linter rules; you can see what that looks like at our forked repo. It's working well enough for us, but I didn't want to open a PR that would remove some functionality and probably break people's linters ๐Ÿ˜„

Thanks!

Support for riot 4

This plugin does not currently recognize riot 4 files extension.
It has changed from .tag ro .riot.

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.