Skip to content

Commit 0df2dee

Browse files
committed
fix(scripts): fix validation of current dir
1 parent 7d14c6f commit 0df2dee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/scripts/create-textlint-rule.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ module.exports = function(projectName, options = {}) {
2020
const useYes = options.yes !== undefined;
2121
const isInitInCurrentDir = projectName === ".";
2222
const ruleName = isInitInCurrentDir
23-
? path.dirname(projectName)
23+
? path.basename(options.cwd)
2424
: `textlint-rule-${projectName.replace(/^textlint-rule-/, "")}`;
2525
if (isInitInCurrentDir && !/^textlint-rule-/.test(ruleName)) {
26-
throw new Error(`Current directory name should start with "textlint-rule-<rule-name>".`);
26+
throw new Error(`Current directory name should start with "textlint-rule-<rule-name>": ${ruleName}.`);
2727
}
2828
const ruleDir = isInitInCurrentDir ? options.cwd : path.join(options.cwd, ruleName);
2929
return spawn(`git`, [

0 commit comments

Comments
 (0)