Closed owlpaste closed 4 years ago
Sorry about that, I hadn’t released the recent deny
feature yet. It’s now in alex@8.2.0!
Let me know if you have further questions.
Hiya, thanks for the quick reply, but still having issues @wooorm
➜ cat .alexrc
{
"allow": ["pop", "mom", "reject"],
"deny": ["master"]
}
➜ cat example.js
console.log(`bad example
it should fail
because he is silly
master
and sometimes
even a slave`);
➜ ./node_modules/.bin/alex example.js
example.js: no issues found
➜ ./node_modules/.bin/alex --version
8.2.0
Should I make a new issue/question @wooorm ?
Sorry about the wait. The deny
field is a recent addition, if it is configured, only deny is used, not allow
. You should see an error if both are configured, so it’s a bug if you don’t see it (or you’re not on the latest alex? 🤔).
With deny
, you create a list of rules to warn for. All the other rules don’t run. With allow
, it’s the inverse: everything runs, except for the ones in allow
!
Hiya, created https://github.com/owlpaste/alex-test as a quick test.
Was running this with
npm run lint-language *
> alex-test@0.0.1 lint-language /Users/user/projects/random/alex-test
> alex "example.js" "example.md" "node_modules" "package-lock.json" "package.json"
example.js: no issues found
example.md
4:1-4:4 warning `pop` may be insensitive, use `parent` instead dad-mom retext-equality
Fairly sure I am using it wrong, but a couple of things that are confusing me.
.alexrc
(maybe that is why no error is raised when using both allow
and deny
?)js
files even when passed inGood catch! Welp, thanks to your repo I found out that deny
isn’t supported on the CLI
For your second point, “Ignoring js files even when passed in”, I don’t see that. It is checking a javascript file with alex example.js
. But it’s interpreting it as markdown. Your backticks in example.js are seen in markdown as inline code, which alex ignored.
For your second point, “Ignoring js files even when passed in”, I don’t see that. It is checking a javascript file with
alex example.js
. But it’s interpreting it as markdown. Your backticks in example.js are seen in markdown as inline code, which alex ignored.
Oh I see, thanks for the explanation, I didn't think of that.
Will test out the fix.
If you don't want a file to be interpreted as md, mdx, html, or whatnot, I think there's a --text flag!
Good luck
I am having issues getting the
deny
filter to work. Can I get an example where bothallow
anddeny
lists are used?I was trying to use
.alexrc
And the allow part gets applied fine, however deny does not. It wasn't really clear from examples as to how to use this?