Skip to content

Commit b9ae6b0

Browse files
committed
update infrastructure
1 parent 4df158d commit b9ae6b0

File tree

8 files changed

+4787
-15236
lines changed

8 files changed

+4787
-15236
lines changed

.eslintrc.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
module.exports = {
2+
extends: ['plugin:@typescript-eslint/recommended', 'plugin:import/typescript', 'plugin:react-hooks/recommended'],
3+
parser: '@typescript-eslint/parser',
4+
plugins: ['@typescript-eslint', 'prettier', 'import'],
5+
rules: {
6+
'@typescript-eslint/ban-ts-comment': 0,
7+
'@typescript-eslint/ban-ts-ignore': 0,
8+
'@typescript-eslint/no-var-requires': 0,
9+
'@typescript-eslint/camelcase': 0,
10+
'import/order': [
11+
'error',
12+
{
13+
'newlines-between': 'always-and-inside-groups',
14+
alphabetize: {
15+
order: 'asc',
16+
},
17+
groups: ['builtin', 'external', 'internal', ['parent', 'index', 'sibling']],
18+
},
19+
],
20+
'padding-line-between-statements': [
21+
'error',
22+
// IMPORT
23+
{
24+
blankLine: 'always',
25+
prev: 'import',
26+
next: '*',
27+
},
28+
{
29+
blankLine: 'any',
30+
prev: 'import',
31+
next: 'import',
32+
},
33+
// EXPORT
34+
{
35+
blankLine: 'always',
36+
prev: '*',
37+
next: 'export',
38+
},
39+
{
40+
blankLine: 'any',
41+
prev: 'export',
42+
next: 'export',
43+
},
44+
{
45+
blankLine: 'always',
46+
prev: '*',
47+
next: ['const', 'let'],
48+
},
49+
{
50+
blankLine: 'any',
51+
prev: ['const', 'let'],
52+
next: ['const', 'let'],
53+
},
54+
// BLOCKS
55+
{
56+
blankLine: 'always',
57+
prev: ['block', 'block-like', 'class', 'function', 'multiline-expression'],
58+
next: '*',
59+
},
60+
{
61+
blankLine: 'always',
62+
prev: '*',
63+
next: ['block', 'block-like', 'class', 'function', 'return', 'multiline-expression'],
64+
},
65+
],
66+
},
67+
settings: {
68+
'import/parsers': {
69+
'@typescript-eslint/parser': ['.ts', '.tsx'],
70+
},
71+
'import/resolver': {
72+
typescript: {
73+
alwaysTryTypes: true,
74+
},
75+
},
76+
},
77+
};

.size-limit.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = [
2+
{
3+
path: 'dist/es2015/index.js',
4+
limit: '0.4 KB',
5+
},
6+
{
7+
path: 'dist/es2015/useRef.js',
8+
limit: '0.2 KB',
9+
},
10+
{
11+
path: 'dist/es2015/useMergeRef.js',
12+
limit: '0.2 KB',
13+
},
14+
];

custom-typings/.gitkeep

Whitespace-only changes.

custom-typings/atlaskit.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

jest.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
};

package.json

Lines changed: 47 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,48 @@
33
"version": "1.2.5",
44
"description": "The same useRef, but with callback",
55
"main": "dist/es5/index.js",
6+
"jsnext:main": "dist/es2015/index.js",
7+
"module": "dist/es2015/index.js",
8+
"types": "dist/es5/index.d.ts",
9+
"module:es2019": "dist/es2019/index.js",
610
"sideEffects": false,
711
"scripts": {
8-
"test": "ts-react-toolbox test",
9-
"bootstrap": "ts-react-toolbox init",
10-
"dev": "ts-react-toolbox dev",
11-
"test:ci": "ts-react-toolbox test --runInBand --coverage",
12-
"build": "ts-react-toolbox build",
13-
"prepublish": "yarn build",
14-
"release": "ts-react-toolbox release",
15-
"lint": "ts-react-toolbox lint",
16-
"static": "ts-react-toolbox publish",
17-
"format": "ts-react-toolbox format",
18-
"analyze": "ts-react-toolbox analyze"
12+
"dev": "lib-builder dev",
13+
"test": "jest",
14+
"test:ci": "jest --runInBand --coverage",
15+
"build": "lib-builder build && yarn size:report",
16+
"release": "yarn build && yarn test",
17+
"size": "npx size-limit",
18+
"size:report": "npx size-limit --json > .size.json",
19+
"lint": "lib-builder lint",
20+
"format": "lib-builder format",
21+
"update": "lib-builder update",
22+
"prepublish": "yarn build && yarn changelog",
23+
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
24+
"changelog:rewrite": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
1925
},
2026
"repository": "https://github.com/theKashey/use-callback-ref/",
2127
"author": "theKashey <thekashey@gmail.com>",
2228
"license": "MIT",
23-
"dependencies": {},
29+
"dependencies": {
30+
"tslib": "^2.0.0"
31+
},
2432
"devDependencies": {
25-
"ts-react-toolbox": "^0.2.11"
33+
"@theuiteam/lib-builder": "^0.1.4",
34+
"@size-limit/preset-small-lib": "^2.1.6"
2635
},
2736
"peerDependencies": {
28-
"react": "^16.8.0 || ^17.0.0",
29-
"@types/react": "^16.8.0 || ^17.0.0"
37+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
38+
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0"
3039
},
3140
"peerDependenciesMeta": {
3241
"@types/react": {
3342
"optional": true
3443
}
3544
},
3645
"engines": {
37-
"node": ">=8.5.0"
46+
"node": ">=10"
3847
},
39-
"jsnext:main": "dist/es2015/index.js",
40-
"module": "dist/es2015/index.js",
41-
"types": "dist/es5/index.d.ts",
4248
"files": [
4349
"dist"
4450
],
@@ -48,18 +54,27 @@
4854
"useRef",
4955
"createRef"
5056
],
51-
"size-limit": [
52-
{
53-
"path": "dist/es2015/index.js",
54-
"limit": "0.4 KB"
55-
},
56-
{
57-
"path": "dist/es2015/useRef.js",
58-
"limit": "0.2 KB"
59-
},
60-
{
61-
"path": "dist/es2015/useMergeRef.js",
62-
"limit": "0.2 KB"
57+
"husky": {
58+
"hooks": {
59+
"pre-commit": "lint-staged"
6360
}
64-
]
61+
},
62+
"lint-staged": {
63+
"*.{ts,tsx}": [
64+
"prettier --write",
65+
"eslint --fix",
66+
"git add"
67+
],
68+
"*.{js,css,json,md}": [
69+
"prettier --write",
70+
"git add"
71+
]
72+
},
73+
"prettier": {
74+
"printWidth": 120,
75+
"trailingComma": "es5",
76+
"tabWidth": 2,
77+
"semi": true,
78+
"singleQuote": true
79+
}
6580
}

0 commit comments

Comments
 (0)