update dev dependencies ava, eslint, eslint-plugin-ava and migrate to ES modules

This commit is contained in:
Daniel Waxweiler 2022-01-09 12:11:24 +01:00
parent fa91324f18
commit 647629b5a9
16 changed files with 988 additions and 2513 deletions

5
.gulp.json Normal file
View File

@ -0,0 +1,5 @@
{
"flags": {
"gulpfile": "gulpfile.cjs"
}
}

3458
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@
"version": "0.7.0",
"description": "Display Mobilizon events in WordPress.",
"private": true,
"type": "module",
"scripts": {
"build-dev": "webpack --mode=development && gulp inject",
"build-prod": "ava && webpack --mode=production && gulp inject",
@ -29,11 +30,11 @@
"object-hash": "^2.2.0"
},
"devDependencies": {
"ava": "^3.15.0",
"ava": "^4.0.1",
"c8": "^7.10.0",
"copy-webpack-plugin": "^10.2.0",
"eslint": "^8.4.1",
"eslint-plugin-ava": "^13.1.0",
"eslint": "^8.6.0",
"eslint-plugin-ava": "^13.2.0",
"esm": "^3.2.25",
"gulp": "^4.0.2",
"gulp-replace": "^1.1.3",
@ -48,9 +49,6 @@
"ava": {
"files": [
"./source/**/*test.js"
],
"require": [
"esm"
]
},
"additionalDetails": {

View File

@ -1,5 +1,5 @@
import test from 'ava'
import DateTimeWrapper from './date-time-wrapper'
import DateTimeWrapper from './date-time-wrapper.js'
test('#getShortDate usual date', (t) => {
const d = new DateTimeWrapper({ text: '2020-12-24T16:45:00Z' })

View File

@ -1,7 +1,7 @@
import test from 'ava'
import { JSDOM } from 'jsdom'
import { displayEvents, displayErrorMessage } from './events-displayer'
import { displayEvents, displayErrorMessage } from './events-displayer.js'
let document

View File

@ -1,5 +1,5 @@
import Formatter from './formatter'
import { createAnchorElement } from './html-creator'
import Formatter from './formatter.js'
import { createAnchorElement } from './html-creator.js'
export function displayEvents({ data, document, list }) {
const locale = list.getAttribute('data-locale')

View File

@ -1,5 +1,5 @@
import { displayEvents, displayErrorMessage } from './events-displayer'
import * as GraphqlWrapper from './graphql-wrapper'
import { displayEvents, displayErrorMessage } from './events-displayer.js'
import * as GraphqlWrapper from './graphql-wrapper.js'
const NAME = '<wordpress-name>'

View File

@ -1,5 +1,5 @@
import test from 'ava'
import Formatter from './formatter'
import Formatter from './formatter.js'
test('#formatDate one date', (t) => {
const date = Formatter.formatDate({

View File

@ -1,4 +1,4 @@
import DateTimeWrapper from './date-time-wrapper'
import DateTimeWrapper from './date-time-wrapper.js'
export default class Formatter {
static formatDate({ locale, timeZone, start, end, isShortOffsetNameShown }) {

View File

@ -1,6 +1,6 @@
import SessionCache from './session-cache'
import SessionCache from './session-cache.js'
import { request } from 'graphql-request'
import DateTimeWrapper from './date-time-wrapper'
import DateTimeWrapper from './date-time-wrapper.js'
export function getUpcomingEvents({ url, limit }) {
const query = `

View File

@ -1,7 +1,7 @@
import test from 'ava'
import { JSDOM } from 'jsdom'
import { createAnchorElement } from './html-creator'
import { createAnchorElement } from './html-creator.js'
let document

View File

@ -1,5 +1,5 @@
import test from 'ava'
import hash from './object-hash-wrapper'
import hash from './object-hash-wrapper.js'
test('#hash object', (t) => {
t.is(hash({ foo: 'bar' }), 'a75c05bdca7d704bdfcd761913e5a4e4636e956b')

View File

@ -1,5 +1,5 @@
import test from 'ava'
import SessionCache from './session-cache'
import SessionCache from './session-cache.js'
const fakeStorage = {
elements: {},

View File

@ -1,4 +1,4 @@
import hash from './object-hash-wrapper'
import hash from './object-hash-wrapper.js'
const MAX_AGE_IN_MS = 120000