Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Add "tslint:all" configuration #2417

Merged
merged 4 commits into from
Mar 31, 2017
Merged

Conversation

andy-hanson
Copy link
Contributor

PR checklist

Overview of change:

Minimal-change version of #2241

CHANGELOG.md entry:

[api] tslint:all configuration

"no-shadowed-variable": true,
"no-string-literal": true,
"no-string-throw": true,
// "no-switch-case-fall-through": Won't this be deprecated?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, just delete this line

"no-unsafe-any": true,
"no-unsafe-finally": true,
"no-unused-expression": true,
// "no-unused-variable": Won't this be deprecated?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still keeping it around; you probably ought to enable it here actually, given the kind of semantics you're going for for tslint:all

"strict-type-predicates": true,
// "switch-default": Won't this be deprecated?
"triple-equals": true,
// "typeof-compare": Won't this be deprecated?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, remove

"restrict-plus-operands": true,
"strict-boolean-expressions": true,
"strict-type-predicates": true,
// "switch-default": Won't this be deprecated?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're going to keep it around actually, let's enable it here

Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

almost there, small change requested

const expectedAllRules = everyRule().filter((ruleName) => {
// Some rules intentionally excluded
switch (ruleName) {
case "ban":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should maintain this blacklist in configs/all.ts as an array, and do RULES_EXCLUDED_FROM_ALL_CONFIG.indexOf(ruleName) === -1 in this filter


function everyRule(): string[] {
return fs.readdirSync(srcRulesDir)
.filter((file) => /Rule.ts$/.test(file))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: expected 8 spaces of indentation

@tonghae
Copy link

tonghae commented Jul 7, 2018

Is there a command to list all rules used in tslint.json including specified via "extends" property?

@ajafff
Copy link
Contributor

ajafff commented Jul 10, 2018

@tonghae that's possible, but not with TSLint itself. I wrote a linter that allows to execute TSLint rules. It also knows how to handle the configuration correctly.

yarn add @fimbul/wotan @fimbul/valtyr
# or
npm install @fimbul/wotan @fimbul/valtyr

Note that you might need to use ./node_modules/.bin/wotan instead of wotan in the following commands if you haven't modified your PATH or installed both packages globally.

# lookup the tslint.json for 'path/to/file.ts' like TSLint does
wotan show -m @fimbul/valtyr path/to/file.ts
# use a specific config file, not necessarily the one that TSLint's lookup finds
wotan show -m @fimbul/valtyr path/to/file.ts -c path/to/config.json
# you can even use config presets like 'tslint:all'
wotan show -m @fimbul/valtyr path/to/file.ts -c tslint:all
# output as JSON instead of YAML
wotan show -m @fimbul/valtyr path/to/file.ts -f json 

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants