Skip to content

Commit

Permalink
fix(rule): add fallback for getConfigBaseDir (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
azu authored Dec 1, 2017
1 parent d88c591 commit 2172d85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@
},
"dependencies": {
"@textlint/ast-node-types": "^2.0.0",
"@textlint/get-config-base-dir": "^1.0.1",
"escape-string-regexp": "^1.0.5",
"execall": "^1.0.0",
"rc-config-loader": "^2.0.1",
"str-to-regexp": "^1.1.3"
},
"peerDependencies": {
"textlint": ">= 9.0.0"
}
}
4 changes: 2 additions & 2 deletions src/textlint-filter-rule-whitelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const execall = require('execall');
const escapeStringRegexp = require('escape-string-regexp');
const toRegExp = require("str-to-regexp").toRegExp;
const rcfile = require("rc-config-loader");

const { getConfigBaseDir} = require("@textlint/get-config-base-dir");
const getAllowWordsFromFiles = (files, baseDirectory) => {
let results = [];
files.forEach(filePath => {
Expand Down Expand Up @@ -42,7 +42,7 @@ const defaultOptions = {
};
module.exports = function(context, options) {
const { Syntax, shouldIgnore, getSource } = context;
const baseDirectory = context.getConfigBaseDir();
const baseDirectory = getConfigBaseDir(context);
const allowWords = options.allow || defaultOptions.allow;
const whitelistConfigPaths = options.whitelistConfigPaths
? getAllowWordsFromFiles(options.whitelistConfigPaths, baseDirectory)
Expand Down

0 comments on commit 2172d85

Please sign in to comment.