Code Monkey home page Code Monkey logo

textlint-filter-rule-allowlist's Issues

Error while loading rule 'whitelist': context.getConfigBaseDir is not a function

An error occurred when updating to v1.2.1.

Paste the stack trace.

linter-registry.js [sm]:137 [Linter] Error running textlint TypeError: Error while loading rule 'whitelist': context.getConfigBaseDir is not a function
    at module.exports (/Users/takashi/Documents/textlint_env/node_modules/textlint-filter-rule-whitelist/lib/textlint-filter-rule-whitelist.js:51:33)
    at TextLintCoreTask.tryToGetRuleObject (/Users/takashi/.atom/packages/linter-textlint/node_modules/textlint/lib/task/textlint-core-task.js:241:24)
    at TextLintCoreTask.tryToAddListenRule (/Users/takashi/.atom/packages/linter-textlint/node_modules/textlint/lib/task/textlint-core-task.js:261:35)
    at /Users/takashi/.atom/packages/linter-textlint/node_modules/textlint/lib/task/linter-task.js:122:24
    at /Users/takashi/.atom/packages/linter-textlint/node_modules/textlint/lib/core/rule-creator-set.js:127:24
    at Array.forEach (native)
    at RuleCreatorSet.forEach (/Users/takashi/.atom/packages/linter-textlint/node_modules/textlint/lib/core/rule-creator-set.js:126:35)
    at TextLintCoreTask._setupRules (/Users/takashi/.atom/packages/linter-textlint/node_modules/textlint/lib/task/linter-task.js:109:39)
    at new TextLintCoreTask (/Users/takashi/.atom/packages/linter-textlint/node_modules/textlint/lib/task/linter-task.js:67:15)
    at LinterProcessor.process (/Users/takashi/.atom/packages/linter-textlint/node_modules/textlint/lib/linter/linter-processor.js:71:24)
    at TextlintCore._parallelProcess (/Users/takashi/.atom/packages/linter-textlint/node_modules/textlint/lib/textlint-core.js:253:36)
    at /Users/takashi/.atom/packages/linter-textlint/node_modules/textlint/lib/textlint-core.js:310:31
    at tryCatcher (/Users/takashi/.atom/packages/linter-textlint/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/takashi/.atom/packages/linter-textlint/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/Users/takashi/.atom/packages/linter-textlint/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/Users/takashi/.atom/packages/linter-textlint/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/Users/takashi/.atom/packages/linter-textlint/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/Users/takashi/.atom/packages/linter-textlint/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/Users/takashi/.atom/packages/linter-textlint/node_modules/bluebird/js/release/async.js:143:10)
    at Async.drainQueues (/Users/takashi/.atom/packages/linter-textlint/node_modules/bluebird/js/release/async.js:17:14)

textlint fails to resolve allowlistConfigPaths when the fix flag is specified

environment

  • OS Name: Microsoft Windows 10 Pro
  • OS Version: 10.0.19042 N/A Build 19042
  • Node: v14.15.4
  • Npm: 6.14.10
  • textlint: 11.8.1
  • textlint-filter-rule-allowlist: 2.0.1
  • textlint-rule-prh: 5.3.0

problems

textlint fails to resolve allowlistConfigPaths when the fix flag is specified.
(textlint success to resolve prh's rulePaths when the fix flag is specified.)

example-repository

npx textlint --config lint/.textlintrc doc/a.md
× Error
Error while loading filter rule 'allowlist': This allow file is not allow word list: ./allowlist/allow.json
at C:\Users\y_okazawa\tmp\allowlist\doc\a.md

× Stack trace
Error: Error while loading filter rule 'allowlist': This allow file is not allow word list: ./allowlist/allow.json
at C:\Users\y_okazawa\tmp\allowlist\doc\a.md
    at C:\Users\y_okazawa\tmp\allowlist\node_modules\textlint-filter-rule-allowlist\lib\textlint-filter-rule-allowlist.js:28:13
    at Array.forEach (<anonymous>)
    at getAllowWordsFromFiles (C:\Users\y_okazawa\tmp\allowlist\node_modules\textlint-filter-rule-allowlist\lib\textlint-filter-rule-allowlist.js:19:9)
    at module.exports (C:\Users\y_okazawa\tmp\allowlist\node_modules\textlint-filter-rule-allowlist\lib\textlint-filter-rule-allowlist.js:60:61)
    at TextLintCoreTask.tryToGetFilterRuleObject (C:\Users\y_okazawa\tmp\allowlist\node_modules\@textlint\kernel\lib\task\textlint-core-task.js:191:20)
    at TextLintCoreTask.tryToAddListenRule (C:\Users\y_okazawa\tmp\allowlist\node_modules\@textlint\kernel\lib\task\textlint-core-task.js:209:20)
    at C:\Users\y_okazawa\tmp\allowlist\node_modules\@textlint\kernel\lib\task\fixer-task.js:67:19
    at Array.forEach (<anonymous>)
    at TextLintCoreTask._setupRules (C:\Users\y_okazawa\tmp\allowlist\node_modules\@textlint\kernel\lib\task\fixer-task.js:60:48)
    at new TextLintCoreTask (C:\Users\y_okazawa\tmp\allowlist\node_modules\@textlint\kernel\lib\task\fixer-task.js:36:15)

additional note

textlint success without the fix flag.

npx textlint --config lint/.textlintrc doc/a.md

C:\Users\y_okazawa\tmp\fails-to-resolve-allowlistConfigPaths\doc\a.md
  7:1  ✓ error  テスティング => テスト  prh

✖ 1 problem (1 error, 0 warnings)
✓ 1 fixable problem.
Try to run: $ textlint --fix [file]

Add `g` flag to pattern string by default

Should we add g flag to pattern string?

For example, following pattern string is treaded /#.*{#[a-z.-]+}/ .
As a result, this pattern match only first item({#first}).
By constrast it does not match second item({#second})

pattern:

"/#.*{#[a-z.-]+}/"

text:

# First {#first}

# Second {#second}

Current behavior confuse user, I think.

External file conversion of ignore list

Currently I write an ignore list inline in .textlintrc file.
I want to make an ignore list an external file so that it can be read.

I think it is convenient to write as follows.

{
    "filters": {
        "whitelist": {
            "allow": [
                "ignored-word",
                "/\\d+/",
                "/^===/m"
            ],
            "allowPaths": [
                "./allow-words.yml"
            ]
        }
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.