From 3b65ac669584787f825437e075666fa9e464355b Mon Sep 17 00:00:00 2001 From: Seth Bertalotto Date: Wed, 5 Jul 2023 09:50:49 -0700 Subject: [PATCH] chore: upgrade to prettier@3 (#576) --- .eslintrc.js | 6 ++++-- .github/workflows/node.js.yml | 21 ++++++++++----------- package.json | 7 ++++--- src/core/ReactI13n.js | 2 +- src/hooks/useViewportDetect.js | 2 +- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index d441a8b2..7ba0d8a0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,8 +3,10 @@ module.exports = { rules: { 'comma-dangle': 0, 'consistent-return': 0, + 'default-param-last': 0, 'func-names': 0, 'max-len': [2, 120, 4], + 'no-console': 0, 'no-continue': 0, 'no-func-assign': 0, 'no-param-reassign': 0, @@ -21,11 +23,11 @@ module.exports = { }, env: { browser: true, - es6: true, + es2022: true, jasmine: true, jest: true, node: true }, plugins: ['import', 'react', 'react-hooks'], - parser: 'babel-eslint' + parser: '@babel/eslint-parser', }; diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index d1fac0d9..183e45f1 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -2,24 +2,23 @@ name: Node.js CI on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: build: - runs-on: ubuntu-latest strategy: matrix: - node-version: [16.x] + node-version: [16.x, 18.x] steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - run: npm i - - run: npm test + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + - run: npm i + - run: npm test diff --git a/package.json b/package.json index 0a9dd4f3..30f0b262 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "func": "npm run dist && npm run dist-functional && grunt functional", "func-debug": "npm run dist && npm run dist-functional && grunt functional-debug", "lint": "eslint src", + "lint:fix": "eslint src --fix", "prepublish": "npm run dist", "test": "jest src --coverage --coverageReporters=lcov", "unit": "jest src" @@ -33,6 +34,7 @@ "devDependencies": { "@babel/cli": "^7.8.4", "@babel/core": "^7.9.6", + "@babel/eslint-parser": "^7.22.6", "@babel/plugin-proposal-class-properties": "^7.8.3", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.1", "@babel/plugin-proposal-object-rest-spread": "^7.10.1", @@ -42,13 +44,12 @@ "@babel/preset-react": "^7.9.4", "@babel/register": "^7.9.0", "@testing-library/react": "^14.0.0", - "babel-eslint": "^10.0.1", "babel-loader": "^9.0.1", "babel-plugin-dynamic-import-node": "^2.2.0", "babel-plugin-syntax-dynamic-import": "^6.18.0", "benchmark": "^2.1.3", "es5-shim": "^4.5.12", - "eslint": "^8.2.0", + "eslint": "^8.44.0", "eslint-config-airbnb": "^19.0.0", "eslint-plugin-import": "^2.16.0", "eslint-plugin-jsx-a11y": "^6.2.1", @@ -71,7 +72,7 @@ "mocha": "^10.0.0", "object-assign": "^4.0.0", "pre-commit": "^1.0.0", - "prettier": "^2.0.5", + "prettier": "^3.0.0", "promise": "^8.0.2", "react": "^18.0.0", "react-dom": "^18.0.0", diff --git a/src/core/ReactI13n.js b/src/core/ReactI13n.js index 0f7ee2fa..603b1b10 100644 --- a/src/core/ReactI13n.js +++ b/src/core/ReactI13n.js @@ -90,7 +90,7 @@ class ReactI13n { * @async */ execute = (eventName, payload, callback) => { - payload = Object.assign({}, payload); + payload = { ...payload }; payload.env = ENVIRONMENT; payload.i13nNode = payload.i13nNode || this.getRootI13nNode(); const promiseHandlers = this.getEventHandlers(eventName, payload); diff --git a/src/hooks/useViewportDetect.js b/src/hooks/useViewportDetect.js index 19877c70..7f25fe4b 100644 --- a/src/hooks/useViewportDetect.js +++ b/src/hooks/useViewportDetect.js @@ -10,7 +10,7 @@ const useViewportDetect = ({ }) => { const onEnterViewport = useCallback(() => { node.setIsInViewport(true); - executeEvent?.('enterViewport', {i13nNode: node}); + executeEvent?.('enterViewport', { i13nNode: node }); }, [executeEvent, node]); const onLeaveViewport = useCallback(() => {