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

Commit

Permalink
Added typescript definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielbull committed Apr 18, 2017
1 parent d83bc4e commit 47b4374
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 61 deletions.
57 changes: 0 additions & 57 deletions .eslintrc

This file was deleted.

53 changes: 53 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
parser: babel-eslint

plugins:
- react

extends:
- plugin:import/errors
- plugin:import/warnings

env:
browser: true
node: true
es6: true
mocha: true

ecmaFeatures:
jsx: true

rules:
# Strict mode
strict: [2, never]

# Code style
indent: [2, 2]
quotes: [2, single]
no-unused-vars: 1
no-undef: 1
object-curly-spacing: [2, always]

# JSX
jsx-quotes: 1

# React
react/display-name: 0
react/jsx-boolean-value: 1
react/jsx-closing-bracket-location: 1
react/jsx-curly-spacing: 1
react/jsx-max-props-per-line: 0
react/jsx-indent-props: 0
react/jsx-no-duplicate-props: 1
react/jsx-no-undef: 1
react/jsx-sort-prop-types: 0
react/jsx-sort-props: 0
react/jsx-uses-react: 1
react/jsx-uses-vars: 1
react/no-danger: 0
react/no-set-state: 0
react/no-did-mount-set-state: 1
react/no-did-update-set-state: 1
react/no-multi-comp: 1
react/no-unknown-property: 1
react/self-closing-comp: 1
react/jsx-wrap-multilines: 1
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
/node_modules
/playground
/test
/yarn.lock
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## 0.2.0 (April 17th, 2017)

- Added prop-types package to be compatible with React 16
- Added typescript definitions

## 0.1.10 (September 22th, 2016)

- Fixed issue with IE
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt → LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright © 2016 Gabriel Bull
Copyright © 2016-present Gabriel Bull

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
27 changes: 27 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export as namespace ReactAim;
export = ReactAim;

import { Component, ReactElement } from 'react';

declare namespace ReactAim {
type TargetSpec = {
mouseEnter: (props: any, component: ReactElement) => void,
mouseLeave: (props, component: ReactElement) => void,
aimMove: (props, component: ReactElement, distance: number) => void,
aimStart: (props, component: ReactElement, distance: number) => void,
aimStop: (props, component: ReactElement) => void
}

function target<P, S>(): Component<P, S>;
function target<P, S>(spec: TargetSpec): Component<P, S>;
function target<P, S>(source: any, spec: TargetSpec): Component<P, S>;

type SourceSpec = {
mouseEnter: (props: any, component: ReactElement) => void,
mouseLeave: (props, component: ReactElement) => void,
};

function source<P, S>(): Component<P, S>;
function source<P, S>(spec: SourceSpec): Component<P, S>;
function source<P, S>(target: any, spec: SourceSpec): Component<P, S>;
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "react-aim",
"author": "Gabriel Bull",
"version": "0.1.10",
"version": "0.2.0",
"description": "Determine the cursor aim for triggering mouse events.",
"main": "./lib/index.js",
"types": "./index.d.ts",
"keywords": [
"react",
"react-component",
Expand Down Expand Up @@ -40,6 +41,7 @@
"react-dom": "^15.0 || ^16.0"
},
"devDependencies": {
"@types/react": "^15.0.22",
"babel-core": "^6.24.1",
"babel-eslint": "^7.2.2",
"babel-loader": "^6.4.1",
Expand All @@ -49,6 +51,7 @@
"babel-preset-stage-0": "^6.24.1",
"chai": "^3.5.0",
"eslint": "^3.19.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-react": "^6.10.3",
"html-webpack-plugin": "^2.28.0",
"mocha": "^3.2.0",
Expand Down
3 changes: 2 additions & 1 deletion src/source.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import monitor from './monitor'

Expand Down
3 changes: 2 additions & 1 deletion src/target.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component, PropTypes } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import monitor from './monitor'

Expand Down

0 comments on commit 47b4374

Please sign in to comment.