Package Exports
- tslint-microsoft-contrib/package.json
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tslint-microsoft-contrib) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
tslint-microsoft-contrib
A set of TSLint rules used on some Microsoft projects.
Version 0.0.4
This software is not yet released with a 1.0 version. All release blockers are listed in the issues page.
Installation
npm install tslint-microsoft-contribConfiguration
Configure your Grunt build task
Add the new rulesDirectory to your tslint task:
grunt.initConfig({
tslint: {
options: {
rulesDirectory: 'node_modules/tslint-microsoft-contrib',
configuration: grunt.file.readJSON("tslint-contrib.json")
},
files: {
src: ['src/file1.ts', 'src/file2.ts']
}
}
})The tslint-contrib.json file follows the same conventions as other tslint rules.
Supported Rules
A sample configuration file with all options is available under tslint-microsoft-contrig/tslint.json
export-nameThe name of the exported module must match the filename of the source file. This is case-sensitive but ignores file extension.missing-optional-annotationA parameter that follows one or more parameters marked as optional is not itself marked optionalno-banned-termsDo not use banned terms: caller, callee, eval, arguments. These terms refer to functions or properties that should not be used, so it is best practice to simply avoid them.no-cookiesDo not use cookiesno-delete-expressionDo not delete expressions. Only properties should be deletedno-disable-auto-sanitizationDo not disable auto-sanitization of HTML because this opens up your page to an XSS attack. Specifically, do not use the execUnsafeLocalFunction or setInnerHTMLUnsafe functions.no-document-writeDo not use document.writeno-duplicate-parameter-namesDo not write functions or methods with duplicate parameter namesno-exec-scriptDo not use the execScript functionsno-function-constructor-with-string-argsDo not use the version of the Function constructor that accepts a string argument to define the body of the functionno-http-stringDo not use strings that start with 'http:'. URL strings should start with 'https:'. Http strings can be a security problem and indicator that your software may suffer from cookie-stealing attacks.no-increment-decrementAvoid use of increment and decrement operators particularly as part of complicated expressionsno-multiline-stringDo not declare multiline stringsno-unnecessary-semicolonsRemove unnecessary semicolonsno-octal-literalDo not use octal literals or escaped octal sequencesno-reserved-keywordsDo not use reserved keywords as names of local variables, fields, functions, or other identifiers.no-string-based-set-immediateDo not use the version of setImmediate that accepts code as a string argument. However, it is acceptable to use the version of setImmediate where a direct reference to a function is provided as the callback argumentno-string-based-set-intervalDo not use the version of setInterval that accepts code as a string argument. However, it is acceptable to use the version of setInterval where a direct reference to a function is provided as the callback argumentno-string-based-set-timeoutDo not use the version of setTimeout that accepts code as a string argument. However, it is acceptable to use the version of setTimeout where a direct reference to a function is provided as the callback argumentno-unused-importsRemove unused importsno-with-statementDo not use with statements. Assign the item to a new variable insteadreact-no-dangerous-htmlDo not use React's dangerouslySetInnerHTML API. This rule finds usages of the dangerouslySetInnerHTML API (but not any JSX references). For more info see the react-no-dangerous-html Rule wiki page.use-named-parameterDo not reference the arguments object by numerical index; instead, use a named parameter. This rule is similar to JSLint's Use a named parameter rule.
Development
To develop tslint-microsoft-contrib simply clone the repository, install dependencies and run grunt:
git config --global core.autocrlf input
git config --global core.eol lf
git clone git@github.com:Microsoft/tslint-microsoft-contrib.git
cd tslint-microsoft-contrib
npm install
grunt allDebug code
If command fails because of file access permissions, prefix it with sudo.
npm install -g node-inspector
node-inspectorIn another terminal window run:
# on *nix machines:
node --debug-brk /usr/local/bin/grunt mochaTest
# on Windows machines:
node --debug-brk /c/Users/[your alias]/AppData/Roaming/npm/node_modules/grunt-cli/bin/gruntOpen in browser:
http://127.0.0.1:8080/?ws=127.0.0.1:8080&port=5858Set a breakpoint somewhere in your code and resume execution. Your breakpoint should be hit.
Creating a new Release
Refer to the Releases Wiki Page