This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 889
New Rule: max-file-line-count #1360
Merged
jkillian
merged 20 commits into
palantir:master
from
ChrisMBarr:max-file-line-count-rule
Jul 26, 2016
Merged
New Rule: max-file-line-count #1360
jkillian
merged 20 commits into
palantir:master
from
ChrisMBarr:max-file-line-count-rule
Jul 26, 2016
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I think Although that would technically mean our other rule should be named |
|
||
if (lineCount > lineLimit && disabledIntervals.length === 0) { | ||
const errorString = Rule.FAILURE_STRING_FACTORY(lineCount, lineLimit); | ||
ruleFailures.push(new Lint.RuleFailure(sourceFile, 0, 0, errorString, this.getOptions().ruleName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of making this a zero-length error, can we make it either one character long or the length of the first line?
Looking good, thanks @ChrisMBarr! Can you make the small changes noted above and merge |
Let's just stay with |
Now when something is unused it fails with a specific message about what it is, instead of just calling everything a "variable". The types that can be reported are: * function 🆕 * import 🆕 * parameter 🆕 * property 🆕 * variable
Addresses #1323. * Changed `Linter` to accept an optional program object in the constructor * Added helper functions for creating a program using a tsconfig and getting relevant files * Created `TypedRule` class which receives the program object * Rules extending this class must implement `applyWithProgram` * `Linter` passes program to `TypedRule`s if available * Calling `apply` on a `TypedRule` throws an error * Added `requiresTypeInfo` boolean to metadata * Created `ProgramAwareRuleWalker` which walks with the program / typechecker * Added cli options `--project` and `--type-check` * `--project` takes a `tsconfig.json` file * `--type-check` enables type checking and `TypedRule`s, requires `--project` * Added an example `restrictPlusOperands` rule and tests that uses types
…prtly supports module targets (#1388)
* Add linterOptions to tslint.json - only enable type checking during tests when typeCheck: true is configured - fixes #1402 * Code style
* Add new Rule: arrow-parens * Add test * modify some documentations
* Core quote-props rule * Tweaks for code review * rename
…1349) * Implement rule to forbid return statements in finally blocks #1097 * explore the try statement fully to pick up violations in nested scopes * switch to a scope aware rule walker to reduce number of passes over the AST * Add support for other control flow statements in finally blocks (break, continue, throws) * improve the rationale description for the no unsafe finally rule * rename rule to no-unsafe-finally to be inline with eslint * add new rule to latest config * pull out helper functions from the walker class. * fix tslint violations (which didn't occur locally)
* task(formatter): added stylish formatter * Support non-colors terminal in tests * fix(stylish): lint quotes * fix(stylish) 4 spaces indentation * fix(stylish): correct strpad amount * fix(stylish): test tuple position
Thanks @ChrisMBarr, merged! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adding a new rule that limits the number of lines that a file can contain. When files go over this limit it's usually a sign that the code is too complex, or it has too many responsibilities and it needs to be broken up into smaller pieces.
The goal here is to count the number of lines, and it should match the line number display in your IDE (meaning things like blank lines, comments, etc. are included in this count)
If the rule disabling comment
/* tslint:disable:max-file-line-count */
is added anywhere in the file, this rule is ignored for the file.