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

Add grouped imports by default in tslint:all #4420

Merged
merged 3 commits into from
Jan 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/configs/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ export const rules = {
"ordered-imports": [
true,
{
"grouped-imports": true,
"import-sources-order": "case-insensitive",
"named-imports-order": "case-insensitive",
"module-source-path": "full",
Expand Down
2 changes: 1 addition & 1 deletion src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import * as yaml from "js-yaml";
import { Minimatch } from "minimatch";
import * as os from "os";
import * as path from "path";
import { FatalError, showWarningOnce } from "./error";

import { FatalError, showWarningOnce } from "./error";
import { IOptions, RuleSeverity } from "./language/rule/rule";
import { findRule } from "./ruleLoader";
import { arrayify, hasOwnProperty, stripComments, tryResolvePackage } from "./utils";
Expand Down
1 change: 1 addition & 0 deletions src/enableDisableRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import * as utils from "tsutils";
import * as ts from "typescript";

import { RuleFailure } from "./language/rule/rule";

/**
Expand Down
1 change: 1 addition & 0 deletions src/formatterLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import * as fs from "fs";
import * as path from "path";

import { FormatterConstructor } from "./index";
import { camelize, tryResolvePackage } from "./utils";

Expand Down
1 change: 0 additions & 1 deletion src/formatters/checkstyleFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
import { IFormatterMetadata } from "../language/formatter/formatter";
import { RuleFailure } from "../language/rule/rule";

import * as Utils from "../utils";

export class Formatter extends AbstractFormatter {
Expand Down
7 changes: 3 additions & 4 deletions src/formatters/codeFrameFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
* limitations under the License.
*/

import { AbstractFormatter } from "../language/formatter/abstractFormatter";
import { IFormatterMetadata } from "../language/formatter/formatter";
import { RuleFailure } from "../language/rule/rule";

import codeFrame = require("babel-code-frame");
import chalk from "chalk";

import { AbstractFormatter } from "../language/formatter/abstractFormatter";
import { IFormatterMetadata } from "../language/formatter/formatter";
import { RuleFailure } from "../language/rule/rule";
import * as Utils from "../utils";

export class Formatter extends AbstractFormatter {
Expand Down
1 change: 0 additions & 1 deletion src/formatters/jsonFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
import { IFormatterMetadata } from "../language/formatter/formatter";
import { RuleFailure } from "../language/rule/rule";

import * as Utils from "../utils";

export class Formatter extends AbstractFormatter {
Expand Down
1 change: 0 additions & 1 deletion src/formatters/junitFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
import { IFormatterMetadata } from "../language/formatter/formatter";
import { RuleFailure } from "../language/rule/rule";

import * as Utils from "../utils";

export class Formatter extends AbstractFormatter {
Expand Down
1 change: 0 additions & 1 deletion src/formatters/pmdFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
import { IFormatterMetadata } from "../language/formatter/formatter";
import { RuleFailure } from "../language/rule/rule";

import * as Utils from "../utils";

export class Formatter extends AbstractFormatter {
Expand Down
5 changes: 2 additions & 3 deletions src/formatters/stylishFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
* limitations under the License.
*/

import chalk from "chalk";

import { AbstractFormatter } from "../language/formatter/abstractFormatter";
import { IFormatterMetadata } from "../language/formatter/formatter";
import { RuleFailure } from "../language/rule/rule";

import chalk from "chalk";

import * as Utils from "../utils";

export class Formatter extends AbstractFormatter {
Expand Down
1 change: 0 additions & 1 deletion src/formatters/tapFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
import { IFormatterMetadata } from "../language/formatter/formatter";
import { RuleFailure } from "../language/rule/rule";

import * as Utils from "../utils";

export class Formatter extends AbstractFormatter {
Expand Down
1 change: 0 additions & 1 deletion src/formatters/vsoFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import { AbstractFormatter } from "../language/formatter/abstractFormatter";
import { IFormatterMetadata } from "../language/formatter/formatter";
import { RuleFailure } from "../language/rule/rule";

import * as Utils from "../utils";

export class Formatter extends AbstractFormatter {
Expand Down
1 change: 1 addition & 0 deletions src/language/formatter/abstractFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

import { RuleFailure } from "../rule/rule";

import { IFormatter, IFormatterMetadata } from "./formatter";

export abstract class AbstractFormatter implements IFormatter {
Expand Down
1 change: 1 addition & 0 deletions src/language/rule/abstractRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import * as ts from "typescript";

import { IWalker, WalkContext } from "../walker";

import { IOptions, IRule, IRuleMetadata, RuleFailure, RuleSeverity } from "./rule";

export type NoInfer<T> = T & { [K in keyof T]: T[K] };
Expand Down
1 change: 1 addition & 0 deletions src/language/rule/typedRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import * as ts from "typescript";

import { showWarningOnce } from "../../error";

import { AbstractRule } from "./abstractRule";
import { ITypedRule, RuleFailure } from "./rule";

Expand Down
1 change: 1 addition & 0 deletions src/language/walker/blockScopeAwareRuleWalker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import * as ts from "typescript";

import { IOptions } from "../rule/rule";
import { isBlockScopeBoundary } from "../utils";

import { ScopeAwareRuleWalker } from "./scopeAwareRuleWalker";

// tslint:disable:deprecation (extends deprecated class and uses deprecated utils - doesn't matter because it's deprecated, too)
Expand Down
1 change: 1 addition & 0 deletions src/language/walker/programAwareRuleWalker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import * as ts from "typescript";

import { IOptions } from "../rule/rule";

import { RuleWalker } from "./ruleWalker";

export class ProgramAwareRuleWalker extends RuleWalker {
Expand Down
1 change: 1 addition & 0 deletions src/language/walker/ruleWalker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import * as ts from "typescript";

import { Fix, IOptions, Replacement, RuleFailure } from "../rule/rule";

import { SyntaxWalker } from "./syntaxWalker";
import { IWalker } from "./walker";

Expand Down
1 change: 1 addition & 0 deletions src/language/walker/scopeAwareRuleWalker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import * as ts from "typescript";

import { IOptions } from "../rule/rule";
import { isScopeBoundary } from "../utils";

import { RuleWalker } from "./ruleWalker";

/**
Expand Down
1 change: 1 addition & 0 deletions src/language/walker/walker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import * as ts from "typescript";

import { RuleFailure } from "../rule/rule";

import { WalkContext } from "./walkContext";

export interface IWalker {
Expand Down
1 change: 1 addition & 0 deletions src/rules/arrowReturnShorthandRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import * as ts from "typescript";

import * as Lint from "../index";
import { hasCommentAfterPosition } from "../language/utils";

import { codeExamples } from "./code-examples/arrowReturnShorthand.examples";

const OPTION_MULTILINE = "multiline";
Expand Down
1 change: 1 addition & 0 deletions src/rules/awaitPromiseRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
isUnionOrIntersectionType,
} from "tsutils";
import * as ts from "typescript";

import * as Lint from "../index";

export class Rule extends Lint.Rules.TypedRule {
Expand Down
2 changes: 2 additions & 0 deletions src/rules/banTsIgnoreRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

import { forEachComment } from "tsutils";
import * as ts from "typescript";

import * as Lint from "../index";

import { codeExamples } from "./code-examples/banTsIgnore.examples";

export class Rule extends Lint.Rules.AbstractRule {
Expand Down
1 change: 1 addition & 0 deletions src/rules/classNameRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import * as ts from "typescript";

import * as Lint from "../index";
import { isPascalCased } from "../utils";

import { codeExamples } from "./code-examples/className.examples";

export class Rule extends Lint.Rules.AbstractRule {
Expand Down
1 change: 1 addition & 0 deletions src/rules/completed-docs/blockExclusion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { hasModifier } from "tsutils";
import * as ts from "typescript";

import { ALL, Visibility, VISIBILITY_EXPORTED, VISIBILITY_INTERNAL } from "../completedDocsRule";

import { Exclusion } from "./exclusion";

export interface IBlockExclusionDescriptor {
Expand Down
1 change: 1 addition & 0 deletions src/rules/completed-docs/classExclusion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
PRIVACY_PROTECTED,
PRIVACY_PUBLIC,
} from "../completedDocsRule";

import { Exclusion } from "./exclusion";

export interface IClassExclusionDescriptor {
Expand Down
1 change: 1 addition & 0 deletions src/rules/completed-docs/exclusion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import * as ts from "typescript";

import { All, ALL } from "../completedDocsRule";

import { ExclusionDescriptor } from "./exclusionDescriptors";

export abstract class Exclusion<TDescriptor extends ExclusionDescriptor> {
Expand Down
1 change: 1 addition & 0 deletions src/rules/completed-docs/exclusionDescriptors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

import { DocType } from "../completedDocsRule";

import { IBlockExclusionDescriptor } from "./blockExclusion";
import { IClassExclusionDescriptor } from "./classExclusion";
import { ITagExclusionDescriptor } from "./tagExclusion";
Expand Down
1 change: 1 addition & 0 deletions src/rules/completed-docs/exclusionFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import { hasOwnProperty } from "../../utils";
import { DocType } from "../completedDocsRule";

import { BlockExclusion, IBlockExclusionDescriptor } from "./blockExclusion";
import { ClassExclusion, IClassExclusionDescriptor } from "./classExclusion";
import { Exclusion } from "./exclusion";
Expand Down
1 change: 1 addition & 0 deletions src/rules/completedDocsRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import * as ts from "typescript";

import * as Lint from "../index";

import { IInputExclusionDescriptors } from "./completed-docs/exclusionDescriptors";
import { ExclusionFactory, ExclusionsMap } from "./completed-docs/exclusionFactory";

Expand Down
2 changes: 2 additions & 0 deletions src/rules/curlyRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

import { isBlock, isIfStatement, isIterationStatement, isSameLine } from "tsutils";
import * as ts from "typescript";

import * as Lint from "../index";

import { codeExamples } from "./code-examples/curly.examples";

const OPTION_AS_NEEDED = "as-needed";
Expand Down
1 change: 1 addition & 0 deletions src/rules/cyclomaticComplexityRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import { isIdentifier } from "tsutils";
import * as ts from "typescript";

import * as Lint from "../index";
import { isFunctionScopeBoundary } from "../utils";

Expand Down
1 change: 1 addition & 0 deletions src/rules/deprecationRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
isVariableDeclarationList,
} from "tsutils";
import * as ts from "typescript";

import * as Lint from "../index";

export class Rule extends Lint.Rules.TypedRule {
Expand Down
1 change: 1 addition & 0 deletions src/rules/fileHeaderRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

import * as ts from "typescript";

import * as Lint from "../index";

const ENFORCE_TRAILING_NEWLINE = "enforce-trailing-newline";
Expand Down
1 change: 1 addition & 0 deletions src/rules/functionConstructorRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { isCallExpression, isIdentifier, isNewExpression } from "tsutils";
import * as ts from "typescript";

import * as Lint from "..";

import { codeExamples } from "./code-examples/functionConstructor.examples";

export class Rule extends Lint.Rules.AbstractRule {
Expand Down
1 change: 1 addition & 0 deletions src/rules/importBlacklistRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
isNamedImports,
} from "tsutils";
import * as ts from "typescript";

import * as Lint from "../index";

export class Rule extends Lint.Rules.AbstractRule {
Expand Down
1 change: 1 addition & 0 deletions src/rules/interfaceOverTypeLiteralRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import { getChildOfKind, isTypeAliasDeclaration, isTypeLiteralNode } from "tsutils";
import * as ts from "typescript";

import * as Lint from "../index";

export class Rule extends Lint.Rules.AbstractRule {
Expand Down
1 change: 1 addition & 0 deletions src/rules/maxClassesPerFileRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import { isClassDeclaration, isClassExpression } from "tsutils";
import * as ts from "typescript";

import * as Lint from "../index";

interface Options {
Expand Down
1 change: 1 addition & 0 deletions src/rules/maxFileLineCountRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

import * as ts from "typescript";

import * as Lint from "../index";

export class Rule extends Lint.Rules.AbstractRule {
Expand Down
1 change: 1 addition & 0 deletions src/rules/maxLineLengthRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import { getLineRanges } from "tsutils";
import * as ts from "typescript";

import * as Lint from "../index";

interface MaxLineLengthRuleOptions {
Expand Down
1 change: 1 addition & 0 deletions src/rules/newlineBeforeReturnRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import { getPreviousStatement } from "tsutils";
import * as ts from "typescript";

import * as Lint from "../index";

export class Rule extends Lint.Rules.AbstractRule {
Expand Down
1 change: 1 addition & 0 deletions src/rules/newlinePerChainedCallRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
isSameLine,
} from "tsutils";
import * as ts from "typescript";

import * as Lint from "..";

export class Rule extends Lint.Rules.AbstractRule {
Expand Down
1 change: 1 addition & 0 deletions src/rules/noAnyRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import * as ts from "typescript";

import * as Lint from "../index";

import { codeExamples } from "./code-examples/noAny.examples";

export class Rule extends Lint.Rules.AbstractRule {
Expand Down
1 change: 1 addition & 0 deletions src/rules/noDefaultImportRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import { isImportDeclaration, isNamedImports, isStringLiteral } from "tsutils";
import * as ts from "typescript";

import * as Lint from "../index";

const fromModulesConfigOptionName = "fromModules";
Expand Down
1 change: 1 addition & 0 deletions src/rules/noDuplicateImportsRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import { isImportDeclaration, isLiteralExpression, isModuleDeclaration } from "tsutils";
import * as ts from "typescript";

import * as Lint from "../index";

export class Rule extends Lint.Rules.AbstractRule {
Expand Down
1 change: 1 addition & 0 deletions src/rules/noEmptyInterfaceRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { isInterfaceDeclaration } from "tsutils";
import * as ts from "typescript";

import * as Lint from "../index";

import { codeExamples } from "./code-examples/noEmptyInterface.examples";

export class Rule extends Lint.Rules.AbstractRule {
Expand Down
1 change: 1 addition & 0 deletions src/rules/noInferredEmptyObjectTypeRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import { isObjectFlagSet, isObjectType, isTypeReference } from "tsutils";
import * as ts from "typescript";

import * as Lint from "../index";

export class Rule extends Lint.Rules.TypedRule {
Expand Down