Skip to content

Commit

Permalink
chore: update deps and lint
Browse files Browse the repository at this point in the history
# Conflicts:
#	packages/@interactjs/dev-tools/visualizer/Visualizer.vue
#	packages/@interactjs/dev-tools/visualizer/plugin.ts
#	packages/@interactjs/modifiers/avoid/avoid.ts
#	packages/@interactjs/modifiers/spring/spring.ts
#	packages/@interactjs/modifiers/transform/transform.spec.ts
#	packages/@interactjs/react/types.ts
#	packages/@interactjs/types/index.ts
#	packages/@interactjs/vue/package.json
  • Loading branch information
taye committed Mar 31, 2022
1 parent 9b3d901 commit fe36afc
Show file tree
Hide file tree
Showing 34 changed files with 1,524 additions and 1,690 deletions.
1 change: 0 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ extends:
settings:
import/resolver:
typescript:
project: './tsconfig.json'
react:
version: '16'

Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16.5.0
18 changes: 4 additions & 14 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@ const isProd = process.env.NODE_ENV === 'production'

module.exports = {
presets: [
[
require.resolve('@babel/preset-env'),
{ exclude: ['transform-regenerator'] },
],
[require.resolve('@babel/preset-env'), { exclude: ['transform-regenerator'] }],
[
require.resolve('@babel/preset-typescript'),
{ isTsx: false, onlyRemoveTypeImports: true, allExtensions: true },
{ isTsx: false, onlyRemoveTypeImports: true, allExtensions: true, allowDeclareFields: true },
],
].filter(Boolean),

plugins: [
require.resolve('./scripts/babel/vue-sfc'),
require.resolve('@babel/plugin-proposal-class-properties'),
[
require.resolve('@babel/plugin-transform-runtime'),
{
Expand All @@ -24,13 +20,7 @@ module.exports = {
],
isProd && require.resolve('./scripts/babel/for-of-array'),
isProd && require.resolve('@babel/plugin-proposal-optional-catch-binding'),
isProd && [
require.resolve('@babel/plugin-proposal-optional-chaining'),
{ loose: true },
],
[
require.resolve('@babel/plugin-transform-modules-commonjs'),
{ noInterop: isProd },
],
isProd && [require.resolve('@babel/plugin-proposal-optional-chaining'), { loose: true }],
[require.resolve('@babel/plugin-transform-modules-commonjs'), { noInterop: isProd }],
].filter(Boolean),
}
3 changes: 1 addition & 2 deletions examples/sortable/react.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import interact from '@interactjs/interactjs'
import { createElement as h, useState } from 'react'
import ReactDOM from 'react-dom'

import interact from '@interactjs/interactjs'

import { getData } from './shared.js'

// eslint-disable-next-line no-undef
Expand Down
3 changes: 1 addition & 2 deletions examples/sortable/vue.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// import Vue from 'vue/dist/vue.esm.browser.js'
import { createApp } from 'vue/dist/vue.esm-browser'

import interact from '@interactjs/interactjs'
import { createApp } from 'vue/dist/vue.esm-browser'

import { getData, sortableOptions, swappableOptions } from './shared.js'

Expand Down
4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Config } from '@jest/types'

// import { sourcesGlob } from './scripts/utils'
import { sourcesGlob } from './scripts/utils'

const config: Config.InitialOptions = {
preset: 'vijest',
Expand All @@ -13,7 +13,7 @@ const config: Config.InitialOptions = {
},
},
// collectCoverage: true,
// collectCoverageFrom: [sourcesGlob],
collectCoverageFrom: [sourcesGlob],
coveragePathIgnorePatterns: ['[\\\\/]_', '\\.d\\.ts$', '@interactjs[\\\\/](rebound|symbol-tree)[\\\\/]'],
coverageReporters: ['json', 'text', ['lcov', { projectRoot: 'packages/@interactjs' }]],
}
Expand Down
2 changes: 1 addition & 1 deletion jsdoc/jsdoc.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = {
extensions: ['js', 'ts'],
babelrc: false,
configFile: false,
presets: [require.resolve('@babel/preset-typescript')],
presets: [[require.resolve('@babel/preset-typescript'), { allowDeclareFields: true }]],
},

markdown: {
Expand Down
68 changes: 33 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,36 @@
"esnext": "_add_plugin_indexes && _esnext",
"test": "jest",
"test:debug": "node --inspect node_modules/.bin/jest --no-cache --runInBand ",
"tsc_lint_test": "_add_plugin_indexes && tsc -b -f && _lint && yarn test --coverage",
"tsc_lint_test": "_add_plugin_indexes && tsc -b -f && _lint && yarn test",
"prepare": "bin/_link; husky install"
},
"homepage": "https://interactjs.io/pro",
"description": "",
"devDependencies": {
"@babel/core": "^7.15.0",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-proposal-export-default-from": "^7.14.5",
"@babel/plugin-proposal-optional-catch-binding": "^7.14.5",
"@babel/plugin-proposal-optional-chaining": "^7.14.5",
"@babel/plugin-transform-modules-commonjs": "^7.15.0",
"@babel/plugin-transform-runtime": "^7.15.0",
"@babel/preset-env": "^7.15.0",
"@babel/preset-typescript": "^7.15.0",
"@babel/register": "^7.15.3",
"@babel/runtime": "^7.15.3",
"@babel/core": "^7.17.8",
"@babel/plugin-proposal-export-default-from": "^7.16.7",
"@babel/plugin-proposal-optional-catch-binding": "^7.16.7",
"@babel/plugin-proposal-optional-chaining": "^7.16.7",
"@babel/plugin-transform-modules-commonjs": "^7.17.7",
"@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.16.11",
"@babel/preset-typescript": "^7.16.7",
"@babel/register": "^7.17.7",
"@babel/runtime": "^7.17.8",
"@types/jest": "^27.0.1",
"@types/node": "^16.7.4",
"@types/react": "^17.0.19",
"@types/shelljs": "^0.8.9",
"@types/tape": "^4.13.2",
"@typescript-eslint/eslint-plugin": "^4.29.3",
"@typescript-eslint/eslint-plugin-tslint": "^4.29.3",
"@typescript-eslint/parser": "^4.29.3",
"@vitejs/plugin-vue": "^1.6.0",
"@vue/babel-plugin-jsx": "^1.0.6",
"@vue/compiler-sfc": "^3.2.6",
"@vue/reactivity": "^3.2.6",
"@vue/runtime-dom": "^3.2.6",
"@vue/test-utils": "^1.2.2",
"@typescript-eslint/eslint-plugin": "^5.17.0",
"@typescript-eslint/eslint-plugin-tslint": "^5.17.0",
"@typescript-eslint/parser": "^5.17.0",
"@vitejs/plugin-vue": "^2.3.1",
"@vue/babel-plugin-jsx": "^1.1.1",
"@vue/compiler-sfc": "^3.2.31",
"@vue/reactivity": "^3.2.31",
"@vue/runtime-dom": "^3.2.31",
"@vue/test-utils": "^2.0.0-rc.17",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-plugin-syntax-jsx": "^6.18.0",
"babelify": "^10.0.0",
Expand All @@ -58,17 +57,17 @@
"del": "^6.0.0",
"derequire": "^2.1.1",
"errorify": "^0.3.1",
"eslint": "^7.32.0",
"eslint": "^8.12.0",
"eslint-config-standard": "^16.0.3",
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jest": "^24.4.0",
"eslint-plugin-markdown": "^2.0.1",
"eslint-import-resolver-typescript": "^2.7.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^26.1.3",
"eslint-plugin-markdown": "^2.2.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-require-path-exists": "^1.1.9",
"eslint-plugin-vue": "^7.17.0",
"eslint-plugin-vue": "^8.5.0",
"fs-extra": "^10.0.0",
"glob": "^7.1.7",
"hash-sum": "^2.0.0",
Expand All @@ -80,8 +79,8 @@
"lint-staged": "^11.1.2",
"mkdirp": "^1.0.4",
"nodemon": "^2.0.12",
"p-queue": "^7.1.0",
"prettier": "^2.3.2",
"p-queue": "6",
"prettier": "^2.6.1",
"promise-polyfill": "^8.2.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
Expand All @@ -94,11 +93,10 @@
"temp": "^0.9.4",
"terser": "^5.7.2",
"ts-node": "^10.2.1",
"tslint": "^6.1.3",
"typescript": "^4.4.2",
"vijest": "^0.0.0",
"vite": "^2.5.1",
"vue": "^3.2.6",
"vijest": "^0.0.1",
"vite": "^2.8.6",
"vue": "^3.2.31",
"yargs": "^17.1.1"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions packages/@interactjs/actions/drag/drag.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('actions/drag', () => {
})

describe('interactable.draggable method', () => {
const interactable = ({
const interactable = {
options: {
drag: {},
},
Expand All @@ -29,7 +29,7 @@ describe('actions/drag', () => {
setOnEvents: () => {
calledSetOnEvents = true
},
} as unknown) as Interactable
} as unknown as Interactable
let calledSetPerAction = false
let calledSetOnEvents = false

Expand Down
12 changes: 7 additions & 5 deletions packages/@interactjs/actions/drop/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,13 @@ function collectDrops ({ interactables }: Scope, draggableElement: Element) {
}

// query for new elements if necessary
const dropElements = (is.string(dropzone.target)
? dropzone._context.querySelectorAll(dropzone.target)
: is.array(dropzone.target)
? dropzone.target
: [dropzone.target]) as Element[]
const dropElements = (
is.string(dropzone.target)
? dropzone._context.querySelectorAll(dropzone.target)
: is.array(dropzone.target)
? dropzone.target
: [dropzone.target]
) as Element[]

for (const dropzoneElement of dropElements) {
if (dropzoneElement !== draggableElement) {
Expand Down
11 changes: 10 additions & 1 deletion packages/@interactjs/actions/gesture/gesture.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@ describe('actions/gesture', () => {

test('interactable.gesturable() method', () => {
const rect = Object.freeze({ top: 100, left: 200, bottom: 300, right: 400 })
const { scope, interaction, interactable, target: element, coords, down, start, move } = helpers.testEnv({
const {
scope,
interaction,
interactable,
target: element,
coords,
down,
start,
move,
} = helpers.testEnv({
plugins: [gesture],
rect,
})
Expand Down
2 changes: 1 addition & 1 deletion packages/@interactjs/auto-scroll/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ declare module '@interactjs/core/options' {
}

export interface AutoScrollOptions {
container?: Window | HTMLElement | string;
container?: Window | HTMLElement | string
margin?: number
distance?: number
interval?: number
Expand Down
3 changes: 1 addition & 2 deletions packages/@interactjs/core/Interactable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import { getWindow } from '@interactjs/utils/window'

import { Eventable } from './Eventable'
import isNonNativeEvent from './isNonNativeEvent'
import type { ActionDefaults, Defaults, OptionsArg, PerActionDefaults } from './options'
import { Options } from './options'
import type { ActionDefaults, Defaults, OptionsArg, PerActionDefaults, Options } from './options'

type IgnoreValue = string | Element | boolean
type DeltaSource = 'page' | 'client'
Expand Down
10 changes: 9 additions & 1 deletion packages/@interactjs/core/Interaction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,15 @@ describe('core/Interaction', () => {
})

test('Interaction.start', () => {
const { interaction, interactable, scope, event, target: element, down, stop } = helpers.testEnv({
const {
interaction,
interactable,
scope,
event,
target: element,
down,
stop,
} = helpers.testEnv({
plugins: [drag],
})
const action = { name: 'drag' } as const
Expand Down
11 changes: 5 additions & 6 deletions packages/@interactjs/core/Interaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ import { warnOnce, copyAction } from '@interactjs/utils/misc'
import * as pointerUtils from '@interactjs/utils/pointerUtils'
import * as rectUtils from '@interactjs/utils/rect'

import type { ActionDefaults } from '@interactjs/core/options'

import type { EventPhase } from './InteractEvent'
import { InteractEvent } from './InteractEvent'
import type { Interactable } from './Interactable'
import { PointerInfo } from './PointerInfo'
import type { ActionDefaults } from './options'
import type { ActionName, Scope } from './scope'

export interface ActionProps<T extends ActionName | null = never> {
Expand Down Expand Up @@ -148,10 +147,10 @@ export class Interaction<T extends ActionName | null = ActionName> {
event: PointerEventType
eventTarget: Node
} = {
pointer: null,
event: null,
eventTarget: null,
}
pointer: null,
event: null,
eventTarget: null,
}

// previous action event
prevEvent: InteractEvent<T, EventPhase> = null
Expand Down
6 changes: 3 additions & 3 deletions packages/@interactjs/core/scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ export class Scope {
list: Plugin[]
map: { [id: string]: Plugin }
} = {
list: [],
map: {},
}
list: [],
map: {},
}

constructor () {
const scope = this
Expand Down
11 changes: 10 additions & 1 deletion packages/@interactjs/dev-tools/devTools.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ test('devTools', () => {
}),
}

const { scope, interaction, interactable, target: element, down, start, move, stop } = helpers.testEnv({
const {
scope,
interaction,
interactable,
target: element,
down,
start,
move,
stop,
} = helpers.testEnv({
plugins: [devToolsWithLogger, drag, resize],
})

Expand Down
1 change: 1 addition & 0 deletions packages/@interactjs/dev-tools/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type Interaction from '@interactjs/core/Interaction'
import type { Scope, Plugin } from '@interactjs/core/scope'
// eslint-disable-next-line import/no-extraneous-dependencies
import visualizer from '@interactjs/dev-tools/visualizer/plugin'
import type { Element, OptionMethod } from '@interactjs/types/index'
import domObjects from '@interactjs/utils/domObjects'
Expand Down
2 changes: 1 addition & 1 deletion packages/@interactjs/modifiers/Modification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export default class Modification {
arg.state = state
const { options, methods } = state

const endPosition = methods.beforeEnd && methods.beforeEnd((arg as unknown) as ModifierArg)
const endPosition = methods.beforeEnd && methods.beforeEnd(arg as unknown as ModifierArg)

if (endPosition) {
this.endResult = endPosition
Expand Down
Loading

0 comments on commit fe36afc

Please sign in to comment.