包详细信息

tslint-plugin-ikatyang

ikatyang138MIT1.1.1

tslint rules for ikatyang

tslint, tslint-plugin, tslint-rules

自述文件

tslint-plugin-ikatyang

npm build coverage

tslint rules for ikatyang

Changelog

Install

# using npm
npm install --save-dev tslint-plugin-ikatyang tslint

# using yarn
yarn add --dev tslint-plugin-ikatyang tslint

Usage

(tslint.json)

for tslint@5.0.0+

{
  "extends": ["tslint-plugin-ikatyang"],
  "rules": {
    ...
  }
}

for tslint@5.2.0+

{
  "rulesDirectory": ["tslint-plugin-ikatyang"],
  "rules": {
    ...
  }
}

Rules

filename-convention

Enforces all linted files to have their names in a certain case style

Options:

  • namingStyle
    • default: "kebab-case"
    • type: "camelCase" | "kebab-case" | "PascalCase" | "snake_case" | "none"
    • "none" means only accept allowPatterns
  • allowPrefixes
    • default: []
    • type: string[]
    • e.g. ["."] (dotfile)
  • allowSuffixes
    • default: []
    • type: string[]
    • e.g. [".test", ".spec"] (test files)
  • allowPatterns
    • default: []
    • type: string[]
    • regex patterns, extname excluded

no-bad-namespace-import

Disallow bad namespace import

  • pass

    import * as ns1 from './namespace'; // export = namespace { ... }
    import * as ns2 from './individual'; // export const x = 1; export const y = 2; ...
    
  • fail

    import * as func from './function'; // export = function () { ... }
    import * as mixin from './mixin'; // function a () {}; namespace a { ... }; export = a;
    
  • fixed

    import func = require('./function');
    import mixin = require('./mixin');
    

no-mixed-parameter-properties

Disallow mixed parameter properties

  • pass

    class MyClass {
      public prop;
      constructor(arg1, arg2) {}
    }
    
  • fail

    class MyClass {
      public prop;
      constructor(public propArg, arg) {}
      //          ~~~~~~~~~~~~~~ [fail]
    }
    
  • fixed

    class MyClass {
      public prop;
      public propArg;
      constructor(propArg, arg) {
        this.propArg = propArg;
      }
    }
    

Development

# lint
yarn run lint

# format
yarn run format

# build
yarn run build

# test
yarn run test

License

MIT © Ika

更新日志

Change Log

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

1.1.1 (2017-09-09)

Bug Fixes

  • no-bad-namespace-import: allow namespace import with type any (#39) (1cad8c3)

1.1.0 (2017-09-09)

Bug Fixes

  • deps: remove peerDeps for typescript (c154187)

Features

  • rule: add no-bad-namespace-import (#38) (d39c0d2)

1.0.0 (2017-07-29)

Features

  • rules: add filename-convention (d8b9b85)
  • rules: add no-mixed-parameter-properties (42dbb0a)