Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/typescript defs #1481

Merged
merged 4 commits into from
Feb 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .eslintrc

This file was deleted.

39 changes: 39 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module.exports = {
settings: {
react: {
version: "detect"
}
},
extends: ["formidable/configurations/es6-react", "prettier"],
rules: {
"react/sort-comp": "off",
"import/no-unresolved": [2, { ignore: ["victory*"] }],
"max-statements": 0,
complexity: ["error", { max: 16 }],
"no-magic-numbers": ["error", { ignore: [-1, 0, 0.5, 1, 2, 90, 180, 270, 360] }]
},
overrides: [
{
files: ["*.ts", "*.tsx"],
extends: [
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: __dirname
},
plugins: ["@typescript-eslint"],
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"no-magic-numbers": "off",
"import/no-duplicates": "off",
"react/no-multi-comp": "off",
"react/sort-comp": "off"
}
}
]
};
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ lerna-debug.log*
yarn-error.log*
.cache
lerna.json
tsconfig.json
3 changes: 3 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ The MIT License (MIT)

Copyright (c) 2015 Formidable Labs

Copyrights are respective of each contributor listed at the beginning of each
typescript definition file.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
Expand Down
61 changes: 61 additions & 0 deletions config/webpack/demo/webpack.config.dev-ts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"use strict";

var path = require("path");
var glob = require("glob");
var LodashModuleReplacementPlugin = require("lodash-webpack-plugin");

var ROOT = process.cwd();
var PACKAGES = glob.sync("packages/*/src", { root: ROOT });
var FILES = PACKAGES.map(function(p) {
return path.join(ROOT, p);
});
var DEMO = path.resolve("demo");
var WDS_PORT = 3000;

module.exports = {
mode: "development",
resolve: {
alias: {
"@packages": path.resolve("packages")
},
extensions: [".ts", ".tsx", ".js", ".json"]
},
entry: "./demo/ts/app.tsx",
devServer: {
port: WDS_PORT,
contentBase: "./demo/ts",
noInfo: false
},
output: {
path: path.resolve("demo"),
pathinfo: true,
filename: "main.js",
publicPath: "/assets/"
},
module: {
rules: [
{
test: /\.(ts|tsx)$/,
include: [`${DEMO}/ts`],
loader: "ts-loader"
},
{
// Transform source
test: /\.js$/,
// Use include specifically of our sources.
// Do _not_ use an `exclude` here.
include: FILES,
loader: "babel-loader"
}
]
},
plugins: [
new LodashModuleReplacementPlugin({
shorthands: true,
currying: true,
flattening: true,
paths: true,
placeholders: true
})
]
};
15 changes: 11 additions & 4 deletions config/webpack/demo/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,21 @@ var DEMO = path.resolve("demo");
var WDS_PORT = 3000;

module.exports = {
mode: "development",
resolve: {
alias: {
Packages: path.resolve("packages")
}
},

devServer: {
port: WDS_PORT,
contentBase: "./demo",
contentBase: "./demo/js",
noInfo: false
},

output: {
path: "./demo",
path: DEMO,
pathinfo: true,
filename: "main.js",
publicPath: "/assets/"
Expand All @@ -29,7 +36,7 @@ module.exports = {
cache: true,
devtool: "source-map",
entry: {
app: ["./demo/app"]
app: ["./demo/js/app"]
},
stats: {
colors: true,
Expand All @@ -42,7 +49,7 @@ module.exports = {
test: /\.js$/,
// Use include specifically of our sources.
// Do _not_ use an `exclude` here.
include: FILES.concat([DEMO]),
include: FILES.concat([`${DEMO}/js`]),
loader: "babel-loader"
}
]
Expand Down
2 changes: 2 additions & 0 deletions config/webpack/webpack.config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ var PACKAGES = glob.sync("packages/*/src", { root: ROOT });
var FILES = PACKAGES.map(function(p) {
return path.join(ROOT, p);
});

module.exports = {
mode: "development",
cache: true,
context: path.join(ROOT, "test/client"),
entry: "./main",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
/*eslint-disable no-magic-numbers */
import React from "react";
import { random, range } from "lodash";
import { VictoryBar } from "../../packages/victory-bar/src/index";
import { VictoryChart } from "../../packages/victory-chart/src/index";
import { VictoryStack } from "../../packages/victory-stack/src/index";
import { VictoryArea } from "../../packages/victory-area/src/index";
import { VictoryTheme } from "../../packages/victory-core/src/index";
import { VictoryBar } from "Packages/victory-bar/src/index";
import { VictoryChart } from "Packages/victory-chart/src/index";
import { VictoryStack } from "Packages/victory-stack/src/index";
import { VictoryArea } from "Packages/victory-area/src/index";
import { VictoryTheme } from "Packages/victory-core/src/index";

export default class App extends React.Component {
constructor() {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
import React from "react";
import PropTypes from "prop-types";
import { round } from "lodash";
import { VictoryChart } from "../../packages/victory-chart/src/index";
import { VictoryStack } from "../../packages/victory-stack/src/index";
import { VictoryGroup } from "../../packages/victory-group/src/index";
import { createContainer } from "../../packages/victory-create-container/src/index";
import { VictoryBar } from "../../packages/victory-bar/src/index";
import { VictoryLine } from "../../packages/victory-line/src/index";
import { VictoryScatter } from "../../packages/victory-scatter/src/index";
import { VictoryTooltip } from "../../packages/victory-tooltip/src/index";
import { VictoryLegend } from "../../packages/victory-legend/src/index";
import { VictoryChart } from "Packages/victory-chart/src/index";
import { VictoryStack } from "Packages/victory-stack/src/index";
import { VictoryGroup } from "Packages/victory-group/src/index";
import { createContainer } from "Packages/victory-create-container/src/index";
import { VictoryBar } from "Packages/victory-bar/src/index";
import { VictoryLine } from "Packages/victory-line/src/index";
import { VictoryScatter } from "Packages/victory-scatter/src/index";
import { VictoryTooltip } from "Packages/victory-tooltip/src/index";
import { VictoryLegend } from "Packages/victory-legend/src/index";

const Charts = ({ behaviors }) => {
// eslint-disable-line react/prop-types
Expand Down
20 changes: 10 additions & 10 deletions demo/components/debug-demo.js → demo/js/components/debug-demo.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/*eslint-disable no-magic-numbers */

import React from "react";
import { VictoryChart } from "../../packages/victory-chart/src/index";
import { VictoryStack } from "../../packages/victory-stack/src/index";
import { VictoryGroup } from "../../packages/victory-group/src/index";
import { VictoryBar } from "../../packages/victory-bar/src/index";
import { VictoryArea } from "../../packages/victory-area/src/index";
import { VictoryScatter } from "../../packages/victory-scatter/src/index";
import { VictoryPortal } from "../../packages/victory-core/src/index";
import { VictorySelectionContainer } from "../../packages/victory-selection-container/src/index";
import { VictoryVoronoiContainer } from "../../packages/victory-voronoi-container/src/index";
import { VictoryZoomContainer } from "../../packages/victory-zoom-container/src/index";
import { VictoryChart } from "Packages/victory-chart/src/index";
import { VictoryStack } from "Packages/victory-stack/src/index";
import { VictoryGroup } from "Packages/victory-group/src/index";
import { VictoryBar } from "Packages/victory-bar/src/index";
import { VictoryArea } from "Packages/victory-area/src/index";
import { VictoryScatter } from "Packages/victory-scatter/src/index";
import { VictoryPortal } from "Packages/victory-core/src/index";
import { VictorySelectionContainer } from "Packages/victory-selection-container/src/index";
import { VictoryVoronoiContainer } from "Packages/victory-voronoi-container/src/index";
import { VictoryZoomContainer } from "Packages/victory-zoom-container/src/index";

class App extends React.Component {
render() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*eslint-disable no-magic-numbers,react/no-multi-comp */

import React from "react";
import { VictoryChart } from "../../packages/victory-chart/src/index";
import { VictoryAxis } from "../../packages/victory-axis/src/index";
import { VictoryBar } from "../../packages/victory-bar/src/index";
import { VictoryBrushLine } from "../../packages/victory-brush-line/src/index";
import { VictoryScatter } from "../../packages/victory-scatter/src/index";
import { VictoryClipContainer, Point, Selection } from "../../packages/victory-core/src/index";
import { VictoryZoomContainer } from "../../packages/victory-zoom-container/src/index";
import { VictoryBrushContainer } from "../../packages/victory-brush-container/src/index";
import { VictoryChart } from "Packages/victory-chart/src/index";
import { VictoryAxis } from "Packages/victory-axis/src/index";
import { VictoryBar } from "Packages/victory-bar/src/index";
import { VictoryBrushLine } from "Packages/victory-brush-line/src/index";
import { VictoryScatter } from "Packages/victory-scatter/src/index";
import { VictoryClipContainer, Point, Selection } from "Packages/victory-core/src/index";
import { VictoryZoomContainer } from "Packages/victory-zoom-container/src/index";
import { VictoryBrushContainer } from "Packages/victory-brush-container/src/index";

const bars = [
{ name: "SEA", range: [new Date(2013, 1, 1), new Date(2019, 1, 1)] },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*eslint-disable no-magic-numbers */
import React from "react";
import { VictoryChart } from "../../packages/victory-chart/src/index";
import { VictoryStack } from "../../packages/victory-stack/src/index";
import { VictoryArea } from "../../packages/victory-area/src/index";
import { VictoryBar } from "../../packages/victory-bar/src/index";
import { VictoryLine } from "../../packages/victory-line/src/index";
import { VictoryTheme, VictoryLabel } from "../../packages/victory-core/src/index";
import { VictoryChart } from "Packages/victory-chart/src/index";
import { VictoryStack } from "Packages/victory-stack/src/index";
import { VictoryArea } from "Packages/victory-area/src/index";
import { VictoryBar } from "Packages/victory-bar/src/index";
import { VictoryLine } from "Packages/victory-line/src/index";
import { VictoryTheme, VictoryLabel } from "Packages/victory-core/src/index";
import { merge } from "lodash";

class App extends React.Component {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
/*global window:false*/

import React from "react";
import { VictoryChart } from "../../packages/victory-chart/src/index";
import { VictoryStack } from "../../packages/victory-stack/src/index";
import { VictoryArea } from "../../packages/victory-area/src/index";
import { VictoryBar } from "../../packages/victory-bar/src/index";
import { VictoryLine } from "../../packages/victory-line/src/index";
import { VictoryZoomContainer } from "../../packages/victory-zoom-container/src/index";
import { VictoryVoronoiContainer } from "../../packages/victory-voronoi-container/src/index";
import { VictoryChart } from "Packages/victory-chart/src/index";
import { VictoryStack } from "Packages/victory-stack/src/index";
import { VictoryArea } from "Packages/victory-area/src/index";
import { VictoryBar } from "Packages/victory-bar/src/index";
import { VictoryLine } from "Packages/victory-line/src/index";
import { VictoryZoomContainer } from "Packages/victory-zoom-container/src/index";
import { VictoryVoronoiContainer } from "Packages/victory-voronoi-container/src/index";
import { range, assign } from "lodash";

class App extends React.Component {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*eslint-disable no-magic-numbers */
import React from "react";
import { VictoryChart } from "../../packages/victory-chart/src/index";
import { VictoryStack } from "../../packages/victory-stack/src/index";
import { VictoryGroup } from "../../packages/victory-group/src/index";
import { VictoryBar } from "../../packages/victory-bar/src/index";
import { VictoryLine } from "../../packages/victory-line/src/index";
import { VictoryScatter } from "../../packages/victory-scatter/src/index";
import { VictoryErrorBar } from "../../packages/victory-errorbar/src/index";
import { VictoryTooltip } from "../../packages/victory-tooltip/src/index";
import { VictoryVoronoi } from "../../packages/victory-voronoi/src/index";
import { VictoryChart } from "Packages/victory-chart/src/index";
import { VictoryStack } from "Packages/victory-stack/src/index";
import { VictoryGroup } from "Packages/victory-group/src/index";
import { VictoryBar } from "Packages/victory-bar/src/index";
import { VictoryLine } from "Packages/victory-line/src/index";
import { VictoryScatter } from "Packages/victory-scatter/src/index";
import { VictoryErrorBar } from "Packages/victory-errorbar/src/index";
import { VictoryTooltip } from "Packages/victory-tooltip/src/index";
import { VictoryVoronoi } from "Packages/victory-voronoi/src/index";
import { range, random } from "lodash";

class App extends React.Component {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*eslint-disable no-magic-numbers */

import React from "react";
import { VictoryChart } from "../../packages/victory-chart/src/index";
import { VictoryStack } from "../../packages/victory-stack/src/index";
import { VictoryGroup } from "../../packages/victory-group/src/index";
import { VictoryBar } from "../../packages/victory-bar/src/index";
import { VictoryScatter } from "../../packages/victory-scatter/src/index";
import { VictoryLine } from "../../packages/victory-line/src/index";
import { VictoryArea } from "../../packages/victory-area/src/index";
import { VictoryCandlestick } from "../../packages/victory-candlestick/src/index";
import { VictoryErrorBar } from "../../packages/victory-errorbar/src/index";
import { VictoryBoxPlot } from "../../packages/victory-box-plot/src/index";
import { VictoryAxis } from "../../packages/victory-axis/src/index";
import { VictoryBrushContainer } from "../../packages/victory-brush-container/src/index";
import { VictoryChart } from "Packages/victory-chart/src/index";
import { VictoryStack } from "Packages/victory-stack/src/index";
import { VictoryGroup } from "Packages/victory-group/src/index";
import { VictoryBar } from "Packages/victory-bar/src/index";
import { VictoryScatter } from "Packages/victory-scatter/src/index";
import { VictoryLine } from "Packages/victory-line/src/index";
import { VictoryArea } from "Packages/victory-area/src/index";
import { VictoryCandlestick } from "Packages/victory-candlestick/src/index";
import { VictoryErrorBar } from "Packages/victory-errorbar/src/index";
import { VictoryBoxPlot } from "Packages/victory-box-plot/src/index";
import { VictoryAxis } from "Packages/victory-axis/src/index";
import { VictoryBrushContainer } from "Packages/victory-brush-container/src/index";
import { range, random } from "lodash";

const errorData = [
Expand Down
Loading