Skip to content
This repository was archived by the owner on Feb 12, 2022. It is now read-only.

Commit 47b4374

Browse files
committed
Added typescript definitions
1 parent d83bc4e commit 47b4374

9 files changed

+95
-61
lines changed

.eslintrc

Lines changed: 0 additions & 57 deletions
This file was deleted.

.eslintrc.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
parser: babel-eslint
2+
3+
plugins:
4+
- react
5+
6+
extends:
7+
- plugin:import/errors
8+
- plugin:import/warnings
9+
10+
env:
11+
browser: true
12+
node: true
13+
es6: true
14+
mocha: true
15+
16+
ecmaFeatures:
17+
jsx: true
18+
19+
rules:
20+
# Strict mode
21+
strict: [2, never]
22+
23+
# Code style
24+
indent: [2, 2]
25+
quotes: [2, single]
26+
no-unused-vars: 1
27+
no-undef: 1
28+
object-curly-spacing: [2, always]
29+
30+
# JSX
31+
jsx-quotes: 1
32+
33+
# React
34+
react/display-name: 0
35+
react/jsx-boolean-value: 1
36+
react/jsx-closing-bracket-location: 1
37+
react/jsx-curly-spacing: 1
38+
react/jsx-max-props-per-line: 0
39+
react/jsx-indent-props: 0
40+
react/jsx-no-duplicate-props: 1
41+
react/jsx-no-undef: 1
42+
react/jsx-sort-prop-types: 0
43+
react/jsx-sort-props: 0
44+
react/jsx-uses-react: 1
45+
react/jsx-uses-vars: 1
46+
react/no-danger: 0
47+
react/no-set-state: 0
48+
react/no-did-mount-set-state: 1
49+
react/no-did-update-set-state: 1
50+
react/no-multi-comp: 1
51+
react/no-unknown-property: 1
52+
react/self-closing-comp: 1
53+
react/jsx-wrap-multilines: 1

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111
/node_modules
1212
/playground
1313
/test
14+
/yarn.lock

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
## 0.2.0 (April 17th, 2017)
4+
5+
- Added prop-types package to be compatible with React 16
6+
- Added typescript definitions
7+
38
## 0.1.10 (September 22th, 2016)
49

510
- Fixed issue with IE

LICENSE.txt renamed to LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright © 2016 Gabriel Bull
3+
Copyright © 2016-present Gabriel Bull
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

index.d.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export as namespace ReactAim;
2+
export = ReactAim;
3+
4+
import { Component, ReactElement } from 'react';
5+
6+
declare namespace ReactAim {
7+
type TargetSpec = {
8+
mouseEnter: (props: any, component: ReactElement) => void,
9+
mouseLeave: (props, component: ReactElement) => void,
10+
aimMove: (props, component: ReactElement, distance: number) => void,
11+
aimStart: (props, component: ReactElement, distance: number) => void,
12+
aimStop: (props, component: ReactElement) => void
13+
}
14+
15+
function target<P, S>(): Component<P, S>;
16+
function target<P, S>(spec: TargetSpec): Component<P, S>;
17+
function target<P, S>(source: any, spec: TargetSpec): Component<P, S>;
18+
19+
type SourceSpec = {
20+
mouseEnter: (props: any, component: ReactElement) => void,
21+
mouseLeave: (props, component: ReactElement) => void,
22+
};
23+
24+
function source<P, S>(): Component<P, S>;
25+
function source<P, S>(spec: SourceSpec): Component<P, S>;
26+
function source<P, S>(target: any, spec: SourceSpec): Component<P, S>;
27+
}

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "react-aim",
33
"author": "Gabriel Bull",
4-
"version": "0.1.10",
4+
"version": "0.2.0",
55
"description": "Determine the cursor aim for triggering mouse events.",
66
"main": "./lib/index.js",
7+
"types": "./index.d.ts",
78
"keywords": [
89
"react",
910
"react-component",
@@ -40,6 +41,7 @@
4041
"react-dom": "^15.0 || ^16.0"
4142
},
4243
"devDependencies": {
44+
"@types/react": "^15.0.22",
4345
"babel-core": "^6.24.1",
4446
"babel-eslint": "^7.2.2",
4547
"babel-loader": "^6.4.1",
@@ -49,6 +51,7 @@
4951
"babel-preset-stage-0": "^6.24.1",
5052
"chai": "^3.5.0",
5153
"eslint": "^3.19.0",
54+
"eslint-plugin-import": "^2.2.0",
5255
"eslint-plugin-react": "^6.10.3",
5356
"html-webpack-plugin": "^2.28.0",
5457
"mocha": "^3.2.0",

src/source.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { Component, PropTypes } from 'react';
1+
import React, { Component } from 'react';
2+
import PropTypes from 'prop-types';
23
import ReactDOM from 'react-dom';
34
import monitor from './monitor'
45

src/target.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { Component, PropTypes } from 'react';
1+
import React, { Component } from 'react';
2+
import PropTypes from 'prop-types';
23
import ReactDOM from 'react-dom';
34
import monitor from './monitor'
45

0 commit comments

Comments
 (0)