Skip to content

Commit

Permalink
Upgrade eslint v9 and replace "standard" by "neostandard"
Browse files Browse the repository at this point in the history
  • Loading branch information
hlecorche committed Nov 24, 2024
1 parent 077014d commit 85e7909
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 43 deletions.
22 changes: 0 additions & 22 deletions .eslintrc.js

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.**

Expand Down
26 changes: 13 additions & 13 deletions assets/js/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function sendRequest (options) {
const eventBeginning = new CustomEvent('ec-crud-ajax', {
cancelable: true,
detail: {
options: options
options
}
})
document.dispatchEvent(eventBeginning)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -282,8 +282,8 @@ export function updateDom (element, updateMode, content) {
cancelable: true,
detail: {
element: originElement,
updateMode: updateMode,
content: content
updateMode,
content
}
})
element.dispatchEvent(eventBefore)
Expand Down Expand Up @@ -313,8 +313,8 @@ export function updateDom (element, updateMode, content) {
bubbles: true,
detail: {
element: originElement,
updateMode: updateMode,
content: content
updateMode,
content
}
})
element.dispatchEvent(eventAfter)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -384,17 +384,17 @@ 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)
runCallback(options.onError, statusText, response)

const eventOnComplete = new CustomEvent('ec-crud-ajax-on-complete', {
detail: {
statusText: statusText,
response: response
statusText,
response
}
})
document.dispatchEvent(eventOnComplete)
Expand Down
24 changes: 24 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -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'],
}
}
];
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
"@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",
"globals": "^15.12",
"install": "^0.13.0",
"jasmine": "^4.0",
"jquery": "^3",
Expand All @@ -17,6 +14,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"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/assets/js/ajax.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ describe('Test Ajax.sendRequest', function () {
priority: -99
},
update: '#ajax-result .content',
updateMode: updateMode
updateMode
})

expect(callbackSuccess).toHaveBeenCalledWith(expectedContent)
Expand Down

0 comments on commit 85e7909

Please sign in to comment.