Git Product home page Git Product logo

codemirror-linter's Introduction

codemirror-linter's People

Contributors

ichiriac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

codemirror-linter's Issues

HTML / CSS / JS Linters

The linter in codemirror detects and triggers only the linter registered at position 0,0.

In order to mix in the same document JS / HTML and CSS, it's up to PHP linter to dispatch requests on others parts.

I don't see any elegant way to do it - should try to understand how http://codemirror.net/mode/htmlmixed/ works

Location of error token

I need to retrieve the token location that raised the error, actually got only line and column that started it.

Uncaught TypeError: Cannot read property 'line' of undefined

Getting this error trying to use this linter:

Uncaught TypeError: Cannot read property 'line' of undefined
    at groupByLine (lint.js?ver=10.5.0:107)
    at updateLinting (lint.js?ver=10.5.0:167)
    at lint.js?ver=10.5.0:159
    at runInOp (codemirror.js?ver=10.5.0:3921)
    at CodeMirror.operation (codemirror.js?ver=10.5.0:8603)
    at startLinting (lint.js?ver=10.5.0:159)
    at lint.js?ver=10.5.0:206

Also, is this rep still being maintained?

Support AMD ?

The PHP parser is built in order to handle requirejs with browserify, maybe shoudl add UMD support.

Add options for targeting allowed PHP language features and functions

At least in the case of WordPress, there is a very wide range of PHP versions that may be running. For use in its built-in file editor, there is a need to try to prevent users from accidentally introducing fatal PHP errors on their sites. One major source of such fatal errors is accidentally using a language feature from a “recent” PHP version when WordPress is running on an old version of PHP (version 5.2 is still supported). A recent example I came across was attempting to pass a function into empty() which is a fatal error before PHP 5.5. In other words, this is essentially porting the PHPCompatibility sniffs for PHP_CodeSniffer into php-linter.

While we are working on server-ride solutions to actually try running the code and then rolling it back if there are fatal errors (e.g. #39766 and #21622), it is naturally highly preferable to avoid temporarily whitescreening a site by catching any such errors client-side before the file update is made.

This codemirror-linter for PHP currently is not doing anything with the options that are passed to it. If there could be a version passed in, then this could be used to determine whether unsupported PHP language features should be flagged as errors.

It would also be handy if there was a way to pass in a function blacklist which could pre-empt users from attempting to use unavailable functions (e.g. proc_open and system), dangerous functions (e.g. eval and create_function), or deprecated functions (e.g. wp_list_cats()). Use of certain functions could generate errors or warnings. This would essentially be porting implementing aspects of the WordPress-Coding-Standards for PHP_COdeSniffer.

💡 Crazy idea: Could PHP_CodeSniffer and its sniffs as a whole be transpiled into JS and then run in the browser?

Here is the related WordPress Trac ticket: https://core.trac.wordpress.org/ticket/41873

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.