tslint rules for ikatyang
npm install tslint-plugin-ikatyang


tslint rules for ikatyang
``shusing npm
npm install --save-dev tslint-plugin-ikatyang tslint
Usage
(tslint.json)
for
tslint@5.0.0+`json
{
"extends": ["tslint-plugin-ikatyang"],
"rules": {
...
}
}
`for
tslint@5.2.0+`json
{
"rulesDirectory": ["tslint-plugin-ikatyang"],
"rules": {
...
}
}
`Rules
$3
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$3
Disallow bad namespace import
- pass
`ts
import * as ns1 from './namespace'; // export = namespace { ... }
import * as ns2 from './individual'; // export const x = 1; export const y = 2; ...
`- fail
`ts
import * as func from './function'; // export = function () { ... }
import * as mixin from './mixin'; // function a () {}; namespace a { ... }; export = a;
`- fixed
`ts
import func = require('./function');
import mixin = require('./mixin');
`$3
Disallow mixed parameter properties
- pass
`ts
class MyClass {
public prop;
constructor(arg1, arg2) {}
}
`- fail
`ts
class MyClass {
public prop;
constructor(public propArg, arg) {}
// ~~~~~~~~~~~~~~ [fail]
}
`- fixed
`ts
class MyClass {
public prop;
public propArg;
constructor(propArg, arg) {
this.propArg = propArg;
}
}
`Development
`sh
lint
yarn run lintformat
yarn run formatbuild
yarn run buildtest
yarn run test
``MIT © Ika