Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #313 - bring back the eslint checks into a working state #317

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .ci-scripts/ci-eslint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
set -e

## NPM eslint
npm install -s eslint
mkdir node_modules
npm install --save-dev eslint

## NPM test
find ./libdec -type f -name "*.js" | xargs node_modules/.bin/eslint -c ./.eslintrc.json
find ./js -type f -name "*.js" | xargs node_modules/.bin/eslint -c .eslint.config.js
44 changes: 44 additions & 0 deletions .eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
module.exports = {
"languageOptions": {
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"ecmaFeatures": {}
},
"globals": {
"process": true,
"BigInt": true,
"Global": true,
"Limits": true,
"radare2": true,
"atob": true,
"btoa": true,
"unit": true,
"console": true
}
},
//"extends": "eslint:recommended",
"rules": {
"semi": [2, "always"],
"no-console": ["error", {
"allow": ["log"]
}],
"no-redeclare": ["error", {
"builtinGlobals": false
}],
"no-empty": ["error", {
"allowEmptyCatch": true
}],
"no-unused-vars": ["error", {
"varsIgnorePattern": "r2dec_|\\binclude\\b",
"args": "none"
}],
"curly": "error",
"no-sparse-arrays": "warn",
"no-cond-assign": ["error", "except-parens"],
"no-constant-condition": ["error", {
"checkLoops": false
}],
"no-control-regex": "warn"
},
};
42 changes: 0 additions & 42 deletions .eslintrc.json

This file was deleted.

3 changes: 2 additions & 1 deletion js/libdec/arch/x86.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ var _value_at = function(address) {
return x.length > 1 ? x : '0' + x;
}).join('');
return Long.from(p, true, 16);
// eslint-disable-next-line no-unused-vars
} catch (e) {}
}
return null;
Expand Down Expand Up @@ -2329,4 +2330,4 @@ var _apply_math_x86 = {
},
};

export default x86x64;
export default x86x64;
2 changes: 1 addition & 1 deletion js/libdec/core/classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export default function(icj) {
}
return null;
};
}
}
3 changes: 2 additions & 1 deletion js/libdec/core/extra.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ const _tryas = {
int: function(x) {
try {
return Long.from(x.trim(), false, (x.trim().indexOf('0x') == 0 ? 16 : 10));
// eslint-disable-next-line no-unused-vars
} catch (e) {}
return x;
}
Expand All @@ -221,4 +222,4 @@ export default {
}
return _magic_math_values[address];
}
};
};
2 changes: 1 addition & 1 deletion js/libdec/long.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ Long.MAX_S32_VALUE = new Long(Limits.ST32_MAX, false);
Long.MAX_S16_VALUE = new Long(Limits.ST16_MAX, false);


export default Long;
export default Long;
3 changes: 3 additions & 0 deletions js/libdec/r2pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function r2json(m, def) {
var x = r2str(m, true);
try {
return x.length > 0 ? JSONex.parse(x) : def;
// eslint-disable-next-line no-unused-vars
} catch(e){}
return def;
}
Expand All @@ -33,6 +34,7 @@ function r2int(value, def) {
if (x != '') {
try {
return parseInt(x);
// eslint-disable-next-line no-unused-vars
} catch (e) {}
}
return def || 0;
Expand All @@ -43,6 +45,7 @@ function r2long(value, def) {
if (x != '') {
try {
return Long.from(x, true);
// eslint-disable-next-line no-unused-vars
} catch (e) {}
}
return def || Long.UZERO;
Expand Down