Skip to content

Commit

Permalink
Chore: Remove same-origin dependency
Browse files Browse the repository at this point in the history
Fix #879
Close #916
  • Loading branch information
sarvaje authored and alrra committed Mar 22, 2018
1 parent 1000c13 commit f884572
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
3 changes: 1 addition & 2 deletions packages/rule-disown-opener/package.json
Expand Up @@ -8,8 +8,7 @@
},
"dependencies": {
"caniuse-api": "^2.0.0",
"pluralize": "^7.0.0",
"same-origin": "^0.1.1"
"pluralize": "^7.0.0"
},
"description": "sonarwhal rule that checks if external links disown the opener",
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/rule-disown-opener/src/rule.ts
Expand Up @@ -14,7 +14,6 @@ import { URL } from 'url';

import { isSupported } from 'caniuse-api';
import * as pluralize from 'pluralize';
import * as sameOrigin from 'same-origin';

import { Category } from 'sonarwhal/dist/src/lib/enums/category';
import { cutString, isRegularProtocol } from 'sonarwhal/dist/src/lib/utils/misc';
Expand Down Expand Up @@ -79,7 +78,7 @@ export default class DisownOpenerRule implements IRule {
* change that by setting `includeSameOriginURLs` to `true`.
*/

if (sameOrigin(resource, fullURL) && !includeSameOriginURLs) {
if ((new URL(resource).origin === new URL(fullURL).origin) && !includeSameOriginURLs) {
debug('Is same origin');

return false;
Expand Down
4 changes: 0 additions & 4 deletions yarn.lock
Expand Up @@ -6671,10 +6671,6 @@ safe-regex@^1.1.0:
dependencies:
ret "~0.1.10"

same-origin@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/same-origin/-/same-origin-0.1.1.tgz#c2287d3192577df517acbbd6d1451a9c3c3914f5"

samsam@1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/samsam/-/samsam-1.3.0.tgz#8d1d9350e25622da30de3e44ba692b5221ab7c50"
Expand Down

0 comments on commit f884572

Please sign in to comment.