diff --git a/package.json b/package.json
index cd72d86..ae09a38 100644
--- a/package.json
+++ b/package.json
@@ -4,11 +4,13 @@
"description": "An React Scaffold featuring React (Tests, Dev/Prod), Visual Basic 6.0, Ava, NYC, TypeScript, TsLint, and Webpack2 by @ngParty Team",
"main": "index.js",
"scripts": {
+ "pretest": "npm run lint",
"test": "tsc && ava --verbose",
"test:watch": "tsc -w & ava --verbose --watch",
"cover": "nyc npm test",
"cover:watch": "nodemon --quiet --watch src --ext ts,tsx --exec npm run cover",
"check-coverage": "nyc --check-coverage --statements 80 --branches 80 --functions 80 --lines 80 npm test",
+ "lint": "tslint \"src/**/*.tsx\" \"src/**/*.ts\"",
"start": "webpack-dev-server --env.dev --hot"
},
"repository": {
@@ -58,6 +60,8 @@
"nyc": "7.1.0",
"react-addons-test-utils": "15.3.0",
"sinon": "1.17.5",
+ "tslint": "3.14.0",
+ "tslint-react": "0.4.0",
"typescript": "2.0.0",
"webpack": "2.1.0-beta.20",
"webpack-config-utils": "2.0.0",
diff --git a/src/App.test.tsx b/src/App.test.tsx
index 3ddf7d4..0e72cb0 100644
--- a/src/App.test.tsx
+++ b/src/App.test.tsx
@@ -1,6 +1,6 @@
import test, { TestContext } from 'ava';
-import * as React from 'react';
import { shallow } from 'enzyme';
+import * as React from 'react';
import { App } from './App';
@@ -8,5 +8,3 @@ test( 'has a Hello message', ( t: TestContext ) => {
const wrapper = shallow();
t.is( wrapper.contains(
Hello from Sofia!
), true );
} );
-
-
diff --git a/src/App.tsx b/src/App.tsx
index b8b3ef0..6bede2f 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -3,7 +3,6 @@ import { Component } from 'react';
export class App extends Component {
render() {
- return Hello from Sofia!
+ return Hello from Sofia!
;
}
}
-
diff --git a/src/main.tsx b/src/main.tsx
index 96f720b..92fb2f5 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -1,7 +1,6 @@
-import * as React from 'react'
-import { render } from 'react-dom'
+import * as React from 'react';
+import { render } from 'react-dom';
-import { App } from './App'
-
-render(, document.getElementById('app'))
+import { App } from './App';
+render(, document.getElementById('app'));
diff --git a/tslint.json b/tslint.json
new file mode 100644
index 0000000..ce4f25b
--- /dev/null
+++ b/tslint.json
@@ -0,0 +1,123 @@
+{
+ "extends": ["tslint:latest", "tslint-react"],
+ "rules": {
+
+ "jsx-no-lambda": true,
+ "jsx-alignment": true,
+ "jsx-no-string-ref": true,
+ "jsx-self-close": true,
+
+ "arrow-parens": true,
+ "class-name": true,
+ "comment-format": [
+ true,
+ "check-space"
+ ],
+ "curly": true,
+ "eofline": true,
+ "forin": true,
+ "indent": [
+ true,
+ "spaces"
+ ],
+ "label-position": true,
+ "label-undefined": true,
+ "max-line-length": [
+ true,
+ 120
+ ],
+ "no-arg": true,
+ "no-bitwise": true,
+ "no-console": [
+ true,
+ "debug",
+ "info",
+ "time",
+ "timeEnd",
+ "trace"
+ ],
+ "no-construct": true,
+ "no-debugger": true,
+ "no-duplicate-key": true,
+ "no-duplicate-variable": true,
+ "no-empty": false,
+ "no-eval": true,
+ "no-shadowed-variable": true,
+ "no-string-literal": true,
+ "no-switch-case-fall-through": true,
+ "trailing-comma": true,
+ "no-trailing-whitespace": true,
+ "no-unused-expression": true,
+ "no-unused-variable": false,
+ "no-unreachable": true,
+ "no-use-before-declare": false,
+ "no-var-keyword": true,
+ "one-line": [
+ true,
+ "check-open-brace",
+ "check-catch",
+ "check-else",
+ "check-whitespace"
+ ],
+ "radix": true,
+ "semicolon": true,
+ "triple-equals": [
+ true,
+ "allow-null-check"
+ ],
+ "use-strict": true,
+ "typedef-whitespace": [
+ true,
+ {
+ "call-signature": "nospace",
+ "index-signature": "nospace",
+ "parameter": "nospace",
+ "property-declaration": "nospace",
+ "variable-declaration": "nospace"
+ },
+ {
+ "call-signature": "onespace",
+ "index-signature": "onespace",
+ "parameter": "onespace",
+ "property-declaration": "onespace",
+ "variable-declaration": "onespace"
+ }
+ ],
+ "variable-name": [
+ true,
+ "ban-keywords",
+ "allow-leading-underscore"
+ ],
+ "whitespace": [
+ true,
+ "check-branch",
+ "check-decl",
+ "check-operator",
+ "check-module",
+ "check-separator",
+ "check-type",
+ "check-typecast"
+ ],
+ "quotemark": [
+ true,
+ "single",
+ "jsx-double"
+ ],
+ "member-access": false,
+ "member-ordering": [
+ true,
+ "variables-before-functions"
+ ],
+ "one-variable-per-declaration": [
+ true
+ ],
+ "no-namespace": [
+ true,
+ "allow-declarations"
+ ],
+ "no-invalid-this": [
+ true,
+ "check-function-in-method"
+ ]
+ }
+}