diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index ee37113..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,22 +0,0 @@ -module.exports = { - env: { - 'browser': true, - 'es6': true, - 'jasmine': true, - 'node': true - }, - extends: [ - 'standard' - ], - globals: { - Atomics: 'readonly', - SharedArrayBuffer: 'readonly' - }, - parserOptions: { - ecmaVersion: 2018, - sourceType: 'module' - }, - rules: { - 'linebreak-style': ['error', 'unix'], - } -} diff --git a/README.md b/README.md index b058385..eb79480 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,7 @@ ![Tests](https://github.com/e-commit/EcommitCrudBundle/workflows/Tests/badge.svg) -[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) - +[![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard) **WARNING: This branch is under development. Not use in production. You can use stable versions or 2.6 branch.** diff --git a/assets/js/ajax.js b/assets/js/ajax.js index 419ea81..89c8342 100644 --- a/assets/js/ajax.js +++ b/assets/js/ajax.js @@ -81,7 +81,7 @@ export function sendRequest (options) { const eventBeginning = new CustomEvent('ec-crud-ajax', { cancelable: true, detail: { - options: options + options } }) document.dispatchEvent(eventBeginning) @@ -152,7 +152,7 @@ export function sendRequest (options) { const eventBeforeSend = new CustomEvent('ec-crud-ajax-before-send', { cancelable: true, detail: { - options: options + options } }) document.dispatchEvent(eventBeforeSend) @@ -282,8 +282,8 @@ export function updateDom (element, updateMode, content) { cancelable: true, detail: { element: originElement, - updateMode: updateMode, - content: content + updateMode, + content } }) element.dispatchEvent(eventBefore) @@ -313,8 +313,8 @@ export function updateDom (element, updateMode, content) { bubbles: true, detail: { element: originElement, - updateMode: updateMode, - content: content + updateMode, + content } }) element.dispatchEvent(eventAfter) @@ -364,8 +364,8 @@ function generateParameters (result, propertyPath, property, value) { function executeEventsAndCallbacksSuccess (callbacksSuccess, options, data, response) { const eventOnSuccess = new CustomEvent('ec-crud-ajax-on-success', { detail: { - data: data, - response: response + data, + response } }) document.dispatchEvent(eventOnSuccess) @@ -374,7 +374,7 @@ function executeEventsAndCallbacksSuccess (callbacksSuccess, options, data, resp const eventOnComplete = new CustomEvent('ec-crud-ajax-on-complete', { detail: { statusText: response.statusText, - response: response + response } }) document.dispatchEvent(eventOnComplete) @@ -384,8 +384,8 @@ function executeEventsAndCallbacksSuccess (callbacksSuccess, options, data, resp function executeEventsAndCallbacksError (options, statusText, response) { const eventOnError = new CustomEvent('ec-crud-ajax-on-error', { detail: { - statusText: statusText, - response: response + statusText, + response } }) document.dispatchEvent(eventOnError) @@ -393,8 +393,8 @@ function executeEventsAndCallbacksError (options, statusText, response) { const eventOnComplete = new CustomEvent('ec-crud-ajax-on-complete', { detail: { - statusText: statusText, - response: response + statusText, + response } }) document.dispatchEvent(eventOnComplete) diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..15225a4 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,24 @@ +import globals from 'globals'; +import neostandard from 'neostandard'; + +export default [ + ...neostandard(), + { + languageOptions: { + ecmaVersion: 2018, + sourceType: 'module', + globals: { + ...globals.browser, + ...globals.node, + ...globals.jasmine, + Atomics: 'readonly', + SharedArrayBuffer: 'readonly', + jasmine: true + } + }, + + rules: { + '@stylistic/linebreak-style': ['error', 'unix'], + } + } +]; diff --git a/package.json b/package.json index 9b9cf13..ab9b7f9 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,9 @@ "@ecommit/crud-bundle": "link:assets", "@symfony/webpack-encore": "^3.0", "core-js": "^3.0.0", - "eslint": "^8.0", - "eslint-config-standard": "^16.0.3", - "eslint-plugin-import": "^2.24.2", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^6.0", + "eslint": "^9.0", + "eslint-plugin-promise": "^7.0", + "globals": "^15.12", "install": "^0.13.0", "jasmine": "^4.0", "jquery": "^3", @@ -17,6 +15,7 @@ "karma-jasmine-ajax": "^0.1.13", "karma-spec-reporter": "^0.0.32", "karma-webpack": "^5.0", + "neostandard": "^0.11.8", "webpack-notifier": "^1.6.0", "whatwg-fetch": "^3.6.2" }, diff --git a/tests/assets/js/ajax.spec.js b/tests/assets/js/ajax.spec.js index 92f15d3..3424357 100644 --- a/tests/assets/js/ajax.spec.js +++ b/tests/assets/js/ajax.spec.js @@ -978,7 +978,7 @@ describe('Test Ajax.sendRequest', function () { priority: -99 }, update: '#ajax-result .content', - updateMode: updateMode + updateMode }) expect(callbackSuccess).toHaveBeenCalledWith(expectedContent)