Skip to content

Commit 093de8b

Browse files
committed
Apply new eslint rules.
1 parent 44c5afd commit 093de8b

27 files changed

+1679
-1320
lines changed

.eslintrc.js

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

.eslintrc.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"shared-node-browser": true,
5+
"node": true,
6+
"es6": true
7+
},
8+
"extends": [
9+
"prettier",
10+
"plugin:prettier/recommended",
11+
"plugin:import/errors",
12+
"plugin:import/warnings"
13+
],
14+
"plugins": ["@typescript-eslint", "react", "prettier", "import", "jest"],
15+
"parser": "@typescript-eslint/parser",
16+
"parserOptions": {
17+
"ecmaVersion": 2018,
18+
"sourceType": "module",
19+
"ecmaFeatures": {
20+
"jsx": true
21+
},
22+
"rules": {
23+
"curly": ["warn", "multi-line", "consistent"],
24+
"no-console": "off",
25+
"no-empty-pattern": "warn",
26+
"no-duplicate-imports": "error",
27+
"import/no-unresolved": ["error", { "commonjs": true, "amd": true }],
28+
"import/export": "error",
29+
"import/named": "off",
30+
"import/namespace": "off",
31+
"import/default": "off",
32+
"@typescript-eslint/explicit-module-boundary-types": "off",
33+
"no-unused-vars": ["warn", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }],
34+
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }],
35+
"@typescript-eslint/no-use-before-define": "off",
36+
"@typescript-eslint/no-empty-function": "off",
37+
"@typescript-eslint/no-empty-interface": "off",
38+
"@typescript-eslint/no-explicit-any": "off",
39+
"jest/consistent-test-it": ["error", { "fn": "it", "withinDescribe": "it" }]
40+
}
41+
},
42+
"settings": {
43+
"react": {
44+
"version": "detect"
45+
},
46+
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
47+
"import/parsers": {
48+
"@typescript-eslint/parser": [".js", ".jsx", ".ts", ".tsx"]
49+
},
50+
"import/resolver": {
51+
"node": {
52+
"extensions": [".js", ".jsx", ".ts", ".tsx", ".json"],
53+
"paths": ["src"]
54+
},
55+
"alias": {
56+
"extensions": [".js", ".jsx", ".ts", ".tsx", ".json"],
57+
"map": [["valtio", "./src/index.ts"]]
58+
}
59+
}
60+
},
61+
"overrides": [
62+
{
63+
"files": ["src"],
64+
"parserOptions": {
65+
"project": "./tsconfig.json"
66+
}
67+
}
68+
]
69+
}

.nvmrc

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

.prettierignore

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

.prettierrc

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

.size-snapshot.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"index.cjs.js": {
3-
"bundled": 116352,
4-
"minified": 46815,
5-
"gzipped": 11794
3+
"bundled": 116577,
4+
"minified": 47021,
5+
"gzipped": 11838
66
},
77
"index.esm.js": {
8-
"bundled": 112319,
9-
"minified": 43387,
10-
"gzipped": 11566,
8+
"bundled": 112544,
9+
"minified": 43593,
10+
"gzipped": 11608,
1111
"treeshaked": {
1212
"rollup": {
13-
"code": 35285,
13+
"code": 35321,
1414
"import_statements": 447
1515
},
1616
"webpack": {
17-
"code": 36875
17+
"code": 36911
1818
}
1919
}
2020
}

package.json

Lines changed: 79 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,64 @@
22
"name": "@nosferatu500/react-sortable-tree",
33
"version": "3.0.5",
44
"description": "Drag-and-drop sortable component for nested data and hierarchies",
5+
"main": "dist/index.cjs.js",
6+
"module": "dist/index.esm.js",
7+
"types": "dist/index.d.ts",
8+
"typesVersions": {
9+
"<4.0": {
10+
"esm/*": [
11+
"ts3.4/*"
12+
],
13+
"*": [
14+
"ts3.4/*"
15+
]
16+
}
17+
},
18+
"files": [
19+
"dist",
20+
"style.css"
21+
],
22+
"sideEffects": false,
523
"scripts": {
624
"prebuild": "yarn lint && yarn clean",
725
"build": "rollup -c",
826
"build:storybook": "build-storybook -o build",
927
"clean": "rimraf dist",
1028
"clean:storybook": "rimraf build",
11-
"lint": "eslint src",
12-
"prettier": "prettier --write \"{src,example/src,stories}/**/*.{js,css,md}\"",
29+
"lint": "eslint src --fix",
1330
"prepublishOnly": "yarn test && yarn build",
1431
"release": "standard-version",
1532
"test": "jest --env=jsdom",
1633
"test:watch": "jest --watchAll",
1734
"storybook": "start-storybook -p ${PORT:-3001} -h 0.0.0.0"
1835
},
19-
"main": "dist/index.cjs.js",
20-
"module": "dist/index.esm.js",
21-
"files": [
22-
"dist",
23-
"style.css"
24-
],
36+
"prettier": {
37+
"semi": false,
38+
"trailingComma": "es5",
39+
"singleQuote": true,
40+
"jsxBracketSameLine": true,
41+
"tabWidth": 2,
42+
"printWidth": 80
43+
},
2544
"repository": {
2645
"type": "git",
2746
"url": "https://github.com/nosferatu500/react-sortable-tree"
2847
},
29-
"bugs": "https://github.com/nosferatu500/react-sortable-tree/issues",
48+
"keywords": [
49+
"react",
50+
"react-component",
51+
"sortable-tree",
52+
"virtual-tree"
53+
],
54+
"publishConfig": {
55+
"access": "public"
56+
},
3057
"contributors": [
3158
"Chris Fritz",
3259
"Vitalii Shvetsov"
3360
],
3461
"license": "MIT",
35-
"publishConfig": {
36-
"access": "public"
37-
},
62+
"bugs": "https://github.com/nosferatu500/react-sortable-tree/issues",
3863
"jest": {
3964
"setupFilesAfterEnv": [
4065
"./node_modules/jest-enzyme/lib/index.js"
@@ -61,19 +86,6 @@
6186
"^react-dnd-test-utils$": "react-dnd-test-utils/dist/cjs"
6287
}
6388
},
64-
"browserslist": {
65-
"production": [
66-
">0.2%",
67-
"not dead",
68-
"not ie <= 11",
69-
"not op_mini all"
70-
],
71-
"development": [
72-
"last 1 chrome version",
73-
"last 1 firefox version",
74-
"last 1 safari version"
75-
]
76-
},
7789
"dependencies": {
7890
"@nosferatu500/react-dnd-scrollzone": "^1.0.14",
7991
"lodash.isequal": "^4.5.0",
@@ -83,30 +95,42 @@
8395
"react-lifecycles-compat": "^3.0.4",
8496
"react-virtualized": "^9.22.3"
8597
},
86-
"peerDependencies": {
87-
"react": "^17.0.0",
88-
"react-dnd": "^11.1.3",
89-
"react-dom": "^17.0.0"
90-
},
9198
"devDependencies": {
9299
"@babel/core": "^7.14.8",
100+
"@babel/helper-module-imports": "^7.13.12",
93101
"@babel/plugin-transform-modules-commonjs": "^7.14.5",
102+
"@babel/plugin-transform-react-jsx": "^7.14.5",
103+
"@babel/preset-env": "^7.14.8",
104+
"@babel/types": "^7.13.14",
94105
"@nosferatu500/theme-file-explorer": "^3.0.5",
106+
"@rollup/plugin-alias": "^3.1.5",
95107
"@rollup/plugin-babel": "^5.3.0",
96108
"@rollup/plugin-commonjs": "^20.0.0",
97109
"@rollup/plugin-node-resolve": "^13.0.4",
110+
"@rollup/plugin-typescript": "^8.2.4",
98111
"@storybook/addon-storyshots": "^6.3.6",
99112
"@storybook/addons": "^6.3.6",
100113
"@storybook/react": "^6.3.6",
101114
"@storybook/theming": "^6.3.6",
115+
"@testing-library/react": "^12.0.0",
116+
"@types/babel-plugin-macros": "^2.8.5",
117+
"@types/jest": "^26.0.24",
118+
"@types/react": "^17.0.15",
119+
"@types/react-dom": "^17.0.9",
120+
"@typescript-eslint/eslint-plugin": "^4.28.5",
121+
"@typescript-eslint/parser": "^4.28.5",
102122
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.3",
123+
"babel-plugin-macros": "^3.0.1",
124+
"babel-plugin-tester": "^10.1.0",
103125
"babel-eslint": "^10.1.0",
104126
"enzyme": "^3.11.0",
127+
"esbuild": "^0.12.17",
105128
"eslint": "^7.32.0",
106-
"eslint-config-airbnb": "^18.2.1",
107129
"eslint-config-prettier": "^8.3.0",
130+
"eslint-import-resolver-alias": "^1.1.2",
108131
"eslint-plugin-import": "^2.23.4",
109-
"eslint-plugin-jsx-a11y": "^6.4.1",
132+
"eslint-plugin-jest": "^24.4.0",
133+
"eslint-plugin-prettier": "^3.4.0",
110134
"eslint-plugin-react": "^7.24.0",
111135
"jest": "^27.0.6",
112136
"jest-enzyme": "^7.1.2",
@@ -119,13 +143,29 @@
119143
"react-test-renderer": "^17.0.2",
120144
"rimraf": "^3.0.2",
121145
"rollup": "^2.55.1",
146+
"rollup-plugin-esbuild": "^4.5.0",
122147
"rollup-plugin-postcss": "^4.0.0",
123-
"rollup-plugin-size-snapshot": "^0.12.0"
148+
"rollup-plugin-size-snapshot": "^0.12.0",
149+
"ts-jest": "^27.0.4",
150+
"tslib": "^2.3.0",
151+
"typescript": "^4.3.5"
124152
},
125-
"keywords": [
126-
"react",
127-
"react-component",
128-
"sortable-tree",
129-
"virtual-tree"
130-
]
153+
"peerDependencies": {
154+
"react": ">=17.0.0",
155+
"react-dnd": ">=11.0.0",
156+
"react-dom": ">=17.0.0"
157+
},
158+
"browserslist": {
159+
"production": [
160+
">0.2%",
161+
"not dead",
162+
"not ie <= 11",
163+
"not op_mini all"
164+
],
165+
"development": [
166+
"last 1 chrome version",
167+
"last 1 firefox version",
168+
"last 1 safari version"
169+
]
170+
}
131171
}

rollup.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import commonjs from '@rollup/plugin-commonjs';
33
import babel from '@rollup/plugin-babel';
44
import postcss from 'rollup-plugin-postcss';
55
import { sizeSnapshot } from 'rollup-plugin-size-snapshot';
6+
import typescript from '@rollup/plugin-typescript';
67

78
import pkg from './package.json';
89

src/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import SortableTree, {
22
SortableTreeWithoutDndContext,
3-
} from './react-sortable-tree';
3+
} from './react-sortable-tree'
44

5-
export * from './utils/default-handlers';
6-
export * from './utils/tree-data-utils';
7-
export default SortableTree;
5+
export * from './utils/default-handlers'
6+
export * from './utils/tree-data-utils'
7+
export default SortableTree
88

99
// Export the tree component without the react-dnd DragDropContext,
1010
// for when component is used with other components using react-dnd.
1111
// see: https://github.com/gaearon/react-dnd/issues/186
12-
export { SortableTreeWithoutDndContext };
12+
export { SortableTreeWithoutDndContext }

0 commit comments

Comments
 (0)