Remove linting
Browse files- .eslintignore +0 -7
- .eslintrc +0 -18
- .husky/pre-commit +0 -4
- .lintstagedrc +0 -4
- .prettierignore +0 -1
- .prettierrc +1 -1
- .stylelintignore +0 -7
- .stylelintrc +0 -21
- package.json +1 -19
- src/popover.ts +27 -5
.eslintignore
DELETED
|
@@ -1,7 +0,0 @@
|
|
| 1 |
-
.history
|
| 2 |
-
.husky
|
| 3 |
-
.vscode
|
| 4 |
-
coverage
|
| 5 |
-
dist
|
| 6 |
-
node_modules
|
| 7 |
-
vite.config.ts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.eslintrc
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"root": true,
|
| 3 |
-
"parser": "@typescript-eslint/parser",
|
| 4 |
-
"plugins": ["@typescript-eslint", "prettier"],
|
| 5 |
-
"extends": [
|
| 6 |
-
"eslint:recommended",
|
| 7 |
-
"plugin:@typescript-eslint/eslint-recommended",
|
| 8 |
-
"plugin:@typescript-eslint/recommended",
|
| 9 |
-
"prettier"
|
| 10 |
-
],
|
| 11 |
-
"env": {
|
| 12 |
-
"browser": true,
|
| 13 |
-
"node": true
|
| 14 |
-
},
|
| 15 |
-
"rules": {
|
| 16 |
-
"prettier/prettier": "error"
|
| 17 |
-
}
|
| 18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.husky/pre-commit
DELETED
|
@@ -1,4 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env sh
|
| 2 |
-
. "$(dirname -- "$0")/_/husky.sh"
|
| 3 |
-
|
| 4 |
-
npx lint-staged
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.lintstagedrc
DELETED
|
@@ -1,4 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"./**/*.{ts,html,json}": "npm run format:scripts",
|
| 3 |
-
"./**/*.{css,scss}": "npm run format:styles"
|
| 4 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.prettierignore
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
.history
|
| 2 |
-
.husky
|
| 3 |
.vscode
|
| 4 |
coverage
|
| 5 |
dist
|
|
|
|
| 1 |
.history
|
|
|
|
| 2 |
.vscode
|
| 3 |
coverage
|
| 4 |
dist
|
.prettierrc
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"printWidth":
|
| 3 |
"tabWidth": 2,
|
| 4 |
"singleQuote": false,
|
| 5 |
"trailingComma": "es5",
|
|
|
|
| 1 |
{
|
| 2 |
+
"printWidth": 120,
|
| 3 |
"tabWidth": 2,
|
| 4 |
"singleQuote": false,
|
| 5 |
"trailingComma": "es5",
|
.stylelintignore
DELETED
|
@@ -1,7 +0,0 @@
|
|
| 1 |
-
.history
|
| 2 |
-
.husky
|
| 3 |
-
.vscode
|
| 4 |
-
coverage
|
| 5 |
-
dist
|
| 6 |
-
node_modules
|
| 7 |
-
vite.config.ts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.stylelintrc
DELETED
|
@@ -1,21 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"plugins": ["stylelint-prettier"],
|
| 3 |
-
"extends": [
|
| 4 |
-
"stylelint-config-recommended",
|
| 5 |
-
"stylelint-config-sass-guidelines",
|
| 6 |
-
"stylelint-config-prettier"
|
| 7 |
-
],
|
| 8 |
-
"overrides": [
|
| 9 |
-
{
|
| 10 |
-
"files": ["**/*.scss"],
|
| 11 |
-
"customSyntax": "postcss-scss"
|
| 12 |
-
}
|
| 13 |
-
],
|
| 14 |
-
"rules": {
|
| 15 |
-
"prettier/prettier": true,
|
| 16 |
-
"function-parentheses-space-inside": null,
|
| 17 |
-
"no-descending-specificity": null,
|
| 18 |
-
"max-nesting-depth": 2,
|
| 19 |
-
"selector-max-id": 1
|
| 20 |
-
}
|
| 21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.json
CHANGED
|
@@ -15,34 +15,16 @@
|
|
| 15 |
"build": "tsc && vite build && dts-bundle-generator --config ./dts-bundle-generator.config.ts",
|
| 16 |
"test": "vitest",
|
| 17 |
"test:coverage": "vitest --coverage",
|
| 18 |
-
"
|
| 19 |
-
"lint:styles": "stylelint ./**/*.{css,scss}",
|
| 20 |
-
"format:scripts": "prettier . --write",
|
| 21 |
-
"format:styles": "stylelint ./**/*.{css,scss} --fix",
|
| 22 |
-
"format": "npm run format:scripts && npm run format:styles",
|
| 23 |
-
"prepare": "husky install && husky set .husky/pre-commit 'npx lint-staged' && git add .husky/pre-commit",
|
| 24 |
-
"uninstall-husky": "npm uninstall husky --no-save && git config --unset core.hooksPath && npx rimraf .husky"
|
| 25 |
},
|
| 26 |
"devDependencies": {
|
| 27 |
"@types/jsdom": "^21.1.1",
|
| 28 |
"@types/node": "^20.1.0",
|
| 29 |
-
"@typescript-eslint/eslint-plugin": "^5.59.2",
|
| 30 |
-
"@typescript-eslint/parser": "^5.59.2",
|
| 31 |
"@vitest/coverage-c8": "^0.31.0",
|
| 32 |
"dts-bundle-generator": "^8.0.1",
|
| 33 |
-
"eslint": "^8.40.0",
|
| 34 |
-
"eslint-config-prettier": "^8.8.0",
|
| 35 |
-
"eslint-plugin-prettier": "^4.2.1",
|
| 36 |
-
"husky": "^8.0.3",
|
| 37 |
-
"lint-staged": "^13.2.2",
|
| 38 |
"postcss": "^8.4.23",
|
| 39 |
"postcss-scss": "^4.0.6",
|
| 40 |
"prettier": "^2.8.8",
|
| 41 |
-
"stylelint": "^15.6.1",
|
| 42 |
-
"stylelint-config-prettier": "^9.0.5",
|
| 43 |
-
"stylelint-config-recommended": "^12.0.0",
|
| 44 |
-
"stylelint-config-sass-guidelines": "^10.0.0",
|
| 45 |
-
"stylelint-prettier": "^3.0.0",
|
| 46 |
"ts-node": "^10.9.1",
|
| 47 |
"typescript": "^5.0.4",
|
| 48 |
"vite": "^4.3.5",
|
|
|
|
| 15 |
"build": "tsc && vite build && dts-bundle-generator --config ./dts-bundle-generator.config.ts",
|
| 16 |
"test": "vitest",
|
| 17 |
"test:coverage": "vitest --coverage",
|
| 18 |
+
"format": "prettier . --write"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
},
|
| 20 |
"devDependencies": {
|
| 21 |
"@types/jsdom": "^21.1.1",
|
| 22 |
"@types/node": "^20.1.0",
|
|
|
|
|
|
|
| 23 |
"@vitest/coverage-c8": "^0.31.0",
|
| 24 |
"dts-bundle-generator": "^8.0.1",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
"postcss": "^8.4.23",
|
| 26 |
"postcss-scss": "^4.0.6",
|
| 27 |
"prettier": "^2.8.8",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
"ts-node": "^10.9.1",
|
| 29 |
"typescript": "^5.0.4",
|
| 30 |
"vite": "^4.3.5",
|
src/popover.ts
CHANGED
|
@@ -50,13 +50,35 @@ export function refreshPopover(element: Element) {
|
|
| 50 |
const popoverArrow = popover.arrow;
|
| 51 |
|
| 52 |
// const position = calculatePopoverPosition(element);
|
| 53 |
-
popoverArrow?.classList.add(
|
| 54 |
-
"driver-popover-arrow-side-bottom",
|
| 55 |
-
"driver-popover-arrow-align-center"
|
| 56 |
-
);
|
| 57 |
}
|
| 58 |
|
| 59 |
-
function calculatePopoverPosition(element: Element) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
function createPopover(): PopoverDOM {
|
| 62 |
const wrapper = document.createElement("div");
|
|
|
|
| 50 |
const popoverArrow = popover.arrow;
|
| 51 |
|
| 52 |
// const position = calculatePopoverPosition(element);
|
| 53 |
+
popoverArrow?.classList.add("driver-popover-arrow-side-bottom", "driver-popover-arrow-align-center");
|
|
|
|
|
|
|
|
|
|
| 54 |
}
|
| 55 |
|
| 56 |
+
function calculatePopoverPosition(element: Element) {
|
| 57 |
+
if (!popover) {
|
| 58 |
+
return;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
const popoverPadding = 10;
|
| 62 |
+
|
| 63 |
+
const popoverDimensions = popover.wrapper.getBoundingClientRect();
|
| 64 |
+
const popoverArrowDimensions = popover.arrow.getBoundingClientRect();
|
| 65 |
+
const elementDimensions = element.getBoundingClientRect();
|
| 66 |
+
|
| 67 |
+
const popoverWidth = popoverDimensions.width + popoverPadding;
|
| 68 |
+
const popoverHeight = popoverDimensions.height + popoverPadding;
|
| 69 |
+
|
| 70 |
+
const topValue = elementDimensions.top - popoverHeight;
|
| 71 |
+
const isTopOptimal = topValue >= 0;
|
| 72 |
+
|
| 73 |
+
const bottomValue = window.innerHeight - (elementDimensions.bottom + popoverHeight);
|
| 74 |
+
const isBottomOptimal = bottomValue >= 0;
|
| 75 |
+
|
| 76 |
+
const leftValue = elementDimensions.left - popoverWidth;
|
| 77 |
+
const isLeftOptimal = leftValue >= 0;
|
| 78 |
+
|
| 79 |
+
const rightValue = window.innerWidth - (elementDimensions.right + popoverWidth);
|
| 80 |
+
const isRightOptimal = rightValue >= 0;
|
| 81 |
+
}
|
| 82 |
|
| 83 |
function createPopover(): PopoverDOM {
|
| 84 |
const wrapper = document.createElement("div");
|