Merge pull request +15889 from c9/ide-eslint

fix support for experimental js syntax
pull/468/merge
Harutyun Amirjanyan 2017-12-18 16:09:03 +04:00 zatwierdzone przez GitHub
commit 386b578f12
5 zmienionych plików z 218 dodań i 157 usunięć

Wyświetl plik

@ -50,7 +50,9 @@ q;
class Blie {}
@exported
class Model extends Blie {
x = 1
constructor(properties) {
this.properties = properties;
}
@ -58,6 +60,12 @@ class Model extends Blie {
toObject() {
return this.properties;
}
@exported(1)
async f() {
this::exported();
::myFun;
}
}
new Model();

Wyświetl plik

@ -0,0 +1,2 @@
acorn
node_modules

Wyświetl plik

@ -0,0 +1,18 @@
#!/bin/bash
set -euo pipefail
cd `dirname $0`
npm i
if ! [ -d acorn/.git ]; then
git clone https://github.com/c9/acorn
fi
pushd acorn
git fetch origin
git reset origin/master --hard
npm i
npm run build
popd
cp acorn/dist/* node_modules/acorn/dist
node eslint.js

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -203,8 +203,15 @@ handler.analyzeSync = function(value, ast, path) {
if (isJson && level !== "error")
return;
if (m.message.match(/'([^']*)' is defined but never used/)) {
var target = RegExp.$1;
// convert to 0 based offsets
m.column--;
m.line--;
m.endLine--;
m.endColumn--;
if (m.message.match(/but never used/)) {
var line = doc.getLine(m.line);
var target = line.slice(m.column, m.endColumn)
if (target.toUpperCase() === target && target.toLowerCase() !== target)
return; // ignore unused constants
if (target === "h")
@ -215,12 +222,8 @@ handler.analyzeSync = function(value, ast, path) {
if (m.ruleId && m.ruleId.match(/space|spacing/) && m.severity === 1)
level = "info";
// work around column offset bug
m.column--;
m.line--;
var ec;
if (m.message.match(/is not defined|was used before it was defined|is already declared|is already defined|unexpected identifier|defined but never used/i)) {
if (m.message.match(/is not defined|was used before it was defined|is already declared|is already defined|unexpected identifier|but never used/i)) {
var line = doc.getLine(m.line);
var id = workerUtil.getFollowingIdentifier(line, m.column);
if (m.message.match(/is already defined/) && line.match("for \\(var " + id))