cosmocode / edittable

Plugin to provide a custom editor for tables in DokuWiki
https://www.dokuwiki.org/plugin:edittable
32 stars 26 forks source link

added eslint #145

Closed micgro42 closed 7 years ago

micgro42 commented 7 years ago

we have to decide if that's better than jshint or if we need both.

micgro42 commented 7 years ago

I think eslint has the potential to completely replace jshint. Not sure which features jshint still has, that eslint is lacking.

micgro42 commented 7 years ago

I would like to specify the browser versions for the compatibility check more explicitly. For example an summary like

"browserslist": [
    "last 2 chrome versions",
    "last 2 firefox versions",
    "last 2 edge versions",
    "last 2 safari versions",
    "last 2 ChromeAndroid versions",
    "last 2 ios versions",
    "ie 11"
  ]

produces an error like the following:

349:13  error    fetch is not supported in Safari 10, iOS Safari 10.0-10.2, IE 11  compat/compat

whereas the current code: https://github.com/cosmocode/edittable/blob/6657fb97c2d9d5dc5b10f1c778eb029981c93ca6/package.json#L22-L25

produces the error

349:13  error    fetch is not supported in Safari 10, Opera Mobile 12.1, Opera Mini all, iOS Safari 10.0-10.2, IE Mobile 10, IE 11, Blackberry Browser 7, Android Browser 4.4.3-4.4.4, Android UC Browser 11.4  compat/compat

I'm not sure if we want to support all those browsers. Maybe adding "> 1%" to my above suggestion would cover all the remaining relevant browsers as well.

Also we should keep in mind, that this plugin only checks a subset of the ecmascript api. (For example it will not mark array.prototype.fetch as an error for IE 11)

micgro42 commented 7 years ago

Also, I would like to add a few more rules to the .eslintrc:

        "indent": [
            "error",
            4
        ],
        "quotes": [
            "error",
            "single"
        ],
        "dot-notation": ["warn"],
        "object-shorthand": ["error", "never"],
        "linebreak-style": [
            "error",
            "unix"
        ],
        "no-implicit-globals": "error",
        "no-return-assign": "error",
        "no-throw-literal": "error",
        "strict": ["error", "function"],
micgro42 commented 7 years ago

Finally, I would like to move .eslintrc to .eslintrc.js so we can use javascript syntax, including comments in this file.

splitbrain commented 7 years ago

all fine with me! go ahead.