Skip to content
This repository was archived by the owner on Aug 12, 2020. It is now read-only.

Commit f7a779a

Browse files
committed
Added tslint for editor and webpack
Refs #20
1 parent 9665796 commit f7a779a

File tree

4 files changed

+84
-4
lines changed

4 files changed

+84
-4
lines changed

packages/react-scripts/config/webpack.config.dev.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,13 @@ module.exports = {
101101
// @remove-on-eject-end
102102
module: {
103103
// First, run the linter.
104-
// It's important to do this before Babel processes the JS.
104+
// It's important to do this before Babel or TypeScript processes the JS/TS.
105105
preLoaders: [
106+
{
107+
test: /\.(ts|tsx)$/,
108+
loader: 'tslint',
109+
include: paths.appSrc
110+
},
106111
{
107112
test: /\.(js|jsx)$/,
108113
loader: 'eslint',
@@ -112,7 +117,7 @@ module.exports = {
112117
loaders: [
113118
// Process TS with TypeScript and then with Babel
114119
{
115-
test: /\.(ts|tsx)?$/,
120+
test: /\.(ts|tsx)$/,
116121
include: paths.appSrc,
117122
loader: 'awesome-typescript',
118123
query: {

packages/react-scripts/config/webpack.config.prod.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,13 @@ module.exports = {
107107
// @remove-on-eject-end
108108
module: {
109109
// First, run the linter.
110-
// It's important to do this before Babel processes the JS.
110+
// It's important to do this before Babel or TypeScript processes the JS/TS.
111111
preLoaders: [
112+
{
113+
test: /\.(ts|tsx)$/,
114+
loader: 'tslint',
115+
include: paths.appSrc
116+
},
112117
{
113118
test: /\.(js|jsx)$/,
114119
loader: 'eslint',

packages/react-scripts/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nlesc/react-scripts",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"description": "Configuration and scripts for Create React App with Typescript.",
55
"repository": "NLeSC/create-react-app",
66
"license": "BSD-3-Clause",
@@ -63,6 +63,9 @@
6363
"strip-ansi": "3.0.1",
6464
"style-loader": "0.13.1",
6565
"typescript": "^2.0.7",
66+
"tslint": "^3.15.1",
67+
"tslint-loader": "^2.1.5",
68+
"tslint-react": "^1.1.0",
6669
"url-loader": "0.5.7",
6770
"webpack": "1.13.2",
6871
"webpack-dev-server": "1.16.2",
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"extends": ["tslint:latest", "tslint-react"],
3+
"rules": {
4+
"class-name": true,
5+
"comment-format": [
6+
true,
7+
"check-space"
8+
],
9+
"indent": [
10+
true,
11+
"spaces"
12+
],
13+
"jsx-alignment": true,
14+
"jsx-no-lambda": false,
15+
"jsx-no-string-ref": true,
16+
"jsx-no-multiline-js": false,
17+
"jsx-self-close": true,
18+
"member-access": false,
19+
"no-duplicate-variable": true,
20+
"no-eval": true,
21+
"no-internal-module": true,
22+
"no-trailing-whitespace": true,
23+
"no-unsafe-finally": true,
24+
"no-var-keyword": true,
25+
"one-line": [
26+
true,
27+
"check-open-brace",
28+
"check-whitespace"
29+
],
30+
"ordered-imports": false,
31+
"quotemark": [
32+
true,
33+
"single",
34+
"jsx-double"
35+
],
36+
"semicolon": [
37+
true,
38+
"always"
39+
],
40+
"triple-equals": [
41+
true,
42+
"allow-null-check"
43+
],
44+
"typedef-whitespace": [
45+
true,
46+
{
47+
"call-signature": "nospace",
48+
"index-signature": "nospace",
49+
"parameter": "nospace",
50+
"property-declaration": "nospace",
51+
"variable-declaration": "nospace"
52+
}
53+
],
54+
"variable-name": [
55+
true,
56+
"ban-keywords"
57+
],
58+
"whitespace": [
59+
true,
60+
"check-branch",
61+
"check-decl",
62+
"check-operator",
63+
"check-separator",
64+
"check-type"
65+
]
66+
}
67+
}

0 commit comments

Comments
 (0)