Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed Dec 29, 2021
1 parent 3618ac4 commit c36cc0f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/textlintrc-to-pacakge-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ function validRulePackageKey(key) {
if (key.charAt(0) === "@") {
return key.split("/").length === 2;
}
// invalid rule/path
// invalid rule/key
// just ignore
return key.split("/").length === 1;
}

Expand All @@ -33,15 +34,15 @@ export const createFullPackageName = (prefix, name) => {
* the path is already @scope/<name> or @scope/textlint-rule-<name>
*/
return name.replace(/^@([^/]+)\/(.*)$/, (all, scope, name) => {
// already has prefix
// already has prefixed
if (name.startsWith(prefix)) {
return `@${scope}/${name}`
}
return `@${scope}/${prefix}${name}`;
});
}
}
// already has prefix
// already has prefixed - do not add prefix
if (name.startsWith(prefix)) {
return `${name}`
}
Expand Down

0 comments on commit c36cc0f

Please sign in to comment.