Skip to content

Commit 095ddd8

Browse files
authored
Merge pull request #5 from Lodin/refactor/use-react-window
Rework library to use react-window
2 parents 291755a + 1f24f3e commit 095ddd8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+16879
-11166
lines changed

.babelrc

-3
This file was deleted.

.babelrc.js

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
const {BUILD_TYPE} = process.env;
2+
const isCjs = BUILD_TYPE === 'cjs';
3+
const isLib = BUILD_TYPE === 'lib';
4+
5+
module.exports = api => ({
6+
plugins: [
7+
[require('@babel/plugin-proposal-class-properties'), {loose: true}],
8+
...(isLib
9+
? []
10+
: [
11+
[
12+
require('babel-plugin-transform-async-to-promises'),
13+
{hoist: true, inlineHelpers: true},
14+
],
15+
[
16+
require('@babel/plugin-transform-runtime'),
17+
{
18+
regenerator: false,
19+
},
20+
],
21+
[require('@babel/plugin-proposal-object-rest-spread'), {loose: true}],
22+
]),
23+
],
24+
presets: [
25+
require('@babel/preset-typescript'),
26+
[require('@babel/preset-react'), {useBuiltIns: true}],
27+
...(isLib
28+
? []
29+
: [
30+
[
31+
require('@babel/preset-env'),
32+
{
33+
loose: true,
34+
modules: isCjs ? 'commonjs' : false,
35+
shippedProposals: true,
36+
targets: {
37+
browsers: ['last 2 versions', 'IE 11'],
38+
},
39+
useBuiltIns: false,
40+
},
41+
],
42+
]),
43+
],
44+
...(api.env('test') && {
45+
presets: [
46+
require('@babel/preset-typescript'),
47+
[require('@babel/preset-react'), {useBuiltIns: true}],
48+
[
49+
require('@babel/preset-env'),
50+
{
51+
modules: 'commonjs',
52+
targets: {
53+
node: process.versions.node,
54+
},
55+
},
56+
],
57+
],
58+
}),
59+
});

.eslintignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**/node_modules/**/*
2+
**/dist/**/*
3+
*.ts
4+
*.tsx

.eslintrc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": ["eslint-config-poetez", "plugin:prettier/recommended"],
3+
"env": {
4+
"node": true
5+
},
6+
"rules": {
7+
"global-require": "off"
8+
}
9+
}

.lintstagedrc

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
{
2-
"linters": {
3-
".storybook/**/*.js": ["npm run lint:storybook -- --fix", "git add"],
4-
"__stories__/**/*.+(ts|tsx)": ["npm run lint:src -- --fix", "node ./scripts/typecheck.js", "git add"],
5-
"__tests__/**/*.+(ts|tsx)": ["npm run lint:src -- --fix", "node ./scripts/typecheck.js", "git add"],
6-
"config/**/*.js": ["npm run lint:config -- --fix", "git add"],
7-
"scripts/**/*.js": ["npm run lint:scripts -- --fix", "git add"],
8-
"src/**/*.+(ts|tsx)": ["npm run lint:src -- --fix", "node ./scripts/typecheck.js", "git add"],
9-
}
2+
"*.js": ["prettier --write", "eslint --fix", "git add"],
3+
"*.+(ts|tsx)": ["prettier --write", "tslint -c tslint.json -p tsconfig.json -t verbose --fix", "git add"]
104
}

.prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"bracketSpacing": false,
3+
"printWidth": 80,
4+
"trailingComma": "all",
5+
"tabWidth": 2,
6+
"singleQuote": true
7+
}

.storybook/.eslintrc.json

-24
This file was deleted.

.storybook/config.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
const {configure} = require('@storybook/react');
22
const {setOptions} = require('@storybook/addon-options');
33

4-
function loadStories() {
5-
// eslint-disable-next-line import/no-unresolved
6-
require('../__stories__/Tree');
7-
}
4+
const loadStories = () => {
5+
require('../__stories__');
6+
};
87

98
setOptions({
109
downPanelInRight: true,

.storybook/helpers.js

-21
This file was deleted.

.storybook/webpack.config.js

+6-109
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,12 @@
1+
/* eslint-disable sort-keys */
12

2-
// you can use this file to add your custom webpack plugins, loaders and anything you like.
3-
// This is just the basic way to add additional webpack configurations.
4-
// For more information refer the docs: https://storybook.js.org/configurations/custom-webpack-config
5-
6-
// IMPORTANT
7-
// When you add this file, we won't add the default configurations which is similar
8-
// to "React Create App". This only has babel loader to load JavaScript.
9-
10-
const path = require('path');
11-
const genDefaultConfig = require('@storybook/react/dist/server/config/defaults/webpack.config.js');
12-
const {getLocalIdent} = require('./helpers');
13-
const paths = require('../config/paths');
14-
const postcssConfig = require('../config/postcss.config');
15-
const babelConfig = require('../config/babel.config');
16-
17-
module.exports = (baseConfig, env) => {
18-
const config = genDefaultConfig(baseConfig, env);
3+
module.exports = ({config}) => {
194
config.devtool = 'eval';
205

21-
config.module.rules = [
22-
{
23-
test: /\.js$/,
24-
loader: require.resolve('source-map-loader'),
25-
enforce: 'pre',
26-
include: paths.src,
27-
},
28-
{
29-
// "oneOf" will traverse all following loaders until one will
30-
// match the requirements. When no loader matches it will fall
31-
// back to the "file" loader at the end of the loader list.
32-
oneOf: [
33-
{
34-
test: /\.md$/,
35-
loader: 'raw-loader',
36-
},
37-
// "url" loader works like "file" loader except that it embeds assets
38-
// smaller than specified limit in bytes as data URLs to avoid requests.
39-
// A missing `test` is equivalent to a match.
40-
{
41-
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
42-
loader: require.resolve('url-loader'),
43-
options: {
44-
limit: 10000,
45-
name: 'static/media/[name].[hash:8].[ext]',
46-
},
47-
},
48-
// Compile .tsx?
49-
{
50-
test: /\.(ts|tsx)$/,
51-
include: [paths.src, paths.stories],
52-
loader: require.resolve('babel-loader'),
53-
options: {
54-
babelrc: false,
55-
cacheDirectory: path.resolve(process.cwd(), '.cache'),
56-
...babelConfig,
57-
},
58-
},
59-
// "postcss" loader applies autoprefixer to our CSS.
60-
// "css" loader resolves paths in CSS and adds assets as dependencies.
61-
// "style" loader turns CSS into JS modules that inject <style> tags.
62-
// In production, we use a plugin to extract that CSS to a file, but
63-
// in development "style" loader enables hot editing of CSS.
64-
{
65-
test: /\.css$/,
66-
use: [
67-
require.resolve('style-loader'),
68-
{
69-
loader: require.resolve('css-loader'),
70-
options: {
71-
importLoaders: 1,
72-
modules: true,
73-
camelCase: true,
74-
localIdentName: '[name]__[local]',
75-
getLocalIdent,
76-
},
77-
},
78-
{
79-
loader: require.resolve('postcss-loader'),
80-
options: {
81-
// Necessary for external CSS imports to work
82-
// https://github.com/facebookincubator/create-react-app/issues/2677
83-
ident: 'postcss',
84-
plugins: postcssConfig,
85-
},
86-
},
87-
],
88-
},
89-
{
90-
91-
},
92-
// "file" loader makes sure those assets get served by WebpackDevServer.
93-
// When you `import` an asset, you get its (virtual) filename.
94-
// In production, they would get copied to the `build` folder.
95-
// This loader don't uses a "test" so it will catch all modules
96-
// that fall through the other loaders.
97-
{
98-
// Exclude `js` files to keep "css" loader working as it injects
99-
// it's runtime that would otherwise processed through "file" loader.
100-
// Also exclude `html` and `json` extensions so they get processed
101-
// by webpacks internal loaders.
102-
exclude: [/\.js$/, /\.html$/, /\.json$/],
103-
loader: require.resolve('file-loader'),
104-
options: {
105-
name: 'static/media/[name].[hash:8].[ext]',
106-
},
107-
},
108-
],
109-
},
110-
// ** STOP ** Are you adding a new loader?
111-
// Make sure to add the new loader(s) before the "file" loader.
112-
];
6+
config.module.rules.push({
7+
test: /\.(ts|tsx)$/,
8+
loader: require.resolve('babel-loader'),
9+
});
11310

11411
config.resolve.extensions.push('.ts', '.tsx');
11512

.travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
language: node_js
22
dist: trusty
33
node_js:
4-
- '8'
5-
- '6'
4+
- '10'
65
cache:
76
directories:
87
- $HOME/.npm

0 commit comments

Comments
 (0)