Skip to content

Commit 08c1dcb

Browse files
author
Nikita K
authored
Merge pull request #1 from kakuevn/setup
Setup
2 parents 1acd7f7 + 3884826 commit 08c1dcb

File tree

8 files changed

+1625
-6400
lines changed

8 files changed

+1625
-6400
lines changed

.eslintrc.json

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,14 @@
11
{
2-
"extends": [
3-
"eslint:recommended",
4-
"plugin:react/recommended",
5-
"plugin:@typescript-eslint/recommended",
6-
"prettier/@typescript-eslint",
7-
"plugin:prettier/recommended"
8-
],
9-
"plugins": ["react", "@typescript-eslint", "prettier"],
10-
"env": {
11-
"browser": true,
12-
"jasmine": true,
13-
"jest": true
14-
},
15-
"rules": {
16-
"linebreak-style": 0,
17-
"no-unused-vars": [ "warn", { "vars": "all", "args": "all", "ignoreRestSiblings": false } ],
18-
"react/jsx-filename-extension": [ 0, { "extensions": [ ".js", ".jsx" ] } ],
19-
"no-console": 1,
20-
"prettier/prettier": 0,
21-
"no-func-assign": 0
22-
},
23-
"settings": {
24-
"react": {
25-
"pragma": "React",
26-
"version": "detect"
27-
}
28-
},
29-
"parser": "@typescript-eslint/parser"
30-
}
2+
"parser": "@typescript-eslint/parser",
3+
"parserOptions": {
4+
"jsx": true,
5+
"useJSXTextNode": true
6+
},
7+
"extends": [ "plugin:@typescript-eslint/recommended", "prettier", "prettier/@typescript-eslint" ],
8+
"plugins": [ "@typescript-eslint" ],
9+
"rules": {
10+
"@typescript-eslint/explicit-function-return-type": "off",
11+
"react-hooks/rules-of-hooks": "error",
12+
"react-hooks/exhaustive-deps": "warn"
13+
}
14+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ typings/
4343

4444
# Optional npm cache directory
4545
.npm
46+
.vs
4647

4748
# Optional eslint cache
4849
.eslintcache

package.json

Lines changed: 29 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,69 +5,53 @@
55
"author": "kakuevn <n.kakuev@gmail.com>",
66
"license": "MIT",
77
"scripts": {
8-
"dev": "rollup -c --watch",
9-
"build": "rollup -c",
10-
"lint:fix": "eslint './src/**/*.{ts,tsx}'",
8+
"dev": "webpack --colors --progress --watch",
9+
"build": "webpack --colors --progress -p",
10+
"eslint": "eslint './src/**/*.{ts,tsx}'",
11+
"eslint:fix": "eslint src --fix",
1112
"start": "npm-run-all --parallel dev test:watch",
1213
"test": "jest",
13-
"test:watch": "jest --watch",
14-
"storybook": "start-storybook -p 6006",
15-
"build-storybook": "build-storybook"
14+
"test:watch": "jest --watch"
1615
},
1716
"jest": {
1817
"testURL": "http://localhost/",
1918
"moduleDirectories": [
2019
"node_modules",
21-
"bower_components",
2220
"shared"
2321
],
2422
"transformIgnorePatterns": [
2523
"/node_modules/(?!(our-react-components-.*?\\.js$))"
2624
],
2725
"moduleNameMapper": {
2826
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js"
27+
},
28+
"transform": {
29+
"^.+\\.(js|jsx)$": "babel-jest"
2930
}
3031
},
3132
"dependencies": {
32-
"react": "^16.5.0",
33-
"react-dom": "^16.5.0",
34-
"styled-components": "^3.4.9"
33+
"@types/react": "^16.8.14",
34+
"@types/react-dom": "^16.8.4",
35+
"react": "^16.8.6",
36+
"react-dom": "^16.8.6",
37+
"webpack": "^4.30.0"
3538
},
3639
"devDependencies": {
37-
"@babel/cli": "^7.0.0",
38-
"@babel/core": "^7.0.0",
39-
"@babel/plugin-transform-modules-commonjs": "^7.1.0",
40-
"@babel/preset-env": "^7.0.0",
41-
"@babel/preset-react": "^7.0.0",
42-
"@storybook/addon-actions": "^3.4.11",
43-
"@storybook/addon-links": "^3.4.11",
44-
"@storybook/addons": "^3.4.11",
45-
"@storybook/react": "^3.4.11",
46-
"@types/react": "^16.8.13",
47-
"@types/react-dom": "^16.8.4",
48-
"@typescript-eslint/eslint-plugin": "^1.6.0",
49-
"@typescript-eslint/parser": "^1.6.0",
50-
"babel-cli": "^6.26.0",
51-
"babel-core": "^6.26.3",
52-
"babel-eslint": "^10.0.1",
53-
"babel-runtime": "^6.26.0",
54-
"enzyme": "^3.3.0",
55-
"eslint": "^4.17.0",
56-
"eslint-config-prettier": "^4.1.0",
57-
"eslint-config-react": "^1.1.7",
58-
"eslint-friendly-formatter": "^4.0.1",
59-
"eslint-plugin-jsx-a11y": "^6.0.3",
60-
"eslint-plugin-prettier": "^2.6.0",
61-
"eslint-plugin-react": "^7.7.0",
62-
"jest": "^23.6.0",
63-
"npm-run-all": "^4.1.2",
64-
"prettier": "^1.10.2",
65-
"rollup-plugin-eslint": "^5.0.0",
66-
"rollup-plugin-node-resolve": "^3.4.0",
67-
"rollup-plugin-replace": "^2.1.0",
68-
"rollup-plugin-typescript2": "^0.20.1",
69-
"rollup-watch": "^4.3.1",
70-
"sinon": "^4.2.2",
71-
"typescript": "^3.4.3"
40+
"@typescript-eslint/eslint-plugin": "^1.7.0",
41+
"@typescript-eslint/parser": "^1.7.0",
42+
"awesome-typescript-loader": "^5.2.1",
43+
"babel-jest": "^24.7.1",
44+
"eslint": "^5.16.0",
45+
"eslint-config-prettier": "^4.2.0",
46+
"eslint-formatter-friendly": "^6.0.0",
47+
"eslint-loader": "^2.1.2",
48+
"eslint-plugin-react-hooks": "^1.6.0",
49+
"file-loader": "^3.0.1",
50+
"npm-run-all": "^4.1.5",
51+
"prettier": "^1.17.0",
52+
"source-map-loader": "^0.2.4",
53+
"typescript": "^3.4.5",
54+
"uglifyjs-webpack-plugin": "^2.1.2",
55+
"webpack-cli": "^3.3.1"
7256
}
7357
}

rollup.config.js

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

stories/index.stories.js

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

tsconfig.json

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
{
2-
"compileOnSave": true,
3-
"allowSyntheticDefaultImports": true,
42
"compilerOptions": {
5-
"target": "esnext",
6-
"moduleResolution": "node",
7-
"outDir": "dist",
8-
"declaration": true,
9-
"jsx": "react",
10-
"module": "es2015",
11-
"strict": true
3+
"outDir": "./dist/",
4+
"sourceMap": true,
5+
"noImplicitAny": true,
6+
"module": "commonjs",
7+
"target": "es6",
8+
"jsx": "react"
129
},
1310
"include": [
14-
"src/**/*"
15-
],
16-
"exclude": [
17-
"node_modules",
18-
"**/*.spec.ts"
11+
"./src/**/*"
1912
]
2013
}

webpack.config.js

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
const path = require('path');
2+
const webpack = require('webpack');
3+
const lintFormatter = require('eslint-formatter-friendly');
4+
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
5+
6+
module.exports = {
7+
entry: './src/index.tsx',
8+
output: {
9+
filename: 'index.js',
10+
path: path.resolve(__dirname, 'dist'),
11+
publicPath: '/dist',
12+
library: '',
13+
libraryTarget: 'commonjs2'
14+
},
15+
16+
devtool: 'source-map',
17+
18+
stats: 'errors-only',
19+
20+
node: {
21+
fs: 'empty'
22+
},
23+
24+
resolve: {
25+
modules: [ path.resolve(__dirname, './src'), 'node_modules' ],
26+
extensions: [ '.ts', '.tsx', '.js', '.json' ]
27+
},
28+
29+
module: {
30+
rules: [
31+
{
32+
enforce: 'pre',
33+
test: /\.tsx?$/,
34+
loader: 'eslint-loader',
35+
exclude: /node_modules/,
36+
options: {
37+
configFile: './.eslintrc.json',
38+
formatter: lintFormatter,
39+
failOnWarning: false,
40+
failOnError: false
41+
}
42+
},
43+
{
44+
test: /\.(eot|svg|ttf|woff|woff2)$/,
45+
loader: 'file-loader?name=app/fonts/[name].[ext]'
46+
},
47+
{
48+
test: /\.(png|jpg|gif)$/,
49+
use: [
50+
{
51+
loader: 'file-loader',
52+
options: {}
53+
}
54+
]
55+
},
56+
{ test: /\.tsx?$/, loader: 'awesome-typescript-loader' },
57+
{ enforce: 'pre', test: /\.js$/, loader: 'source-map-loader' }
58+
]
59+
},
60+
plugins: [ new webpack.HotModuleReplacementPlugin(), new webpack.NamedModulesPlugin(), new UglifyJsPlugin() ],
61+
62+
externals: {
63+
react: {
64+
commonjs: 'react',
65+
commonjs2: 'react',
66+
amd: 'React',
67+
root: 'React'
68+
},
69+
'react-dom': {
70+
commonjs: 'react-dom',
71+
commonjs2: 'react-dom',
72+
amd: 'ReactDOM',
73+
root: 'ReactDOM'
74+
},
75+
'styled-components': {
76+
commonjs: 'styled-components',
77+
commonjs2: 'styled-components'
78+
}
79+
}
80+
};

0 commit comments

Comments
 (0)