Skip to content

Commit a4e8023

Browse files
committed
Clean code & bump version.
1 parent 0f22ca7 commit a4e8023

18 files changed

+1091
-12822
lines changed

.eslintrc.json

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,29 @@
33
"browser": true,
44
"shared-node-browser": true,
55
"node": true,
6-
"es6": true
6+
"es2020": true
77
},
88
"extends": [
99
"prettier",
1010
"plugin:prettier/recommended",
1111
"plugin:import/errors",
12-
"plugin:import/warnings"
12+
"plugin:import/warnings",
13+
"plugin:array-func/all",
14+
"plugin:sonarjs/recommended",
15+
"plugin:react/recommended",
16+
"plugin:react/jsx-runtime",
17+
"plugin:react-hooks/recommended",
18+
"plugin:promise/recommended"
19+
],
20+
"plugins": [
21+
"@typescript-eslint",
22+
"react",
23+
"prettier",
24+
"import",
25+
"sonarjs",
26+
"array-func",
27+
"promise"
1328
],
14-
"plugins": ["@typescript-eslint", "react", "prettier", "import", "jest"],
1529
"parser": "@typescript-eslint/parser",
1630
"parserOptions": {
1731
"ecmaVersion": 2020,
@@ -35,10 +49,6 @@
3549
"@typescript-eslint/no-empty-function": "off",
3650
"@typescript-eslint/no-empty-interface": "off",
3751
"@typescript-eslint/no-explicit-any": "off",
38-
"jest/consistent-test-it": [
39-
"error",
40-
{ "fn": "it", "withinDescribe": "it" }
41-
],
4252
"import/order": [
4353
"error",
4454
{

__mocks__/fileMock.js

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

__mocks__/react-dnd-html5-backend.js

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

__mocks__/react-dnd-scrollzone.js

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

package.json

Lines changed: 23 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nosferatu500/react-sortable-tree",
3-
"version": "4.0.0-beta.11",
3+
"version": "4.0.0-beta.12",
44
"description": "Drag-and-drop sortable component for nested data and hierarchies",
55
"main": "./index.js",
66
"types": "./index.d.ts",
@@ -18,19 +18,17 @@
1818
],
1919
"sideEffects": false,
2020
"scripts": {
21-
"prebuild": "yarn clean && yarn lint",
21+
"prebuild": "yarn clean",
2222
"build": "rollup -c",
2323
"build:storybook": "build-storybook -o build",
2424
"clean": "rimraf dist",
2525
"clean:storybook": "rimraf build",
2626
"lint": "eslint --fix '*.{js,json}' '{src,tests}/**/*.{ts,tsx}'",
27-
"prepublishOnly": "yarn test && yarn build",
27+
"prepublishOnly": "yarn build",
2828
"release": "standard-version",
29-
"test": "jest --env=jsdom",
30-
"test:watch": "jest --watchAll",
3129
"storybook": "start-storybook -p ${PORT:-3001} -h 0.0.0.0",
3230
"postbuild": "yarn copy",
33-
"copy": "rimraf dist/tests.d.ts && shx cp -r dist/*.d.ts dist/esm && shx mv dist/* dist && shx cp package.json readme.md LICENSE dist && json -I -f dist/package.json -e \"this.private=false; this.devDependencies=undefined; this.optionalDependencies=undefined; this.scripts=undefined; this.prettier=undefined; this.jest=undefined; this['lint-staged']=undefined;\"",
31+
"copy": "rimraf dist/tests.d.ts && shx cp -r dist/*.d.ts dist/esm && shx mv dist/* dist && shx cp package.json readme.md LICENSE dist && json -I -f dist/package.json -e \"this.private=false; this.devDependencies=undefined; this.optionalDependencies=undefined; this.scripts=undefined; this.prettier=undefined; this['lint-staged']=undefined;\"",
3432
"publish:alpha": "cd dist && npm publish --tag alpha",
3533
"publish:beta": "cd dist && npm publish --tag beta",
3634
"publish:release": "cd dist && npm publish"
@@ -65,122 +63,57 @@
6563
],
6664
"license": "MIT",
6765
"bugs": "https://github.com/nosferatu500/react-sortable-tree/issues",
68-
"jest": {
69-
"transform": {
70-
"^.+\\.jsx?$": "babel-jest",
71-
"^.+\\.tsx?$": "ts-jest"
72-
},
73-
"globals": {
74-
"ts-jest": {
75-
"tsconfig": {
76-
"target": "es2015",
77-
"jsx": "react-jsx"
78-
}
79-
}
80-
},
81-
"setupFilesAfterEnv": [
82-
"./node_modules/jest-enzyme/lib/index.js"
83-
],
84-
"setupFiles": [
85-
"./test-config/shim.js",
86-
"./test-config/test-setup.js"
87-
],
88-
"moduleFileExtensions": [
89-
"js",
90-
"jsx",
91-
"json",
92-
"ts",
93-
"tsx"
94-
],
95-
"moduleDirectories": [
96-
"node_modules"
97-
],
98-
"modulePathIgnorePatterns": [
99-
"dist"
100-
],
101-
"moduleNameMapper": {
102-
"\\.(css|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
103-
"^dnd-core$": "dnd-core/dist/cjs",
104-
"^react-dnd$": "react-dnd/dist/cjs",
105-
"^react-dnd-html5-backend$": "react-dnd-html5-backend/dist/cjs",
106-
"^react-dnd-touch-backend$": "react-dnd-touch-backend/dist/cjs",
107-
"^react-dnd-test-backend$": "react-dnd-test-backend/dist/cjs",
108-
"^react-dnd-test-utils$": "react-dnd-test-utils/dist/cjs"
109-
},
110-
"coverageDirectory": "./coverage/",
111-
"collectCoverage": true,
112-
"coverageReporters": [
113-
"json",
114-
"html",
115-
"text",
116-
"text-summary"
117-
],
118-
"collectCoverageFrom": [
119-
"src/**/*.{js,ts,tsx}",
120-
"tests/**/*.{js,ts,tsx}"
121-
]
122-
},
12366
"dependencies": {
12467
"@nosferatu500/react-dnd-scrollzone": "^2.0.4",
12568
"lodash.isequal": "^4.5.0",
12669
"react-dnd": "^14.0.4",
12770
"react-dnd-html5-backend": "^14.0.2",
128-
"react-virtuoso": "^2.2.4"
71+
"react-virtuoso": "^2.2.6"
12972
},
13073
"devDependencies": {
131-
"@babel/core": "^7.15.8",
132-
"@babel/eslint-parser": "^7.15.8",
133-
"@babel/helper-module-imports": "^7.15.4",
134-
"@babel/plugin-transform-react-jsx": "^7.14.9",
135-
"@babel/preset-env": "^7.15.8",
136-
"@babel/types": "^7.15.6",
74+
"@babel/core": "^7.16.0",
75+
"@babel/eslint-parser": "^7.16.0",
76+
"@babel/helper-module-imports": "^7.16.0",
77+
"@babel/plugin-transform-react-jsx": "^7.16.0",
78+
"@babel/preset-env": "^7.16.0",
79+
"@babel/types": "^7.16.0",
13780
"@nosferatu500/theme-file-explorer": "^3.0.10",
13881
"@rollup/plugin-babel": "^5.3.0",
13982
"@rollup/plugin-node-resolve": "^13.0.6",
14083
"@rollup/plugin-typescript": "^8.3.0",
141-
"@storybook/addon-storyshots": "^6.3.12",
14284
"@storybook/addons": "^6.3.12",
14385
"@storybook/react": "^6.3.12",
14486
"@storybook/theming": "^6.3.12",
145-
"@testing-library/react": "^12.1.2",
14687
"@types/babel-plugin-macros": "^2.8.5",
147-
"@types/enzyme": "^3.10.10",
148-
"@types/jest": "^27.0.2",
14988
"@types/lodash.isequal": "^4.5.5",
150-
"@types/react": "^17.0.32",
151-
"@types/react-dom": "^17.0.10",
152-
"@types/react-test-renderer": "^17.0.1",
153-
"@typescript-eslint/eslint-plugin": "^5.1.0",
154-
"@typescript-eslint/parser": "^5.1.0",
155-
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.5",
89+
"@types/react": "^17.0.34",
90+
"@types/react-dom": "^17.0.11",
91+
"@typescript-eslint/eslint-plugin": "^5.3.0",
92+
"@typescript-eslint/parser": "^5.3.0",
15693
"acorn-jsx": "^5.3.2",
15794
"babel-plugin-macros": "^3.1.0",
158-
"babel-plugin-tester": "^10.1.0",
159-
"enzyme": "^3.11.0",
160-
"esbuild": "^0.13.9",
161-
"eslint": "^8.1.0",
95+
"esbuild": "^0.13.12",
96+
"eslint": "^8.2.0",
16297
"eslint-config-prettier": "^8.3.0",
98+
"eslint-plugin-array-func": "^3.1.7",
16399
"eslint-plugin-import": "^2.25.2",
164-
"eslint-plugin-jest": "^25.2.2",
165100
"eslint-plugin-prettier": "^4.0.0",
101+
"eslint-plugin-promise": "^5.1.1",
166102
"eslint-plugin-react": "^7.26.1",
167-
"jest": "^27.3.1",
168-
"jest-enzyme": "^7.1.2",
103+
"eslint-plugin-react-hooks": "^4.2.0",
104+
"eslint-plugin-sonarjs": "^0.10.0",
169105
"json": "^11.0.0",
170-
"prop-types": "^15.7.2",
171106
"postcss": "^8.3.11",
172107
"prettier": "^2.4.1",
108+
"prop-types": "^15.7.2",
173109
"react": "^17.0.2",
174-
"react-dnd-test-backend": "^14.0.1",
175110
"react-dnd-touch-backend": "^14.1.1",
176111
"react-dom": "^17.0.2",
177-
"react-test-renderer": "^17.0.2",
178112
"rimraf": "^3.0.2",
179-
"rollup": "^2.58.0",
113+
"rollup": "^2.59.0",
180114
"rollup-plugin-esbuild": "^4.6.0",
181115
"rollup-plugin-postcss": "^4.0.1",
182116
"shx": "^0.3.3",
183-
"ts-jest": "^27.0.7",
184117
"tslib": "^2.3.1",
185118
"typescript": "^4.4.4"
186119
},

src/__snapshots__/react-sortable-tree.test.tsx.snap

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

src/node-renderer-default.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const NodeRendererDefault: React.FC<NodeRendererProps> = (props) => {
9898
handle = (
9999
<div className="rst__loadingHandle">
100100
<div className="rst__loadingCircle">
101-
{[...new Array(12)].map((_, index) => (
101+
{Array.from(new Array(12), (_, index) => (
102102
<div
103103
// eslint-disable-next-line react/no-array-index-key
104104
key={index}

0 commit comments

Comments
 (0)