Skip to content

Commit

Permalink
🔧 Add typescript and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreCapo committed Oct 6, 2018
1 parent 9eb78fe commit a2f2497
Show file tree
Hide file tree
Showing 8 changed files with 2,790 additions and 1,566 deletions.
4 changes: 3 additions & 1 deletion .babelrc
@@ -1,3 +1,5 @@
{
"presets": ["env"]
"presets": ["env",
"@babel/typescript"
]
}
6 changes: 6 additions & 0 deletions .prettierrc
@@ -0,0 +1,6 @@
{
"semi": true,
"singlequote": true,
"trailingComma": "es5",
"tabWidth": 2
}
30 changes: 18 additions & 12 deletions package.json
Expand Up @@ -3,27 +3,33 @@
"version": "1.0.1",
"description": "",
"repository": {
"type": "git",
"url": "git://github.com/PierreCapo/treeviz.git"
},
"type": "git",
"url": "git://github.com/PierreCapo/treeviz.git"
},
"main": "dist/index.js",
"scripts": {
"build": "webpack --mode=production",
"dev": "webpack-dev-server --mode=development",
"test": "jest"
"test": "jest",
"lint": "tslint src/*.ts"
},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.7.0",
"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0",
"@babel/preset-typescript": "^7.1.0",
"awesome-typescript-loader": "^5.2.1",
"babel-loader": "^8.0.4",
"html-webpack-plugin": "^3.2.0",
"jest": "^23.1.0",
"webpack": "^4.12.0",
"webpack-cli": "^3.0.3",
"webpack-dev-server": "^3.1.4"
"jest": "^23.6.0",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0",
"typescript": "^3.1.1",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.9"
},
"dependencies": {
"d3": "^5.4.0"
"d3": "^5.7.0"
},
"jest": {
"transform": {
Expand Down
29 changes: 0 additions & 29 deletions src/LICENSE

This file was deleted.

52 changes: 52 additions & 0 deletions tsconfig.json
@@ -0,0 +1,52 @@
{
"compilerOptions": {
/* Build Options */
"target": "es6",
"lib": ["es2017", "esnext.asynciterable", "dom"],
"noEmit": true,
"pretty": true,
"sourceMap": true,

/* Strict Type-Checking Options */
"alwaysStrict": true,
/* Parse in strict mode and emit "use strict" for each source file. */
"noImplicitAny": true,
/* Raise error on expressions and declarations with an implied 'any' type. */
"noImplicitThis": true,
/* Raise error on 'this' expressions with an implied 'any' type. */
"strict": true,
/* Enable all strict type-checking options. */
"strictFunctionTypes": true,
/* Enable strict checking of function types. */
"strictNullChecks": true,
/* Enable strict null checks. */
"strictPropertyInitialization": true,
/* Enable strict checking of property initialization in classes. */

/* Additional Checks */
"noFallthroughCasesInSwitch": true,
/* Report errors for fallthrough cases in switch statement. */
"noImplicitReturns": true,
/* Report error when not all code paths in function return a value. */
"noUnusedLocals": true,
/* Report errors on unused locals. */
"noUnusedParameters": true,
/* Report errors on unused parameters. */

/* Module Resolution Options */
"moduleResolution": "node",
/* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
"allowSyntheticDefaultImports": true,
/* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */

"baseUrl": "./",
"paths": {}
},
"exclude": [
"node_modules",
"src/**/*.test.ts",
"src/**/*.test.tsx",
"**/__mocks__/*.ts",
"**/__mocks__/*.tsx"
]
}
17 changes: 17 additions & 0 deletions tslint.json
@@ -0,0 +1,17 @@
{
"extends": ["tslint:recommended", "tslint-config-prettier"],
"rules": {
"no-default-export": true,
"no-empty-interface": true,
"object-literal-sort-keys": false,
"no-console": true,
"no-debugger": true,
"no-eval": true,
"triple-equals": true,
"no-inferrable-types": true,
"curly": [true, "ignore-same-line"],
"max-classes-per-file": [true, 1],
"max-file-line-count": [true, 200],
"typedef": [true, "call-signature", "property-declaration"]
}
}
58 changes: 33 additions & 25 deletions webpack.config.js
@@ -1,29 +1,37 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
publicPath: '/',
library: "Treeviz",
libraryTarget: "umd"
},
devServer: {
open: true, // open the browser automatically
historyApiFallback: true, // can use any URL and refresh the browser manually
contentBase: './dist',
},
plugins: [
new HtmlWebpackPlugin({
template: './public/index.html',
})
],
node: {
net: 'empty',
tls: 'empty',
dns: 'empty'
}
entry: "./src/index.js",
output: {
path: path.resolve(__dirname, "dist"),
filename: "index.js",
publicPath: "/",
library: "Treeviz",
libraryTarget: "umd",
},
devServer: {
open: true, // open the browser automatically
historyApiFallback: true, // can use any URL and refresh the browser manually
contentBase: "./dist",
},
plugins: [
new HtmlWebpackPlugin({
template: "./public/index.html",
}),
],
module: {
rules: [
{
test: /\.ts$/,
loader: "awesome-typescript-loader",
},
],
},

node: {
net: "empty",
tls: "empty",
dns: "empty",
},
};

0 comments on commit a2f2497

Please sign in to comment.