kopia lustrzana https://github.com/c9/core
Merge pull request +15889 from c9/ide-eslint
fix support for experimental js syntaxpull/468/merge
commit
386b578f12
|
@ -50,7 +50,9 @@ q;
|
||||||
|
|
||||||
class Blie {}
|
class Blie {}
|
||||||
|
|
||||||
|
@exported
|
||||||
class Model extends Blie {
|
class Model extends Blie {
|
||||||
|
x = 1
|
||||||
constructor(properties) {
|
constructor(properties) {
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
}
|
}
|
||||||
|
@ -58,6 +60,12 @@ class Model extends Blie {
|
||||||
toObject() {
|
toObject() {
|
||||||
return this.properties;
|
return this.properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@exported(1)
|
||||||
|
async f() {
|
||||||
|
this::exported();
|
||||||
|
::myFun;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new Model();
|
new Model();
|
|
@ -0,0 +1,2 @@
|
||||||
|
acorn
|
||||||
|
node_modules
|
|
@ -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
|
@ -203,8 +203,15 @@ handler.analyzeSync = function(value, ast, path) {
|
||||||
if (isJson && level !== "error")
|
if (isJson && level !== "error")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m.message.match(/'([^']*)' is defined but never used/)) {
|
// convert to 0 based offsets
|
||||||
var target = RegExp.$1;
|
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)
|
if (target.toUpperCase() === target && target.toLowerCase() !== target)
|
||||||
return; // ignore unused constants
|
return; // ignore unused constants
|
||||||
if (target === "h")
|
if (target === "h")
|
||||||
|
@ -215,12 +222,8 @@ handler.analyzeSync = function(value, ast, path) {
|
||||||
if (m.ruleId && m.ruleId.match(/space|spacing/) && m.severity === 1)
|
if (m.ruleId && m.ruleId.match(/space|spacing/) && m.severity === 1)
|
||||||
level = "info";
|
level = "info";
|
||||||
|
|
||||||
// work around column offset bug
|
|
||||||
m.column--;
|
|
||||||
m.line--;
|
|
||||||
|
|
||||||
var ec;
|
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 line = doc.getLine(m.line);
|
||||||
var id = workerUtil.getFollowingIdentifier(line, m.column);
|
var id = workerUtil.getFollowingIdentifier(line, m.column);
|
||||||
if (m.message.match(/is already defined/) && line.match("for \\(var " + id))
|
if (m.message.match(/is already defined/) && line.match("for \\(var " + id))
|
||||||
|
|
Ładowanie…
Reference in New Issue