Skip to content

Commit

Permalink
Refactor package.json some more
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Sep 27, 2023
1 parent eca5e6b commit a1fc6d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 35 deletions.
20 changes: 7 additions & 13 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,11 @@ export function Markdown(options) {
}

if (node.type === 'element') {
let remove = false

if (allowedElements) {
remove = !allowedElements.includes(node.tagName)
} else if (disallowedElements) {
remove = disallowedElements.includes(node.tagName)
}
let remove = allowedElements
? !allowedElements.includes(node.tagName)
: disallowedElements
? disallowedElements.includes(node.tagName)
: false

if (!remove && allowElement && typeof index === 'number') {
remove = !allowElement(node, index, parent)
Expand Down Expand Up @@ -307,11 +305,7 @@ export function defaultUrlTransform(value) {
return url
}

let index = -1

while (++index < safeProtocols.length) {
const protocol = safeProtocols[index]

for (const protocol of safeProtocols) {
if (
colon === protocol.length &&
url.slice(0, protocol.length).toLowerCase() === protocol
Expand All @@ -320,7 +314,7 @@ export function defaultUrlTransform(value) {
}
}

index = url.indexOf('?')
let index = url.indexOf('?')
if (index !== -1 && colon > index) {
return url
}
Expand Down
24 changes: 2 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,7 @@
"@types/react-dom": "^18.0.0",
"c8": "^8.0.0",
"esbuild": "^0.19.0",
"eslint-plugin-es": "^4.0.0",
"eslint-plugin-react": "^7.0.0",
"eslint-plugin-react-hooks": "^4.0.0",
"eslint-plugin-security": "^1.0.0",
"prettier": "^3.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
Expand Down Expand Up @@ -153,10 +150,6 @@
"atLeast": 100,
"detail": true,
"ignoreCatch": true,
"#": "below is ignored because some proptypes will `any`; to do: remove prop-types?",
"ignoreFiles": [
"lib/index.d.ts"
],
"strict": true
},
"xo": {
Expand All @@ -165,19 +158,6 @@
],
"extends": "plugin:react/jsx-runtime",
"overrides": [
{
"files": [
"lib/**/*.js"
],
"extends": [
"plugin:es/restrict-to-es2019",
"plugin:security/recommended"
],
"rules": {
"complexity": "off",
"security/detect-object-injection": "off"
}
},
{
"files": [
"**/*.jsx"
Expand All @@ -189,8 +169,8 @@
],
"prettier": true,
"rules": {
"n/file-extension-in-import": "off",
"unicorn/prefer-string-replace-all": "off"
"complexity": "off",
"n/file-extension-in-import": "off"
}
}
}

0 comments on commit a1fc6d9

Please sign in to comment.