Skip to content

chore: add object-shorthand eslint rule #1159

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
25 changes: 1 addition & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node-version: [18.x, 20.x, 22.x]
node-version: [20.x, 22.x, 24.x]

steps:
- uses: actions/checkout@v2
Expand All @@ -29,26 +29,3 @@ jobs:
yarn build-types
[ $(git diff types.d.ts | wc -l) -gt 0 ] && echo 'Diff exists in types.d.ts. Please change jsdoc.' && exit 1
tsc --noEmit types.d.ts

- name: install valgrind
run: sudo apt-get install -y valgrind

- name: benchmark
run: python cachegrind.py node test/benchmark2.js > output.txt

- name: Download previous benchmark result
uses: actions/cache@v1
with:
path: ./cache
key: ${{ runner.os }}-${{matrix.node-version}}-benchmark

- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: "customSmallerIsBetter"
output-file-path: output.txt
external-data-json-path: ./cache/benchmark-data.json
alert-threshold: "105%"
fail-on-alert: true
env:
CI: true
137 changes: 0 additions & 137 deletions cachegrind.py

This file was deleted.

1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default [
rules: {
"prefer-const": "error",
"no-var": "error",
"object-shorthand": "error",
curly: ["error", "multi-line"],
},
},
Expand Down
33 changes: 16 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,29 @@
],
"license": "BSD-3-Clause",
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.14.0",
"@types/node": "^22.9.0",
"babel-loader": "^9.2.1",
"@babel/core": "^7.27.4",
"@babel/preset-env": "^7.27.2",
"@eslint/js": "^9.29.0",
"@types/node": "^24.0.4",
"babel-loader": "^10.0.0",
"benchmark": "^2.1.4",
"coveralls": "^3.0.3",
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^28.9.0",
"eslint-plugin-prettier": "^5.2.1",
"globals": "^15.12.0",
"husky": "^9.1.6",
"jest": "^29.7.0",
"eslint": "^9.29.0",
"eslint-config-prettier": "^10.1.5",
"eslint-plugin-jest": "^29.0.1",
"eslint-plugin-prettier": "^5.5.0",
"globals": "^16.2.0",
"husky": "^9.1.7",
"jest": "^30.0.3",
"jest-runner-eslint": "^2.2.1",
"jsdoc": "^3.6.11",
"jsdoc": "^4.0.4",
"jsdoc-template": "^1.2.0",
"lodash.template": ">=4.5.0",
"prettier": "^3.3.3",
"prettier": "^3.6.1",
"tsd-jsdoc": "^2.5.0",
"typescript": "^5.6.3",
"typescript": "^5.8.3",
"webpack": "5.96.0",
"webpack-cli": "^5.1.4",
"webpack-cli": "^6.0.1",
"yarpm": "^1.2.0"
},
"dependencies": {}
Expand Down
2 changes: 1 addition & 1 deletion src/lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Lexer.prototype.setInput = function (input) {
first_encaps_node: false,
// for backward compatible
/* istanbul ignore next */
toString: function () {
toString() {
this.label;
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/lexer/attribute.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
module.exports = {
attributeIndex: 0,
attributeListDepth: {},
matchST_ATTRIBUTE: function () {
matchST_ATTRIBUTE() {
let ch = this.input();
if (this.is_WHITESPACE()) {
do {
Expand Down
4 changes: 2 additions & 2 deletions src/lexer/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
/*
* Reads a single line comment
*/
T_COMMENT: function () {
T_COMMENT() {
while (this.offset < this.size) {
const ch = this.input();
if (ch === "\n" || ch === "\r") {
Expand All @@ -35,7 +35,7 @@ module.exports = {
/*
* Behaviour : https://github.com/php/php-src/blob/master/Zend/zend_language_scanner.l#L1927
*/
T_DOC_COMMENT: function () {
T_DOC_COMMENT() {
let ch = this.input();
let token = this.tok.T_COMMENT;
if (ch === "*") {
Expand Down
4 changes: 2 additions & 2 deletions src/lexer/initial.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"use strict";

module.exports = {
nextINITIAL: function () {
nextINITIAL() {
if (
this.conditionStack.length > 1 &&
this.conditionStack[this.conditionStack.length - 1] === "INITIAL"
Expand All @@ -18,7 +18,7 @@ module.exports = {
}
return this;
},
matchINITIAL: function () {
matchINITIAL() {
while (this.offset < this.size) {
let ch = this.input();
if (ch == "<") {
Expand Down
10 changes: 5 additions & 5 deletions src/lexer/numbers.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if (process.arch == "x64") {
}

module.exports = {
consume_NUM: function () {
consume_NUM() {
let ch = this.yytext[0];
let hasPoint = ch === ".";
if (ch === "0") {
Expand Down Expand Up @@ -124,7 +124,7 @@ module.exports = {
}
},
// read hexa
consume_HNUM: function () {
consume_HNUM() {
while (this.offset < this.size) {
const ch = this.input();
if (!this.is_HEX()) {
Expand All @@ -135,7 +135,7 @@ module.exports = {
return this.tok.T_LNUMBER;
},
// read a generic number
consume_LNUM: function () {
consume_LNUM() {
while (this.offset < this.size) {
const ch = this.input();
if (!this.is_NUM()) {
Expand All @@ -146,7 +146,7 @@ module.exports = {
return this.tok.T_LNUMBER;
},
// read binary
consume_BNUM: function () {
consume_BNUM() {
let ch;
while (this.offset < this.size) {
ch = this.input();
Expand All @@ -158,7 +158,7 @@ module.exports = {
return this.tok.T_LNUMBER;
},
// read an octal number
consume_ONUM: function () {
consume_ONUM() {
while (this.offset < this.size) {
const ch = this.input();
if (!this.is_OCTAL()) {
Expand Down
6 changes: 3 additions & 3 deletions src/lexer/property.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"use strict";

module.exports = {
matchST_LOOKING_FOR_PROPERTY: function () {
matchST_LOOKING_FOR_PROPERTY() {
let ch = this.input();
if (ch === "-") {
ch = this.input();
Expand All @@ -28,7 +28,7 @@ module.exports = {
if (ch) this.unput(1);
return false;
},
matchST_LOOKING_FOR_VARNAME: function () {
matchST_LOOKING_FOR_VARNAME() {
let ch = this.input();

// SHIFT STATE
Expand All @@ -52,7 +52,7 @@ module.exports = {
// stops looking for a varname and starts the scripting mode
return false;
},
matchST_VAR_OFFSET: function () {
matchST_VAR_OFFSET() {
const ch = this.input();
if (this.is_NUM_START()) {
this.consume_NUM();
Expand Down
4 changes: 2 additions & 2 deletions src/lexer/scripting.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"use strict";

module.exports = {
matchST_IN_SCRIPTING: function () {
matchST_IN_SCRIPTING() {
let ch = this.input();
switch (ch) {
case " ":
Expand Down Expand Up @@ -100,7 +100,7 @@ module.exports = {
);
},

T_WHITESPACE: function () {
T_WHITESPACE() {
while (this.offset < this.size) {
const ch = this.input();
if (ch === " " || ch === "\t" || ch === "\n" || ch === "\r") {
Expand Down
Loading