Skip to content

Commit 8235815

Browse files
committed
Initial commit
0 parents  commit 8235815

12 files changed

+544
-0
lines changed

.editorconfig

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
root = true
4+
5+
[*]
6+
indent_size = 2
7+
indent_style = space
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.DS_Store
2+
coverage/
3+
node_modules/
4+
npm-debug.log
5+
dist/
6+
typings/

.travis.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
sudo: false
2+
language: node_js
3+
4+
notifications:
5+
email:
6+
on_success: never
7+
on_failure: change
8+
9+
node_js:
10+
- "stable"
11+
12+
after_script: "npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Blake Embrey ([email protected])
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# TSLint Config Standard
2+
3+
[![NPM version][npm-image]][npm-url]
4+
[![NPM downloads][downloads-image]][downloads-url]
5+
[![Build status][travis-image]][travis-url]
6+
7+
> Standard TSLint configuration.
8+
9+
## Installation
10+
11+
```sh
12+
npm install tslint-standard --save
13+
```
14+
15+
## Usage
16+
17+
```json
18+
{
19+
"extends": "tslint-config-standard"
20+
}
21+
```
22+
23+
### Rules
24+
25+
* [TSLint](https://www.npmjs.com/package/tslint)
26+
* [TSLint ESLint Rules](https://www.npmjs.com/package/tslint-eslint-rules)
27+
* [TSLint MicroSoft Contrib](https://www.npmjs.com/package/tslint-microsoft-contrib)
28+
29+
## License
30+
31+
Apache 2.0
32+
33+
[npm-image]: https://img.shields.io/npm/v/tslint-config-standard.svg?style=flat
34+
[npm-url]: https://npmjs.org/package/tslint-config-standard
35+
[downloads-image]: https://img.shields.io/npm/dm/tslint-config-standard.svg?style=flat
36+
[downloads-url]: https://npmjs.org/package/tslint-config-standard
37+
[travis-image]: https://img.shields.io/travis/blakeembrey/tslint-config-standard.svg?style=flat
38+
[travis-url]: https://travis-ci.org/blakeembrey/tslint-config-standard

package.json

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "tslint-config-standard",
3+
"version": "0.0.0",
4+
"description": "Standard TSLint configuration",
5+
"main": "tslint.js",
6+
"files": [
7+
"tslint.js",
8+
"README.md",
9+
"LICENSE"
10+
],
11+
"scripts": {
12+
"lint": "standard",
13+
"test-spec": "blue-tape test/index.js | tap-spec",
14+
"test": "npm run lint && npm run test-spec"
15+
},
16+
"repository": {
17+
"type": "git",
18+
"url": "git://github.com/blakeembrey/tslint-config-standard.git"
19+
},
20+
"keywords": [
21+
"tslint",
22+
"config",
23+
"standard",
24+
"standardjs",
25+
"typescript",
26+
"ts"
27+
],
28+
"author": {
29+
"name": "Blake Embrey",
30+
"email": "[email protected]",
31+
"url": "http://blakeembrey.me"
32+
},
33+
"license": "Apache-2.0",
34+
"bugs": {
35+
"url": "https://github.com/blakeembrey/tslint-config-standard/issues"
36+
},
37+
"homepage": "https://github.com/blakeembrey/tslint-config-standard",
38+
"devDependencies": {
39+
"blue-tape": "^0.2.0",
40+
"standard": "^7.0.1",
41+
"tap-spec": "^4.1.1",
42+
"tslint": "^3.10.2"
43+
},
44+
"dependencies": {
45+
"tslint-eslint-rules": "^1.3.0",
46+
"tslint-microsoft-contrib": "^2.0.6"
47+
}
48+
}

test/cases/semicolon.out

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cases/semicolon.ts[1, 7]: unused variable: 'foo'
2+
cases/semicolon.ts[1, 17]: unnecessary semicolon

test/cases/semicolon.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const foo = true;

test/cases/trailing-comma.out

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cases/trailing-comma.ts[1, 7]: unused variable: 'foo'
2+
cases/trailing-comma.ts[3, 7]: trailing comma

test/cases/trailing-comma.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const foo = {
2+
a: 1,
3+
b: 2,
4+
}

test/index.js

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
var fs = require('fs')
2+
var exec = require('child_process').exec
3+
var path = require('path')
4+
var test = require('blue-tape')
5+
6+
var EXT_REGEX = /\.tsx?$/
7+
var TSLINT_BIN = require.resolve('tslint/bin/tslint')
8+
var CONFIG_FILE = path.join(__dirname, '../tslint.js')
9+
10+
test('tslint standard', function (t) {
11+
var testCases = fs.readdirSync(path.join(__dirname, 'cases'))
12+
.filter(function (filename) {
13+
return EXT_REGEX.test(filename)
14+
})
15+
.map(function (filename) {
16+
return path.join(__dirname, 'cases', filename)
17+
})
18+
19+
testCases.forEach(function (testCase) {
20+
t.test(path.basename(testCase).replace(EXT_REGEX, ''), function (t) {
21+
var filename = path.relative(__dirname, testCase)
22+
23+
exec('node ' + TSLINT_BIN + ' --config ' + CONFIG_FILE + ' ' + filename, { cwd: __dirname }, function (err, stdout, stderr) {
24+
t.ok(err)
25+
26+
fs.readFile(testCase.replace(EXT_REGEX, '.out'), 'utf8', function (err, result) {
27+
t.notOk(err)
28+
29+
t.equal(stdout, result)
30+
31+
t.end()
32+
})
33+
})
34+
})
35+
})
36+
37+
t.end()
38+
})

0 commit comments

Comments
 (0)